<?php
	$acl=$_SESSION["acl"];
	if (strlen($acl)<1 || !strpos($acl,"<0007>")) {	//没有权限
		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">

<SCRIPT LANGUAGE="javascript">
function checkvalid()
{
	var loginname=document.form1.loginname.value;
	if (document.form1.loginname.value=="") {
		alert("必须输入用户ID（房号）！");
		return false;
	}
	if (loginname.length>20) {
		alert("用户ID长度不能大于20个字符(1个汉字占2个字符)！");
		return false;
	}
	if ( isNaN( parseInt(document.form1.onlines.value) ) ) {
		document.form1.onlines.value="1";
	}
	else {
		if ( parseInt(document.form1.onlines.value)<1 ) {
			document.form1.onlines.value="1";
		}
	}
	if ( isNaN( parseInt(document.form1.prepay.value) ) ) {
		document.form1.prepay.value="0";
	}
	else {
		if ( parseInt(document.form1.prepay.value)<1 ) {
			document.form1.prepay.value="0";
		}
	}
	return true;
}
</SCRIPT>

<title>开通用户</title>
</head>

<body background="bkg.bmp">

<p align="center"><font size="5"><b>开通用户</b></font></p>
<hr color="#999966">
<p>　</p>
<div align="center">
  <center>
  <form name=form1 method="POST" action="adduser_result.php" onsubmit="return checkvalid();">
  <table border="1" width="514" height="175" bordercolor="#008080" cellspacing="0" cellpadding="0">
    <tr>
      <td width="227" height="40">&nbsp;用户ID（房号）</td>
      <td width="273" align="center" height="40">
          <input type="text" name="loginname" size="20">
        </td>
    </tr>
    <tr>
      <td width="227" height="40">&nbsp;结帐类型</td>
      <td width="273" align="center" height="40">
          <select size="1" name="usertype">
<?php
		$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 name,orderid from types order by orderid",$db);		//读取结帐类型列表
       while ($row = mysql_fetch_array($rs)) {
           	if ($row["name"]=="小时") {
		       echo("<option selected value=".chr(34).$row["name"].chr(34).">".$row["name"]."</option>");	//缺省选择小时类型
           	} else {
		       echo("<option value=".chr(34).$row["name"].chr(34).">".$row["name"]."</option>");
	       }
       }
		mysql_free_result($rs);
		mysql_close($db);
?>
          </select>
        </td>
    </tr>
    <tr>
      <td width="227" height="41">&nbsp;预付押金</td>
      <td width="273" align="center" height="41">
          <input type="text" name="prepay" size="4" value="0">元
        </td>
    </tr>
    <tr>
      <td width="227" height="41">&nbsp;允许同时在线使用人数</td>
      <td width="273" align="center" height="41">
          <input type="text" name="onlines" size="2" value="1">人
        </td>
    </tr>
    <tr>
      <td colspan="2" width="454" align="center" height="51"><input type="submit" value="提交" name="B1"></td>
    </tr>
  </table>
  </form>
  </center>
</div>

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

</body>

</html>
