?? member.php
字號:
$condition .= $locked>-1 ? " and m.locked='$locked'" : "";
$condition .= $email ? " and m.email='$email'" : "";
$condition .= $truename ? " and i.truename='$truename'" : "";
$condition .= $province ? " and i.province='$province'" : "";
$condition .= $qq ? " and i.qq='$qq'" : "";
$condition .= $msn ? " and i.msn='$msn'" : "";
$condition .= $icq ? " and i.icq='$icq'" : "";
$condition .= $skype ? " and i.skype='$skype'" : "";
$condition .= $industry ? " and i.industry='$industry'" : "";
$condition .= $edulevel ? " and i.edulevel='$edulevel'" : "";
$condition .= $income ? " and i.income='$income'" : "";
$condition .= $occupation ? " and i.occupation='$occupation'" : "";
$condition .= $frommoney ? " and m.money>=$frommoney" : "";
$condition .= $tomoney ? " and m.money<=$tomoney" : "";
$condition .= $frompayment ? " and m.payment>=$frompayment" : "";
$condition .= $topayment ? " and m.payment<=$topayment" : "";
$condition .= $frompoint ? " and m.point>=$frompoint" : "";
$condition .= $topoint ? " and m.point<=$topoint" : "";
$condition .= $fromcredit ? " and m.credit>=$fromcredit" : "";
$condition .= $tocredit ? " and m.credit<=$tocredit" : "";
$condition .= $city ? " and i.city like '%$city%'" : "";
$condition .= $homepage ? " and i.homepage like '%$homepage%'" : "";
$condition .= $address ? " and i.address like '%$address%'" : "";
$r = $db->get_one("select count(*) as num from ".TABLE_MEMBER." m,".TABLE_MEMBERINFO." i where m.userid=i.userid and m.groupid>3 $condition");
$number=$r["num"];
$pages = phppages($number,$page,$_PHPCMS['pagesize']);
$result=$db->query("SELECT m.* FROM ".TABLE_MEMBER." m,".TABLE_MEMBERINFO." i WHERE m.userid=i.userid and m.groupid>3 $condition order by m.userid desc limit $offset,$_PHPCMS[pagesize]");
while($r=$db->fetch_array($result)){
$r[groupname] = $groups[$r[groupid]][groupname];
$r[lastlogintime] = $r[lastlogintime] ? date("Y-m-d H:i:s",$r[lastlogintime]) : '';
if($r[enddate]=="0000-00-00")
{
$r[validdatenum] = "<font color='blue'>無限期</font>";
}
else
{
$r[validdatenum] = $date->get_diff($r[enddate],date("Y-m-d"));
$r[validdatenum] = $r[validdatenum] <= 0 ? "<font color='red'>".$r[validdatenum]."</font>天" : $r[validdatenum];
}
$r[locked] = $r[locked] ? "<font color='red'>鎖定</font>" : "正常";
$members[]=$r;
}
$groupids = showgroup("select","groupid",$groupid);
$result = $db->query("SELECT province FROM ".TABLE_PROVINCE." WHERE country='中華人民共和國' ORDER BY provinceid");
while($r = $db->fetch_array($result))
{
$provinces[] = $r['province'];
}
$groups = array();
$result = $db->query("SELECT groupid,groupname FROM ".TABLE_USERGROUP." WHERE groupid>3 ORDER BY groupid");
while($r = $db->fetch_array($result))
{
$groups[$r['groupid']] = $r['groupname'];
}
include admintpl('member_manage');
break;
case 'view':
require PHPCMS_ROOT."/class/ip.php";
$getip = new IpLocation;
$r=$db->get_one("SELECT * FROM ".TABLE_MEMBER." m, ".TABLE_MEMBERINFO." i WHERE m.userid=i.userid AND m.userid=$userid");
@extract($r);
@extract($groups[$groupid],EXTR_SKIP);
$regiparea = $getip->getlocation($regip);
$regiparea = $regip ? " - ".$regiparea['country'] : "";
$lastloginiparea = $getip->getlocation($regip);
$lastloginiparea = $lastloginip ? " - ".$lastloginiparea['country'] : "";
$chargetype = $chargetype==1 ? "有效期" : "扣點數";
$enableaddalways = $enableaddalways==1 ? "<font color='red'>是</font>" : "否";
$gender = $gender==1 ? "男" : "女";
$regtime = $regtime ? date("Y-m-d H:i:s",$regtime) : "";
$lastlogintime = $lastlogintime ? date("Y-m-d H:i:s",$lastlogintime) : '';
$begindate = $begindate > "0000-00-00" ? $begindate : "";
$enddate = $enddate > "0000-00-00" ? $enddate : "";
if($birthday > "0000-00-00")
{
$date->set_date($birthday);
$old = date("Y")-$date->get_year();
}
$locked = $locked ? "<font color='red'>已被鎖定</font>" : "正常";
include admintpl('member_view');
break;
case 'note':
if($save)
{
$db->query("UPDATE ".TABLE_MEMBER." SET note='$note' WHERE userid='$userid'");
showmessage('操作成功!',$PHP_REFERER);
}
else
{
$r=$db->get_one("SELECT username,note FROM ".TABLE_MEMBER." WHERE userid='$userid'");
@extract($r);
include admintpl('member_note');
}
break;
case 'password':
if($submit){
if(strlen($password)<6 || strlen($password)>32){
showmessage("密碼不能為空且不得少于6個字符或超過32個字符!請返回!");
}
$badwords=array("\\",'&',' ',"'",'"','/','*',',','<','>',"\r","\t","\n",'#');
foreach($badwords as $value){
if(strpos($password,$value)!==false){
showmessage('密碼中不得包含非法字符!請返回!');
}
}
if($password=="" || $oldpassword==""){
showmessage('請輸入密碼!請返回!',$referer);
}
$oldpassword=md5($oldpassword);
$query="select * from ".TABLE_MEMBER." where username='$_SESSION[phpcms_username]' and password='$oldpassword'";
$result=$db->query($query);
if($db->num_rows($result)==0){
showmessage('原密碼錯誤!',$referer);
}
$password=md5($password);
$query="update ".TABLE_MEMBER." set password='$password' where username='$_SESSION[phpcms_username]'";
$db->query($query);
if($db->affected_rows()>0){
showmessage('操作成功!',$referer);
}else{
showmessage('操作失敗!請返回!');
}
}else{
include admintpl('member_password');
}
break;
case 'pass':
if(empty($userid)){
showmessage('非法參數!請返回!');
}
$userids=is_array($userid) ? implode(',',$userid) : $userid;
$r=$db->get_one("select * from ".TABLE_USERGROUP." where groupid=4");
@extract($r);
$begindate = date("Y-m-d");
$date->dayadd($defaultvalidday);
$enddate = $defaultvalidday == -1 ? "0000-00-00" : $date->get_date();
$db->query("UPDATE ".TABLE_MEMBER." SET groupid=4,chargetype=$chargetype,point=$defaultpoint,begindate='$begindate',enddate='$enddate' WHERE userid IN ($userids)");
if($db->affected_rows()>0){
showmessage('操作成功!',$PHP_REFERER);
}else{
showmessage('操作失敗!請返回!');
}
break;
case 'passall':
$result=$db->query("select * from ".TABLE_USERGROUP." where groupid='$groupid'");
@extract($db->fetch_array($result));
$db->query("UPDATE ".TABLE_MEMBER." SET groupid=$groupid,chargetype=$chargetype,point=$defaultpoint,validdate=$defaultvaliddate,begindate=$timestamp WHERE groupid=3");
if($db->affected_rows()>0){
showmessage('操作成功!',$PHP_REFERER);
}else{
showmessage('操作失敗!請返回!');
}
break;
case 'lock':
if(empty($userid)){
showmessage('非法參數!請返回!');
}
$userids=is_array($userid) ? implode(',',$userid) : $userid;
$db->query("UPDATE ".TABLE_MEMBER." SET locked=$val WHERE userid IN ($userids)");
if($db->affected_rows()>0){
showmessage('操作成功!',$PHP_REFERER);
}else{
showmessage('操作失?。≌埛祷兀?#039;);
}
break;
case 'user_exists':
if(user_exists($username))
{
showmessage('該用戶名已經存在!');
}
else
{
showmessage('該用戶名不存在!');
}
break;
case 'delete':
if(empty($userid)){
showmessage('非法參數!請返回!');
}
$userids=is_array($userid) ? implode(',',$userid) : $userid;
$db->query("DELETE FROM ".TABLE_MEMBER." WHERE userid IN ($userids)");
if($db->affected_rows()>0){
showmessage('操作成功!',$referer);
}else{
showmessage('操作失敗!請返回!');
}
break;
case 'deleteallnopass':
$db->query("DELETE FROM ".TABLE_MEMBER." WHERE groupid=3");
if($db->affected_rows()>0){
showmessage('操作成功!',$referer);
}else{
showmessage('操作失?。≌埛祷?!');
}
break;
}
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -