<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>添加管理员</title>
		<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="../static/web/css/admin.css">
		<script src="../static/web/js/jquery.min.js"></script>
		<script src="../static/web/js/bootstrap.min.js"></script>
		<script src="js/main.js"></script>
	</head>
	<body>
		<form name="form1" action="sys_admin_user_add.php" onSubmit="return checkSubmit();" method="post">
			<input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token'];?>">
			<input type="hidden" name="dopost" value="add">
			<table align="center" class="table maintable my-3">
				<tr>
					<td bgcolor="#f5f5f5" colspan="2">添加管理员</td>
				</tr>
				<tr>
					<td width="260">会员名：</td>
					<td>
						<input type="text" name="userid" id="userid" class="admin-input-sm">
						<span>（使用[0-9a-zA-Z_@!.-]范围以内字符）</span>
					</td>
				</tr>
				<tr>
					<td>昵称：</td>
					<td>
						<input type="text" name="uname" id="uname" class="admin-input-sm">
						<span>（发布文档后显示作者的名字）</span>
					</td>
				</tr>
				<tr>
					<td>密码：</td>
					<td>
						<input type="text" name="pwd" id="pwd" class="admin-input-sm">
						<span>（使用[0-9a-zA-Z_@!.-]范围以内字符）</span>
					</td>
				</tr>
				<tr>
					<td>会员组：</td>
					<td>
						<select name="usertype" class="admin-input-sm">
							<?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>";
							}
							?>
						</select>
						<a href="sys_group.php" class="btn btn-success btn-sm">会员组管理</a>
					</td>
				</tr>
				<tr>
					<td>授权栏目：</td>
					<td>
						<select name="typeids[]" id="typeid" multiple="yes" class="admin-input-lg">
							<option value="0" selected>所有栏目</option>
							<?php echo $typeOptions?>
						</select>
						<span>（支持多选）</span>
					</td>
				</tr>
				<tr>
					<td>姓名：</td>
					<td><input type="text" name="tname" id="tname" class="admin-input-sm"></td>
				</tr>
				<tr>
					<td>邮箱：</td>
					<td><input type="text" name="email" id="email" class="admin-input-sm"></td>
				</tr>
				<tr>
					<td>验证安全码：</td>
					<td>
						<input type="text" name="safecode" id="safecode" class="admin-input-sm">
						<input type="hidden" name="randcode" value="<?php echo $randcode;?>">（安全码：<span class="text-primary"><?php echo $safecode;?></span>）
					</td>
				</tr>
				<tr>
					<td bgcolor="#f5f5f5" colspan="2" align="center"><button type="submit" class="btn btn-success btn-sm">保存</button></td>
				</tr>
			</table>
		</form>
		<script>
			function checkSubmit() {
				if (document.form1.userid.value == "") {
					ShowMsg("会员id不能为空");
					document.form1.userid.focus();
					return false;
				}
				if (document.form1.uname.value == "") {
					ShowMsg("会员名不能为空");
					document.form1.uname.focus();
					return false;
				}
				if (document.form1.pwd.value == "") {
					ShowMsg("会员密码不能为空");
					document.form1.pwd.focus();
					return false;
				}
				return true;
			}
		</script>
	</body>
</html>