<?php
session_start();
require_once "../init.php";
require_once "../authority.inc.php";

$UserID = $_POST['UserID'];
$Password = $_POST['Password'];
$Password_C = $_POST['Password_C'];
$RealName = $_POST['RealName'];
$Email = $_POST['Email'];
$Tel = $_POST['Tel'];
$Zip = $_POST['Zip'];
$Addr = $_POST['Addr'];
$iStatus = $_POST['iStatus'];
$Add = $_POST['Add'];
$hot="add";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" 
/>
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="/admin/lib/PIE_IE678.js"></script>
<![endif]-->


<!--[if IE 6]>
<script type="text/javascript" src="/admin/static/h-ui.admin/js/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>增加管理员</title>
<LINK href="../share/style.css" rel=stylesheet>
<script>
function check(form){
   if(form.UserID.value==""){
       alert("请输入用户名");
	   form.UserID.focus();
	   return false;
   }
   if(form.Password.value==""){
       alert("请输入密码");
	   form.Password.focus();
	   return false;
   }
   if(form.Password.value!=form.Password_C.value){
       alert("密码与确认密码不相同");
	   form.Password.focus();
	   return false;
   }
   if(form.RealName.value==""){
       alert("请输入真实姓名");
	   form.RealName.focus();
	   return false;
   }
}
</script>
<script src='../share/global.js'></script>
</head>
<body>
<? include "../share/top.php"?>
<div id="topLink">
<div id="topInfo">
	<span class="tTitle">员工管理</span>
	<span class="sarr"> >> </span>
	新建管理员
	<span class="sarr"> >> </span>
	<a href="<?=$GLOBALS["parentpath"]?>/admins/admins_list.php">返回到员工管理</a>
</div>
</div>
<!--子导航--><div class="page-container">

<? include "admins_nav.inc.php"?>
<!--结束-->


	<?
	 if($Add==1){
		  $sql="insert into admins set UserID='$UserID',Password='".md5($Password)."',RealName='$RealName',".
		       "Email='$Email',Tel='$Tel',iStatus='$iStatus',Zip='$Zip',Addr='$Addr'";
		  $DB->query($sql);
		  echo "<center><br><br><br>增加管理员成功,用户ID是 <font color='red'>$UserID</font>";
		  echo "<center><br><br><a href='admins_list.php'>[ 返 回 ]</a><br><br><br>";

	 }else{?>
      <form action="admins_add.php" method="post" onSubmit="return check(this)">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="table"  class="table table-border table-bordered table-hover table-bg table-sort">
          <tr id="tr">
            <td colspan="2">请输入您要添加的员工资料</td>
          </tr>
		  <tr>
            <td width="45%" align="right">用户名:</td>
            <td><input name="UserID" type="text" class="inputline"><font color='red'>*</font></td>
          </tr>
          <tr>
            <td align="right">密码:</td>
            <td><input name="Password" type="password" class="inputline">
                <font color='red'>*</font></td>
          </tr>
          <tr>
            <td align="right">确认密码:</td>
            <td><input name="Password_C" type="password" class="inputline">
                <font color='red'>*</font></td>
          </tr>
          <tr>
            <td align="right">真实姓名:</td>
            <td><input name="RealName" type="text" class="inputline">
                <font color='red'>*</font></td>
          </tr>
          <tr>
            <td align="right">E-Mail:</td>
            <td><input name="Email" type="text" class="inputline"></td>
          </tr>
          <tr>
            <td align="right">电话:</td>
            <td><input name="Tel" type="text" class="inputline">
            </td>
          </tr>
          <tr>
            <td align="right">邮编:</td>
            <td><input name="Zip" type="text" class="inputline"></td>
          </tr>
          <tr>
            <td align="right">地址:</td>
            <td><input name="Addr" type="text" class="inputline" size="40"></td>
          </tr>
          <tr>
            <td align="right">是否激活:</td>
            <td>
              <input type="radio" name='iStatus' value="1" checked>
              是
              <input type="radio" name='iStatus' value="0">
              否 </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input name="submit" type="submit" class="bt2" value="提交">
			    <input name="Add" type="hidden" value="1">
                <input name="reset" type="reset" class="bt2" value="重置"></td>
          </tr>
        </table>
    </form>
	<?}?>
</div>
<? @$DB->close();
include "../share/bottom.php"?>
</body>
</html>
