<!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="form2" action="member_do.php" method="post" onSubmit="return checkSubmit();">
			<input type="hidden" name="dopost" value="edituser">
			<input type="hidden" name="id" value="<?php echo $id?>">
			<table align="center" class="table maintable my-3">
				<tr>
					<td bgcolor="#f5f5f5" colspan="2"><a href="<?php echo $ENV_GOBACK_URL;?>">会员管理</a> - 修改会员</td>
				</tr>
				<?php if ($row['matt']==10) echo '<tr><td colspan="2"><div class="alert alert-info mb-0">当前会员是关连网站管理员，谨慎操作</div></td></tr>';?>
				<tr>
					<td width="260">头像/会员名：</td>
					<td>
						<span class="mr-1"><?php if ($row['face']!='') {echo "<img src='{$row['face']}' class='user-img-sm'>";};echo "".$row['userid']."";?></span>
						<span class="btn btn-outline-success btn-sm"><?php echo GetMemberTypeName($row['rank']);?></span>
						<span class="btn btn-outline-warning btn-sm"><?php echo GetHonor($row['scores']);?></span>
					</td>
				</tr>
				<tr>
					<td>昵称：</td>
					<td><input type="text" name="uname" id="uname" class="admin-input-sm" value="<?php echo $row['uname']?>"></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><input type="text" name="email" id="email" class="admin-input-sm" value="<?php echo $row['email']?>" pattern="[0-9a-zA-Z_.-]+[@][0-9a-zA-Z_.-]+([.][a-zA-Z]+){1,2}"></td>
				</tr>
				<tr>
					<td>性别：</td>
					<td>
						<label><input type="radio" name="sex" value="男" <?php if ($row['sex']=="男" ) echo" checked='1'" ;?>> 男</label>
						<label><input type="radio" name="sex" value="女" <?php if ($row['sex']=="女" ) echo" checked='1'" ;?>> 女</label>
						<label><input type="radio" name="sex" value="" <?php if ($row['sex']=="" ) echo" checked='1'" ;?>> 保密</label>
					</td>
				</tr>
				<tr>
					<td>钱包积分：</td>
					<td>
						<span class="mr-1">金币：<input type="text" name="money" id="money" class="admin-input-xs" value="<?php echo $row['money'];?>"></span>
						<span class="mr-1">积分：<input type="text" name="scores" id="scores" class="admin-input-xs" value="<?php echo $row['scores'];?>"></span>
						<span>余额：<input type="text" name="user_money" id="user_money" class="admin-input-xs" value="<?php echo $row['user_money'];?>"></span>
					</td>
				</tr>
				<tr>
					<td>等级：</td>
					<td>
						<?php
						$MemberTypes = array();
						$dsql->SetQuery("SELECT `rank`,membername From `#@__arcrank` where `rank`>0");
						$dsql->Execute('n');
						$MemberTypes[0] = "限制会员";
						while($nrow = $dsql->GetObject('n')){
							$MemberTypes[$nrow->rank] = $nrow->membername;
						}
						$options = "<select name='rank' class='admin-input-sm'>";
						foreach($MemberTypes as $k=>$v)
						{
							if ($k!=$row['rank']) $options .= "<option value='$k'>$v</option>";
							else $options .= "<option value='$k' selected>$v</option>";
						}
						$options .= "</select>";
						echo $options;
						?>
					</td>
				</tr>
				<tr>
					<td>升级时间：</td>
					<td>
						<input type="text" name="uptime" id="uptime" class="admin-input-sm" value="<?php echo $row['uptime']=($row['uptime']=='0')? GetDateTimeMk(time()) : GetDateTimeMk($row['uptime']);?>">
						<span>（如果您要升级会员，必须设置此时间为当前时间）</span>
					</td>
				</tr>
				<tr>
					<td>会员天数：</td>
					<td>
						<input type="text" name="exptime" id="exptime" class="admin-input-sm" value="<?php echo $row['exptime']?>">
						<span>（如果您要升级会员，会员天数必须大于0）</span>
					</td>
				</tr>
				<?php if ($mhasDay!=0) {$mhasDay=($mhasDay>0)? $mhasDay : '<tr><td colspan="2"><span class="text-danger">会员已经到期</span></td></tr>';?>
				<tr>
					<td>剩余天数：</td>
					<td><?php echo $mhasDay;?></td>
				</tr>
				<?php }?>
				<tr>
					<td>推荐级别：</td>
					<td>
						<input type="hidden" name="oldmatt" id="oldmatt" class="admin-input-sm" value="<?php echo $row['matt']?>">
						<input name="matt" type="text" id="matt" class="admin-input-sm" value="<?php echo $row['matt']?>">
						<span>（0普通、1推荐、10管理员）</span>
					</td>
				</tr>
				<tr>
					<td>投稿限制：</td>
					<td>
						<input type="text" name="send_max" class="admin-input-xs" value="<?php echo $row['send_max']?>">
						<span>（0不能投稿、-1无限次）</span>
					</td>
				</tr>
				<tr>
					<td>投稿剩余次数：</td>
					<td><?php echo $rtimes;?>次</td>
				</tr>
				<tr>
					<td>资料状况：</td>
					<td>
						<select name="spacesta" class="admin-input-sm">
							<?php
							foreach($staArr as $k=>$v)
							{
								if ($row['spacesta']==$k) echo "<option value='$k' selected>$v</option>";
								else echo "<option value='$k'>$v</option>";
							}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td>空间信息：</td>
					<td>
						<?php
						$nrow = $dsql->GetOne("SELECT * FROM `#@__member_tj` WHERE mid='{$row['mid']}'");
						echo "文档：{$nrow['article']} 图片：{$nrow['album']} 收藏：{$nrow['stow']} 浏览：{$nrow['pagecount']}";
						?>
					</td>
				</tr>
				<tr>
					<td>注册时间/地址：</td>
					<td>
						<span class="mr-1"><?php echo GetDateTimeMk($row['jointime'])?></span>
						<span><?php echo $row['joinip']?></span>
					</td>
				</tr>
				<tr>
					<td>最近时间/地址：</td>
					<td>
						<span class="mr-1"><?php echo GetDateTimeMk($row['logintime'])?></span>
						<span><?php echo $row['loginip']?></span>
					</td>
				</tr>
				<tr>
					<td>操作：</td>
					<td>
						<a href="member_do.php?dopost=memberlogin&id=<?php echo $row['mid'];?>&jumpurl=../user/edit_baseinfo.php" target="_blank" class="btn btn-success btn-sm">修改资料</a>
						<a href="member_do.php?dopost=memberlogin&id=<?php echo $row['mid'];?>" target="_blank" class="btn btn-success btn-sm">会员面板</a>
					</td>
				</tr>
				<tr>
					<td bgcolor="#f5f5f5" colspan="2" align="center">
						<button type="submit" name="Submit" class="btn btn-success btn-sm">保存</button>
						<button type="button" class="btn btn-outline-success btn-sm" onclick="javascript:history.go(-1);">返回</button>
					</td>
				</tr>
			</table>
		</form>
		<script>
			function checkSubmit()
			{
				if (document.form2.email.value=="") {
					document.form2.email.focus();
					ShowMsg("邮箱不能为空");
					return false;
				}
				if (document.form2.uname.value=="") {
					document.form2.uname.focus();
					ShowMsg("会员昵称不能为空");
					return false;
				}
			}
		</script>
	</body>
</html>