<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>管理员帐号--新增帐号</title>
<link href='css/base.css' rel='stylesheet' type='text/css'>

<!-- 密码强度 -->
<script>
  window.onload = function () {
    let pwd = document.getElementById("pwd");
    let pwd_strength = document.getElementById("pwd_strength");
    pwd.onkeyup = function () {
      let val = pwd.value;
      let strength = 0;
      if (val.length >= 8) {
        strength++;
      }
      if (val.length >= 16) {
        strength++;
      }
      if (/[0-9]/.test(val)) {
        strength++;
      }
      if (/[a-z]/.test(val)) {
        strength++;
      }
      if (/[A-Z]/.test(val)) {
        strength++;
      }
      if (/[_@!\.-]/.test(val)) {
        strength++;
      }
      switch (strength) {
        case 1:
          set_strength(["#E05A2C"]);
          break;
        case 2:
          set_strength(["#E05A2C", "#E05A2C"]);
          break;
        case 3:
          set_strength(["#EE8609", "#EE8609", "#EE8609"]);
          break;
        case 4:
          set_strength(["#EE8609", "#EE8609", "#EE8609", "#EE8609"]);
          break;
        case 5:
          set_strength(["#7BBD2C", "#7BBD2C", "#7BBD2C", "#7BBD2C", "#7BBD2C"]);
          break;
        case 6:
          set_strength(["#7BBD2C", "#7BBD2C", "#7BBD2C", "#7BBD2C", "#7BBD2C", "#7BBD2C"]);
          break;
        default:
          set_strength([]);
      }
    }
    function set_strength(val) {
      for (let i = 0; i < pwd_strength.children.length; i++) {
        pwd_strength.children[i].style.background = "#DDDDDD";
      }
      for (let i = 0; i < val.length; i++) {
        pwd_strength.children[i].style.background = val[i];
      }
    }
  }

</script>
<style>
  #pwd_strength {
    display: flex;
    justify-content: space-around;
    width: 180px;
    height: 15px;
    margin: 10px 0;
  }
  #pwd_strength li {
    width: 25px;
    margin-right: 5px;
    background-color: #DDDDDD;
  }
</style>
<!-- 密码强度 -->

<script language='javascript'>
	function checkSubmit()
  {
     if(document.form1.userid.value==""){
	     alert("用户ID不能为空！");
	     document.form1.userid.focus();
	     return false;
     }
     if(document.form1.uname.value==""){
	     alert("用户名不能为空！");
	     document.form1.uname.focus();
	     return false;
     }
     if(document.form1.pwd.value==""){
	     alert("用户密码不能为空！");
	     document.form1.pwd.focus();
	     return false;
     }
     return true;
 }
</script>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6">
  <tr>
    <td height="19" background="images/tbg.gif" bgcolor="#E7E7E7"> 
      <table width="96%" border="0" cellspacing="1" cellpadding="1">
        <tr> 
          <td width="24%" style="padding-left:10px;"><b><strong>新增帐号</strong></b> </td>
          <td width="76%" align="right"><strong><a href="sys_admin_user.php"><u>管理帐号</u></a></strong></td>
        </tr>
      </table></td>
</tr>
<tr>
    <td height="215" align="center" valign="top" bgcolor="#FFFFFF">
	<form name="form1" action="sys_admin_user_add.php" onSubmit="return checkSubmit();" method="post">
  <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
	<input type="hidden" name="dopost" value="add" />
  <table width="98%" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td width="16%" height="30">用户登录ID：</td>
            <td width="84%"  style="text-align:left;"><input name="userid" type="text" id="userid" size="16" style="width:200px" />
              （只能用'0-9'、'a-z'、'A-Z'、'.'、'@'、'_'、'-'、'!'以内范围的字符）</td>
          </tr>
          <tr> 
            <td height="30">用户笔名：</td>
            <td style="text-align:left;"><input name="uname" type="text" id="uname" size="16" style="width:200px" /> &nbsp;（发布文章后显示责任编辑的名字）</td>
          </tr>
          <tr> 
            <td height="30">用户密码：</td>
            <td style="text-align:left;"><input name="pwd" type="text" id="pwd" size="16" style="width:200px" /> &nbsp;（只能用'0-9'、'a-z'、'A-Z'、'.'、'@'、'_'、'-'、'!'以内范围的字符）</td>
          </tr>
          <tr>
            <td>密码强度：</td>
            <td>
              <ul id="pwd_strength"> 
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
              </ul>
            </td>
          </tr>
          <tr>
            <td></td>
            <td style="color: red;">
              密码必须包含1个数字，1个小写字母，1个大写字母！而且必须大于8位小于128位！
            </td>
          </tr>
          <tr> 
            <td height="30">用户组：</td>
            <td style="text-align:left;">
			    <select name='usertype' style='width:200px'>
			  	<?php
			  	
			  	$dsql->SetQuery("Select * from `#@__admintype` order BY `rank` asc");
			  	$dsql->Execute("ut");
			  	while($myrow = $dsql->GetObject("ut"))
			  	{
			  		echo "<option value='".$myrow->rank."'>".$myrow->typename."</option>\r\n";
			  	}
			  	?>
			  </select>
			    &nbsp;
			    【<a href='sys_group.php'><u>用户组设定</u></a>】
            </td>
          </tr>
          <tr> 
            <td height="30">授权栏目：</td>
            <td style="text-align:left;">
			<select name="typeids[]" id="typeid" size='10' style="width:200px" multiple="true">
                <option value="0" class='alltype' selected>--所有频道--</option>
				<?php echo $typeOptions?>
             </select>(按 Ctrl 可以进行多选)
			 </td>
          </tr>
          <tr> 
            <td height="30">真实姓名：</td>
            <td style="text-align:left;"><input name="tname" type="text" id="tname" size="16" style="width:200px" /> &nbsp;</td>
          </tr>
          <tr> 
            <td height="30">电子邮箱：</td>
            <td style="text-align:left;"><input name="email" type="text" id="email" size="16" style="width:200px" /> &nbsp;</td>
          </tr>
          <tr> 
            <td height="30">安全验证串：</td>
            <td style="text-align:left;">
            	<input name="safecode" type="text" id="safecode" size="16" style="width:200px" />
            	<input name="randcode" type="hidden" value="<?php echo $randcode; ?>" />
            	 &nbsp;
            	(复制本代码： <font color='red'><?php echo $safecode;  ?></font> )
            </td>
          </tr>
          <tr> 
            <td height="60">&nbsp;</td>
            <td><input type="submit" name="Submit" value=" 增加用户 " class="coolbg np" /></td>
          </tr>
        </table>
      </form>
	  </td>
</tr>
</table>
</body>
</html>