<?
session_start();
$selelag = $HTTP_SESSION_VARS["SelLanguage"];
if (empty($selelag)) header("location:../break.php");
require("../config/".$selelag);
require("../_ConnectString.php");
require("../_function.php");
require("../_image.php");

$_IPLIST = "../iplist.php";

if ((isset($HTTP_SESSION_VARS["LoginID_Sess"])) && (isset($HTTP_SESSION_VARS["OperateRole_Sess"])) && (isset($HTTP_SESSION_VARS["GroupNo_Sess"]))){

		if(strlen($HTTP_SERVER_VARS["QUERY_STRING"])>0){
			$Status  = $HTTP_GET_VARS["Status"];
			$digital = $HTTP_GET_VARS["digital"];
		}else{
			$Status  = $HTTP_POST_VARS["Status"];
			$digital = $HTTP_POST_VARS["digital"];
		}


		Switch($Status){
			case "pop3":
				$Picture_Search = $POP3P_SEARCH;
				$Picture_Calendar = $SEARCH_MAILP_CALENDAR;
				$Fail_Message = $POP3M_CHECKMAILERROR;
				$Title = $POP3_POP3." ".$SEARCH_MAIL_TITLE;
				$Title_show = $POP3_POP3_SHOW." ".$SEARCH_MAIL_TITLE_SHOW;
				break;
			case "imap":
				$Picture_Search = $IMAPP_SEARCH;
				$Picture_Calendar = $SEARCH_MAILP_CALENDAR;
				$Fail_Message = $IMAPM_CHECKMAILERROR;
				$Title = $IMAP_IMAP." ".$SEARCH_MAIL_TITLE;
				$Title_show = $IMAP_IMAP_SHOW." ".$SEARCH_MAIL_TITLE_SHOW;
				break;
			case "smtp":
				$Picture_Search = $SMTPP_SEARCH;
				$Picture_Calendar = $SEARCH_MAILP_CALENDAR;
				$Fail_Message = $SM_CHECKMAILERROR;
				$Title = $SMTP_SMTP." ".$SEARCH_MAIL_TITLE;
				$Title_show = $SMTP_SMTP_SHOW." ".$SEARCH_MAIL_TITLE_SHOW;
				break;
			case "webmailr":
				$Picture_Search = $WEBMAILRP_SEARCH;
				$Picture_Calendar = $SEARCH_MAILP_CALENDAR;
				$Fail_Message = $WRM_CHECKMAILERROR;
				$Title = $WEBMAILR_WEBMAILR." ".$SEARCH_MAIL_TITLE;
				$Title_show = $WEBMAILR_WEBMAILR_SHOW." ".$SEARCH_MAIL_TITLE_SHOW;
				break;
			case "webmails":
				$Picture_Search = $WEBMAILSP_SEARCH;
				$Picture_Calendar = $SEARCH_MAILP_CALENDAR;
				$Fail_Message = $WSM_CHECKMAILERROR;
				$Title = $WEBMAILS_WEBMAILS." ".$SEARCH_MAIL_TITLE;
				$Title_show = $WEBMAILS_WEBMAILS_SHOW." ".$SEARCH_MAIL_TITLE;
				break;
		}

}
else {
	include("../no_privilege.php");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<title><?echo $Title;?></title>
<link href="../Display/display.css" type="text/css" rel="stylesheet">
<SCRIPT language="JavaScript" src="../inc/calendar.js"></SCRIPT>
<Script language="JavaScript" src="../inc/fun.js"></Script>
<script language="JavaScript">
function MailQuery(){
	fn_DateTime_New();
	document.frm.action = "../mail/"+document.frm.Status.value+".php";
	if (document.frm.digital.value == 'digital') document.frm.target = "Edit";
	else document.frm.target = "mainFrame";
	document.frm.submit();
}
function open_ip_window(){
	var strFeatures = "dialogWidth:320px;dialogHeight:150px;status:off;help:no";
	window.showModalDialog("../_ip_list.php",window,strFeatures);
}

function Backup(){
	fn_DateTime_New();
	document.frm.target='';
	document.frm.action = "../query_backup/query_backup.php";
	document.frm.submit();
}

</script>
</head>
<body>
<form name="frm" method="post">
<input type="hidden" name="Status" value="<?echo $Status;?>">
<input type="hidden" name="digital" value="<?echo $digital;?>">
<input type="hidden" name="BACKUP_TYPE" value="<?echo strtoupper($Status)?>">
<input type="hidden" name="QUERY_IP_1" value="">
<input type="hidden" name="QUERY_START_DATETIME" value="<?echo $QUERY_START_DATETIME;?>">
<input type="hidden" name="QUERY_END_DATETIME" value="<?echo $QUERY_END_DATETIME;?>">
<table  height="100%" width="100%" cellSpacing="0" cellPadding="0" border="0" align="center"  >
<tr><td align="center" valign="middle">
	<table class="OpTb" align="center" width="92%" cellSpacing="0" cellPadding="2" >
	  <tr class="Op_Tr" >
		<td colspan="2" align="center">
		  <img src="../<?echo $DIR_IMAGE.$Picture_Search;?>"> <span title="<?echo $Title;?>"><?echo $Title_show;?> </span>
		</td>
	  </tr>
	  <tr height="30">
		<td width="30%" align="right"><span title="<?echo $SEARCH_MAIL_DATE;?>"><?echo $SEARCH_MAIL_DATE_SHOW;?></span> : </td>
		<td>
		  <input type=text size="8" name="QUERY_STARTDATE" value="<?$Y=date("Y");$M=date("m"); echo $Y."-".$M."-01"?>"><a href="javascript:show_calendar('frm.QUERY_STARTDATE');"><img src="../<?echo $DIR_IMAGE.$Picture_Calendar;?>" style="border: 0px solid;"></a>
		  ~ 
		  <input type=text size="8" name="QUERY_ENDDATE" value="<? echo date("Y-m-d")?>"><a href="javascript:show_calendar('frm.QUERY_ENDDATE');"><img src="../<?echo $DIR_IMAGE.$Picture_Calendar;?>" style="border: 0px solid;"></a>
		</td>
	  </tr>
	  <tr height="30">
		<td align="right"><span title="<?echo $SEARCH_MAIL_TIME;?>"><?echo $SEARCH_MAIL_TIME_SHOW;?></span> : </td>
		<td>
		  <select name="QUERY_STARTHOUR" style="font-family:Arial, Helvetica, sans-serif;font-size:x-small ">
			<?echo fn_H($QUERY_STARTHOUR);?>
		  </select> :
		  <select name="QUERY_STARTMINUTE" style="font-family:Arial, Helvetica, sans-serif;font-size:x-small ">
			<?echo fn_M($QUERY_STARTMINUTE);?>
		  </select>~
		  <select name="QUERY_ENDHOUR" style="font-family:Arial, Helvetica, sans-serif;font-size:x-small ">
		   <?echo fn_H($QUERY_ENDHOUR);?>
		  </select> :
		  <select name="QUERY_ENDMINUTE" style="font-family:Arial, Helvetica, sans-serif;font-size:x-small ">
			<?echo fn_M($QUERY_ENDMINUTE);?>
		  </select>
		</td>
	  </tr>
	  <tr height="30">
		<td align="right"><span title="<?echo $SEARCH_MAIL_IP;?>"><?echo $SEARCH_MAIL_IP_SHOW;?></span> :</td>
		<td>
		  <input type="text" size="20" id="QUERY_IP" name="QUERY_IP" value=""><a href="javascript:open_ip_window();"><span title="<?echo $SEARCH_MORE;?>">&nbsp;<?echo $SEARCH_MORE_SHOW;?>...</span></a>
		</td>
	  </tr>
	  <?if ($Status != "webmailr"){?>
		  <tr height="30">
			<td align="right"><span title="<?echo $SEARCH_MAIL_RECEIVER;?>"><?echo $SEARCH_MAIL_RECEIVER_SHOW;?></span> :</td>
			<td><input type="text" size="40" name="QUERY_TO" value=""></td>
		  </tr>
		  <tr height="30">
			<td align="right"><span title="<?echo $SEARCH_MAIL_SENDER;?>"><?echo $SEARCH_MAIL_SENDER_SHOW;?></span> :</td>
			<td><input type="text" size="40" name="QUERY_FROM" value=""></td>
		  </tr>
		  <tr height="30">
			<td align="right"><span title="<?echo $SEARCH_MAIL_CC;?>"><?echo $SEARCH_MAIL_CC_SHOW;?></span> :</td>
			<td><input type="text" size="40" name="QUERY_CC" value=""></td>
		  </tr>
		  <?if($Status == "smtp" || $Status == "webmails"){?>
			<tr height="30">
			  <td align="right"><span title="<?echo $SEARCH_MAIL_BCC;?>"><?echo $SEARCH_MAIL_BCC_SHOW;?></span> :</td>
			  <td><input type="text" size="40" name="QUERY_BCC" value=""></td>
			</tr>
		  <?}?>
		  <tr height="30">
			<td align="right"><span title="<?echo $SEARCH_MAIL_SUBJECT;?>"><?echo $SEARCH_MAIL_SUBJECT_SHOW;?></span> :</td>
			<td><input type="text" size="40" name="QUERY_SUBJECT" value=""></td>
		  </tr>
		  <?if($Status == "webmails"){?>
			<tr height="30">
			  <td align="right"><span title="<?echo $SEARCH_MAIL_HOST;?>"><?echo $SEARCH_MAIL_HOST_SHOW;?></span> :</td>
			  <td>
				 <select name="QUERY_HOST">
				   <?echo fn_WebServer($QUERY_HOST);?>
				 </select>
			  </td>
			</tr>
		  <?}?>
	  <?}else{?>
		  <tr height="30">
			<td align="right"><span title="<?echo $SEARCH_MAIL_URL;?>"><?echo $SEARCH_MAIL_URL_SHOW;?></span> :</td>
			<td><input type="text" size="40" name="QUERY_URL" value=""></td>
		  </tr>
		  <tr height="30">
			<td align="right"><span title="<?echo $SEARCH_MAIL_HOST;?>"><?echo $SEARCH_MAIL_HOST_SHOW;?></span> :</td>
			<td>
			  <select name="QUERY_TAG">
				<?echo fn_WebServer($QUERY_TAG);?>
			  </select>
			</td>
		  </tr>
	  <?}?>
	  <? if (fn_ad()){?>
	  <tr>
		<td align="right"><span title="<?echo $SEARCH_MAIL_ACCOUNT;?>"><?echo $SEARCH_MAIL_ACCOUNT_SHOW;?> :</span></td>
		<td><input type="text" size="40" name="QUERY_ACCOUNT" value=""></td>
	  </tr>
	  <?}?>
	  <tr>
		<td align="right"><span title="<?echo $SEARCH_MAIL_ID;?>"><?echo $SEARCH_MAIL_ID_SHOW;?>:</span></td>
		<td><input type="text" size="40" name="QUERY_ID" value=""></td>
	  </tr>
	  <tr height="30">
		<td colspan="2" align="center"><input name="Query" type="button" onClick="MailQuery();" value="<?echo $SEARCH_MAIL_SUBMIT;?>" title="<?echo $SEARCH_MAIL_SUBMIT;?>">
	
		</td>
	  </tr>
	</table>
</td></tr></table>
</form>
</body>
</html>