<?php
!defined('ADMIN')&&die("<meta http-equiv='refresh' content=0;url='/'>");
if(ADMIN<2)Js_to("没有权限！",URL._1.D.L.D);
if(_3!='my'&&ADMIN<20)die(header("location:".URL._1.D._2.D.'my'.HZ));
FN("title","会员 / 专题管理");
global $z,$i,$title;
if($i['rank']>14&&_4=='s')die(header("location:".URL._1.D.'id'.HZ));
_F("top");
$id=N;
if(_3){
	$id=_3=='my'?UID:_3;
	$r=GL($z->R("user","id=$id"),4);
}
if(!$id){
	$r['rank']=1;
	$r['sex']=2;
}
?>

<tt id="tw"></tt>
<ul><dt></dt><dd></dd><tt></tt></ul>
<fieldset class="form">
<script type="text/javascript" src="system/js/py.js"></script>
<legend><h1><b><var><img src="system/img/left.gif" /></var><dfn><img src="system/img/right.gif" /></dfn></b>　<a href="<?php echo URL._1.D._2.D?>"><?php echo $title?></a></h1></legend>
<ul><tt></tt></ul>
<div class="fieldset sp"><big><samp<?php if($id===N)echo ' class="del"'?>>&#9682;</samp><span<?php if($id!=N)echo ' class="del"'?>>&#9681;</span><?php echo $id>0?"管理":"新增"?>会员/专题:<del></del></big>
<div class="hd">
<?php
if($id===N)echo '<script type="text/javascript">$(document).ready(function(){$(".hd").hide();})</script>';
?>

<tt></tt>
<ul <?php if(ADMIN>19)echo'class="del"'?>><dt>用户名:</dt>
<dd><li><dt><b><?php echo $id?$r['name']:'';?></b></dt></li></dd>
<tt></tt></ul>
<form action="" id="form" method="post" name="form">
<ul <?php if(ADMIN<20)echo'class="del"'?>>
<u style="float:right; width:1px; height:1px; overflow:hidden"><input type="password" name="p2" value=""><input type="text" name="name" value=""></u>
<dt>用户名:</dt>
<dd><li><input type="text" id="name" name="name" value="<?php echo $id?$r['name']:'';?>"<?php if(_3=='my')echo ' readonly '?>></li></dd>
<tt></tt></ul>
<?php
if(ADMIN>19){?>
<ul>
<dt>排列顺序:</dt>
<dd><li><input type="number" name="paixu" value="<?php echo $id?$r['paixu']:0;?>" class="w1"> 专题/会员排列顺序，大数优先，负数排后</li></dd>
</ul>
<ul><dt>注册时间:</dt><dd><p><?php echo $id&&$r['atime']?date('Y年m月d日 H:i:s',$r['atime']):'';?>　<b>注册ip:</b> <?php echo $id?$r['ip']:'';?></p></dd></ul>
<ul><dt>最近登录:</dt><dd><p><?php echo $id&&$r['btime']?date('Y年m月d日 H:i:s',$r['btime']):'';?>　<b>登录ip:</b> <?php echo $id?$r['loginip']:'';?>　<b>登录次数:</b> <i class="red"><?php echo $id?$r['logins']:0;?></i></p></dd></ul>
<ul><dt>权限:</dt>
<dd>
<select size="1" name="rank">
<?php
echo C(intval($r['rank']),'B');
?></select> 5级(<i class="red">金牌会员</i>)以上才有上传文件权限
</dd><tt></tt></ul>
<ul><dt>性别:</dt>
<dd>
<select name="sex">
<option value="0" <?php if($r['sex']==0)echo 'selected';?>> 女士 </option>
<option value="1" <?php if($r['sex']==1)echo 'selected';?>> 先生 </option>
<option value="2" <?php if($r['sex']==2)echo 'selected';?>> 保密 </option>
</select>
</dd>
<tt></tt></ul>
<ul><dt>角色:</dt>
<dd>
<select size="1" name="role">
<?php
echo C(intval($r['role']),'E');
?>
</select>
</dd>
<tt></tt></ul>
<?php
}
if(!_3)echo '<input type="hidden" name="html" value="'.T().'" />';
if($id){?>
<ul>
<dt>&nbsp;</dt><dd class="anniu3" onclick="$('.hide').toggle(222);$('b samp,b span').toggle();"><b><samp class="del">&#9682;</samp><span>&#9681;</span>　修改密码： 展开 / 关闭　</b></dd>
</ul>
<?php }?>
<div class="del"><input type="password" name="p1" value="" autocomplete="off"></div>
<ul<?php if($id)echo ' class="hide"';?>>
<dt><?php echo !$id?'':(ADMIN>19&&_3!='my'&&UID!=_3?'新':'当前')?>密码:</dt><p class="del"><input name="p1"></p>
<dd><li><input id="p1" type="password" name="p1" value="" autocomplete="off"></li></dd>
<tt></tt></ul>
<?php if(_3=='my'||_3==UID){?>
<ul class="hide">
<dt>新的密码:</dt>
<dd><li><input id="p2" type="password" name="p2" value=""></li></dd>
<tt></tt></ul>
<ul class="hide">
<dt>确认密码:</dt>
<dd><li><input id="p3" type="password" value=""></li></dd>
<tt></tt></ul>
<?php }?>

<ul>
<tt></tt>
<dt>列表长度:</dt>
<dd><li><input type="number" name="list" value="<?php echo $id?$r['list']:MK_ZT;?>" class="w1">单独定义专题/会员中心每页文章显示数量（不能大于1000）</li></dd>
<tt></tt></ul>
<ul>
<dt>姓名:</dt>
<dd><li><input type="text" name="lxr" value="<?php echo $id?$r['lxr']:'';?>" class="w4"></li></dd>
<tt></tt></ul>
<ul>
<dt>电话:</dt>
<dd><li><input type="text" name="phone" value="<?php echo $id?$r['phone']:'';?>" class="w4"></li></dd>
<tt></tt></ul>
<ul>
<dt>email:</dt><input type="hidden" name="email" value="">
<dd><li><input type="email" name="email" value="<?php echo $id?$r['email']:'';?>" class="w4"></li></dd>
<tt></tt></ul>
<ul><dt>跳转网址:</dt>
<dd><li><input type="text" name="gurl" class="w6" value="<?php echo $id?$r['gurl']:'';?>" <?php if(ADMIN<10)echo ' disabled="disabled" placeholder="10级以上用户才有权限填写"'?> ></li></dd>
<tt></tt></ul>
<ul>
<dt>正标题:</dt>
<dd><li><input type="text" id="h1" name="h1" value="<?php echo $id?$r['h1']:'';?>" class="w6"></li></dd>
<tt></tt></ul>
<ul>
<dt>SEO标题:</dt>
<dd><li><input type="text" id="title" name="title" value="<?php echo $id?$r['title']:'';?>" class="w6"></li></dd>
<tt></tt></ul>
<ul>
<dt>SEO关键词:</dt>
<dd><li><input type="text" id="keywords" name="keywords" value="<?php echo $id?$r['keywords']:'';?>" class="w6"></li></dd>
<tt></tt></ul>
<ul>
<dt>SEO说明:</dt>
<dd><li><textarea rows="3" id="description" name="description" class="w8"><?php echo $id?$r['description']:'';?></textarea></li></dd>
<tt></tt></ul>
<ul<?php if(ADMIN<5)echo' class="del"'?>>
<dt>精准广告:</dt>
<dd><li><textarea rows="3" name="ad" class="w8" placeholder="在我的文章页面正文下自动展示，支持HTML代码"><?php echo $id?$r['ad']:'';?></textarea></li></dd>
<tt></tt></ul>
<ul>
<dt>备注:</dt>
<dd><li><textarea rows="3" name="remark" class="w8" placeholder="备注信息，默认不在其它任何页面展示"><?php echo $id?$r['remark']:'';?></textarea></li></dd>
<tt></tt></ul>
<textarea id="con" name="about" class="del"><?php echo $id?$r['about']:'';?></textarea>
<input name="cgi" type="hidden" value="user" />
<ul>
<dt>缩略图:</dt>
<dd><li><input type="text" name="pic" id="pic" class="w5" value="<?php echo $id?$r['pic']:'';?>"><i class="anniu1" onclick="slt()">获取编辑器内上传的图片</i></li></dd>
<tt></tt></ul>
<div id="editor" class="del"></div>
<input id="www" type="hidden" value="http<?php echo _Z(0)?'s':''?>://<?php echo WWW?>" />
</form>
<ul>
<link href="system/css/edit.css" rel="stylesheet" type="text/css">
<textarea id="gy" class="del"><?php echo $id?$r['about']:'<p></p>';?></textarea>
<dt>详细介绍:</dt>
<div class="edit">
<script type="text/javascript">
var contT = My("gy").value;
<?php if(ADMIN<5){?>
var eN=1;
<?php }?>
var i_ml='<?php echo ML?>';
document.write('<'+'sc'+'ript language="javascript" src="system/js/edit.js" type="text/javascript"></'+'sc'+'ript>');
</script>
</div>
<tt></tt>
</ul>
<tt></tt>
<ul>
<big><input type="button" onclick="ps()" value="保 存 设 置"/></big>
</ul>
</div>
<ul><dt></dt><dd></dd><tt></tt></ul>
</div>
<ul><tt></tt></ul>
<?php if(ADMIN>19){ ?>
<div class="fieldset"><big><samp<?php if($id!=N)echo ' class="del"'?>>&#9682;</samp><span<?php if($id===N)echo ' class="del"'?>>&#9681;</span>（账号管理）:</big>
<div>
<tt></tt>
<main id="sozi">
<script>
function souzi(a){
	if(a) return window.location.href="<?php echo URL._1.D._2.D?>0/0/"+a+"/";
	var zi=document.getElementById("zi").value;
	if(/[_\/]/.test(zi)){
		tanchuang('错误！','搜索内容不能含有" _ \\ / "字符！');
	}else window.location.href="<?php echo URL._1.D._2.D?>0/0/a/"+encodeURI(zi)+"/";
}
</script>
<dd><input type="text" size="11" id="zi" onfocus="this.select()" value="<?php echo _6?_6:''?>">
<b onclick="souzi()">搜索</b></dd>
<dd>
<select onchange="souzi(this.value)">
<option value="a">==全部会员==</option>
<?php
$_2= trim(_2)==""?1:substr(urldecode(_2),0,99);
$_5=_5===F?'a':_5;
foreach(B() as $k=>$v){
	echo "<option value='{$k}' ".("$k"==="$_5"?'selected ':'').">{$k}-{$v}</option>\n";
}?>
</select>
<a href="<?php echo URL._1.D._2.'/0/0/b'.HZ?>"><b>权限降序</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/c'.HZ?>"><b>登录次数排序</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/d'.HZ?>"><b>按文章数量</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/e'.HZ?>"><b>后台新增会员</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/f'.HZ?>"><b>快速注册会员</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/g'.HZ?>"><b>正式注册会员</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/h'.HZ?>"><b>有跳转网址会员</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/i'.HZ?>"><b>有简介会员</b></a>
<a href="<?php echo URL._1.D._2.'/0/0/j'.HZ?>"><b>有广告会员</b></a>
</dd>
<p></p>
</main>
</div>
<div<?php if($id!=N)echo ' class="del"'?>>

<?php
$p = intval(_4)?intval(_4):1;
$d=20;
$a=($p-1)*$d;
$px='';
$tj='';
switch ($_5){
	case 'a':$px='id desc,';break;
	case 'b':$px='rank desc,';break;
	case 'c':$px='logins desc,';break;
	case 'd':$px='new desc,';break;
	case 'e':$tj.='checkmail=0';break;
	case 'f':$tj.='checkmail=1';break;
	case 'g':$tj.='checkmail=2';break;
	case 'h':$tj.="gurl<>''";break;
	case 'i':$tj.="about<>''";break;
	case 'j':$tj.="ad<>''";break;
	default:if(_5==='0'||_5>0)$tj.='rank='.intval(_5);break;
}
if($_6=_6)$tj.=($tj?' and ':'')." id LIKE '%".$_6."%' or name LIKE '%".$_6."%' or title LIKE '%".$_6."%' or phone LIKE '%".$_6."%' or email LIKE '%".$_6."%' or ip LIKE '%".$_6."%' or loginip LIKE '%".$_6."%'";
$s=$z->S("user",$tj);
$fenye = URL._1.D._2.D."0/";
$hz=D.$_5.D.$_6;
$m=ceil($s/$d);
$dir=S($p,$m,$s,$fenye,$hz);
foreach($z->A("user",$tj." order by $px id desc limit $a,$d") as $v){
	if($v['rank']<1)$c='red';
	elseif($v['rank']==1)$c='cheng';
	elseif($v['rank']==20)$c='lan';
	elseif($v['rank']>20)$c='zi';
	else $c='';
	$cz=$i['rank']<20?'':UID==$v['id']?($i['id']!=UID?'<a href="'.URL._1.D._2.D.UID.D.'s'.HZ.'" class="red"><img src="system/img/lnk.png" />恢复原态</a>':''):'<a href="'.URL._1.D.'s/user/3/'.$v['id'].HZ.'"><img src="system/img/icondel.gif" />禁止登录</a>　<a href="'.URL._1.D._2.D.$v['id'].D.'s'.HZ.'"><img src="system/img/lnk.png" />无密码登录</a>';
	echo '<tt></tt><h5>　<i class="lan">'.$v['id'].'.</i>　<a class=lv>'.date('Y-m-d H:i:s',$v['atime']).'</a>　<a class=c33>'.$v['ip'].'</a>　<a href="'.URL.'u'.E.urlencode($v['name']).'" target="_blank"  class="'.$c.'"><img src="system/img/link.png" />'.$v['name'].'</a>　<a class=hui>[ '.$v['email'].' ]</a>　<a href="'.URL._1.D.'wz/1/0/0/i'.D.$v['id'].HZ.'"><img src="system/img/article_1.png" />（'.$v['new'].'篇）</a>　<a href="'.URL._1.'/'._2.'/'.$v['id'].HZ.'"><img src="system/img/iconedit.gif" />修改资料</a>　'.$cz.'</h5>';
}
?>
<dir><?php echo $dir.' <span>（共'.$s.'条）</span>'?></dir>
<ul><tt></tt></ul>
</div></div>
<?PHP }?>
</fieldset>
<?php
_F("end");