📄 user.php
字号:
if (query_first("SELECT userid FROM news_user WHERE username = '$name'")) { adminerror("用户存在","这个用户已经存在,你不能使用同一个用户名."); } $commentdefault++; $getdata = query("SELECT id,required FROM news_profilefield ORDER BY id"); while ($field = fetch_array($getdata)) { if (($customfield[$field[id]] == "") & ($field[required] == 1)) { adminerror("空白栏目","所有栏目必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } $custominsert .= ",'".$customfield[$field[id]]."'"; } query("INSERT INTO news_user VALUES (NULL,'$name','".md5($loginpassword)."','$email','".iif($hideemail,0,1)."','$homepage','$oicq','$aim','$yahoo','$signature','1','1','".time()."','0','$emailnotification','$commentdefault','$viewsigs','$allowpm','$emailpm','$isbanned')"); $newuserid = getlastinsert(); query("INSERT INTO news_userfield VALUES ('$newuserid'$custominsert)"); $name = stripslashes($name); eval("\$email_msg = \"".$email_msg."\";"); eval("\$email_subject = \"".$email_subject."\";"); mail($email,$email_subject,$email_msg,"来自: $sitename 发送人 <$webmasteremail>"); writeallpages(); if ($addstaff) { echoadminredirect("admin.php?action=staff_add&id=$newuserid"); } else { echoadminredirect("admin.php?action=user"); }break;case "user_edit": verifyid("news_user",$id,"userid"); $data_arr = query_first("SELECT news_user.username, news_user.email, news_user.homepage, news_user.oicq, news_user.aim, news_user.yahoo, news_user.signature, news_user.showemail, news_user.emailnotification, news_user.commentdefault, news_user.posts, news_user.viewsigs, news_user.allowpm, news_user.emailpm, news_user.isbanned, news_userfield.* FROM news_user LEFT JOIN news_userfield USING(userid) WHERE news_user.userid = $id"); echohtmlheader(); echoformheader("user_update","编辑用户"); updatehiddenvar("id",$id); echotabledescription("在这个站使用这页编辑用户."); echotabledescription(returnlinkcode("用户信箱","admin.php?action=user_email&id=$id")." |".returnlinkcode("查看私人短消息","admin.php?action=user_pmuserlist&id=$id")." |".returnlinkcode("删除所有私人短消息","admin.php?action=user_pm_delete&id=$id&all=1")." |".returnlinkcode("发送私人短消息","user.php?action=pm_new&touserid=$id",1)); echoinputcode("姓名:","name",$data_arr[username]); echoinputcode("密码:<br />Leave blank to keep the same","loginpassword"); echoinputcode("信箱地址:","email",$data_arr[email]); echoinputcode("主页:","homepage",$data_arr[homepage],40,1); echoinputcode("oicq:","oicq",$data_arr[oicq],40,1); echoinputcode("AOL:","aim",$data_arr[aim],40,1); echoinputcode("Yahoo:","yahoo",$data_arr[yahoo],40,1); echotextareacode("签名:","signature",$data_arr[signature],5,40,1); echoyesnocode("隐藏信箱:","hideemail",iif($data_arr[showemail],0,1)); echoyesnocode("信箱默认公开:","emailnotification",$data_arr[emailnotification]); echoyesnocode("评论默认显示:","commentdefault",$data_arr[commentdefault]-1,"All Shown","All Hidden"); echoyesnocode("查看用户签名:","viewsigs",$data_arr[viewsigs]); echoyesnocode("使用短信系统:","allowpm",$data_arr[allowpm]); echoyesnocode("信箱和新短消息:","emailpm",$data_arr[emailpm]); echoyesnocode("禁止:","isbanned",$data_arr[isbanned]); echoinputcode("发帖数:","posts",$data_arr[posts]); $getdata = query("SELECT id,title,description,required,maxlength,size,hidden FROM news_profilefield ORDER BY displayorder"); while ($field = fetch_array($getdata)) { echoinputcode($field[title].":","customfield[$field[id]]",$data_arr[field.$field[id]],$field[size],iif($field[required],0,1)); } echoformfooter(); echohtmlfooter();break;case "user_update": verifyid("news_user",$id,"userid"); if (($email == "") | ($emailnotification == "") | ($commentdefault == "") | ($hideemail == "") | ($name == "")) { adminerror("空白栏目","所有栏目必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } if ($isbanned & ($id == $userid)) { adminerror("不能禁止你自己","你不能在这个站禁止你自己."); } if ($requireuniqueemail) { if (query_first("SELECT userid FROM news_user WHERE (userid = $id) AND (email != '$email')")) { if (query_first("SELECT userid FROM news_user WHERE email = '$email'")) { adminerror("信箱存在","这个信箱地址已经存在,你不能使用同一个信箱"); } } } if ($temp = query_first("SELECT userid,username FROM news_user WHERE (userid = $id) AND (username != '$name')")) { if (query_first("SELECT userid FROM news_user WHERE username = '$name'")) { adminerror("用户存在","这个用户已经存在,你不能使用同一个用户名."); } query("UPDATE news_news SET lastcommentuser = '$name' WHERE lastcommentuser = '".mysql_escape_string($temp[username])."'"); } $getdata = query("SELECT id,required,maxlength FROM news_profilefield"); while ($field = fetch_array($getdata)) { if ($field[required] == 1) { if ($customfield[$field[id]] == "") { adminerror("空白栏目","所有栏目必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } } $customupdate .= iif($customupdate," , field$field[id] = '".$customfield[$field[id]]."'","field$field[id] = '".$customfield[$field[id]]."'"); } if ($customupdate) { query("UPDATE news_userfield SET $customupdate WHERE userid = $id"); } query("UPDATE news_user SET username = '$name', email = '$email',".iif($loginpassword != "","\n password = '".md5($loginpassword)."',","")." showemail = '".iif($hideemail,0,1)."', homepage = '$homepage', oicq = '$oicq', aim = '$aim', yahoo = '$yahoo', signature = '$signature', emailnotification = '$emailnotification', commentdefault = '$commentdefault', posts = '$posts', viewsigs = '$viewsigs', allowpm = '$allowpm', emailpm = '$emailpm', isbanned = '$isbanned' WHERE userid = $id"); if (($id == $userid) & ($loginpassword != "")) { updatecookie("userpassword",md5($loginpassword)); } writeallpages(); echoadminredirect("admin.php?action=user");break;case "user_delete": verifyid("news_user",$id,"userid"); if ($id == $userid) { adminerror("不能删除你自己","你不能在会员表删除你自己."); } echodeleteconfirm("用户","user_kill",$id," This will also remove them from the staff table if the user is already staff, and it will turn any comments made by this user into guest comments.".iif($userinfo[canmaintaindb]," If you would like to prune the comments by this user first please click".returnlinkcode("here","admin.php?action=maintain_user_c&id=$id")."."),iif(preg_match("/action=user_mod/i",$HTTP_REFERER),"&referer=mod"));break;case "user_kill": settype($id,"integer"); if ($temp = query_first("SELECT username,showemail,email FROM news_user WHERE userid = $id")) { if ($id == $userid) { adminerror("不能删除你自己","你不能在会员表删除你自己."); } } else { adminerror("无效ID","你指定了一个无效id."); } query("DELETE FROM news_user WHERE userid = $id"); query("DELETE FROM news_userfield WHERE userid = $id"); query("DELETE FROM news_staff WHERE userid = $id"); query("DELETE FROM news_pm WHERE ((touserid = $id) AND (folder = 1)) OR ((fromuserid = $id) AND (folder = 2))"); query("DELETE FROM news_activation WHERE userid = $id"); query("UPDATE news_comment SET username = '$user[username]' , useremail = '".iif($temp[showemail],$temp[email])."' , userid = '0' WHERE userid = $id"); writeallpages(); if (($referer == "mod") & query_first("SELECT userid FROM news_user WHERE moderated = 0")) { echoadminredirect("admin.php?action=user_mod"); } else { echoadminredirect("admin.php?action=user"); } exit;break;case "user_email": if (isset($id)) { settype($id,"integer"); $data_arr = query_first("SELECT username FROM news_user WHERE userid = $id"); if (!$data_arr) { adminerror("无效ID","你指定了一个无效id."); } } echohtmlheader(); echoformheader("user_doemail","用户信箱"); echotabledescription("你可以在这页发送电子邮件. 你在下面能输入你的信息并选择条件给你的朋友发送电子邮件, 如果你希望给每个搜索到的朋友发送电子邮件. 你在下面能输入你的信息并选择条件并按submit键 (内容空白将无效)."); if ($data_arr) { updatehiddenvar("id",$id); echotablerow("用户信箱:",htmlspecialchars($data_arr[username])); } echoinputcode("邮件标题:","email_subject"); echotextareacode("邮件消息:<br />You may use the variables \$user[userid] \$user[username] \$user[email] in your message to make each one user specific","email_msg","",10,50,0,40); if (!$data_arr) { echotablefooter(); echotableheader("搜索条件"); echoinputcode("会员:","name","",40,1,40); echoinputcode("信箱地址:","email","",40,1); echoinputcode("主页:","homepage","",40,1); echoinputcode("oicq:","oicq","",40,1); echoinputcode("AOL:","aim","",40,1); echoinputcode("Yahoo:","yahoo","",40,1); echoinputcode("帖子小于:","posts_max","",40,1); echoinputcode("帖子大于:","posts_min","",40,1); echoyesnocode("被禁止:","isbanned",0); } echoformfooter(); echohtmlfooter();break;case "user_doemail": if (($email_subject == "") | ($email_msg == "")) { adminerror("空白栏目","所有栏目必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } if (isset($id)) { verifyid("news_user",$id,"userid"); $sqlcondition = " WHERE userid = $id"; } else { if ($name != "") { $sql_arr[] = "(会员 LIKE '%$name%')"; } if ($email != "") { $sql_arr[] = "(信箱 LIKE '%$email%')"; } if ($homepage != "") { $sql_arr[] = "(主页 LIKE '%$homepage%')"; } if ($oicq != "") { $sql_arr[] = "(oicq LIKE '%$oicq%')"; } if ($aim != "") { $sql_arr[] = "(aim LIKE '%$aim%')"; } if ($yahoo != "") { $sql_arr[] = "(yahoo LIKE '%$yahoo%')"; } if ($posts_min != "") { $sql_arr[] = "(posts > ".intval($posts_min).")"; } if ($posts_max != "") { $sql_arr[] = "(posts < ".intval($posts_max).")"; } $sql_arr[] = " (news_user.isbanned = $isbanned)"; if ($sql_arr) { $sqlcondition = " WHERE ".join(" AND ",$sql_arr); } } echohtmlheader(); echotableheader("发送邮件",1); echo " <tr>\n <td>\n"; $getdata = query("SELECT userid,username,email FROM news_user$sqlcondition ORDER BY username"); $num_sent = countrows($getdata); $original_msg = $email_msg; while ($user = fetch_array($getdata)) { echo " 发送邮件到 $user[username].... ";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -