<?php
	$acl=$_SESSION["acl"];
	if (strlen($acl)<1 || !strpos($acl,"<0016>")) {	//没有权限
		ob_clean();
		header("Location: accesserror.html");
		exit;
	}
?>


<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>清单查询</title>
</head>

<body background="bkg.bmp">

<p align="center"><font size="5"><b>客人上网清单</b></font></p>
<hr color="#999966">


<p align="center">
<?php
	$strYear=$_REQUEST["year"];
	$strMonth=$_REQUEST["month"];
	$loginname = $_REQUEST["loginname"];
	if ($loginname!="") {
		$db=mysql_pconnect(get_cfg_var("SIPSERVER"),get_cfg_var("SIPUSER"),get_cfg_var("SIPPWD"));
		mysql_select_db(get_cfg_var("SIPDB"),$db);
		$rs = mysql_query( "select loginname,userid,addtime,checked,type from users where loginname='".$loginname."' and addtime like '".$strYear."-".$strMonth."-%' order by addtime",$db );
		if ($row = mysql_fetch_array($rs)) {
			echo("<table border='1' bordercolor='#808080' cellspacing='0' cellpadding='0'>");
			echo("<tr><td>序号</td><td>登录ID</td><td>开号时间</td><td>内部唯一ID号</td><td>类型</td><td>是否结帐</td></tr>");
			$n=1;
			while ($row) {
				echo("<tr>");
				echo("<td>".strval($n)."</td>");
				echo("<td>".$row["loginname"]."</td>");
				echo("<td>".$row["addtime"]."</td>");
				echo("<td><a href=query2_result.php?userid=".$row["userid"].">".$row["userid"]."</a></td>");
				echo("<td>".$row["type"]."</td>");
				if ($row["checked")=="y") {
					echo("<td>y</td>");
				} else {
					echo("<td>未结帐</td>");
				}
				echo("</tr>");
				$row = mysql_fetch_array($rs);
				$n=$n+1;
			}
			echo("</table><br>");
		} else {
			echo("不存在此用户ID！");
		}
		mysql_free_result($rs);
		mysql_close($db);
	} else {
		echo("必须输入用户ID才能查询上网清单！");
	}
?>
</p>


<hr>
<p align="center">SIP酒店上网计费管理系统</p>
<p align="center">作者：<b>深圳市飞沃软件有限公司</b></p>

</body>

</html>
