📄 reg.php
字号:
$showmsg .= $lang['strings16']. '|||';
}elseif($GLOBALS['width'] > $fsetting['userfacemaxsize'] || $GLOBALS['height'] > $fsetting['userfacemaxsize']){
$showmsg .= $lang['strings17']. '|||';
}else{
if ($fsetting['httpuserface'] == 0){
if (strpos(strtolower($GLOBALS['myface']),"http://") === true || strpos(strtolower($GLOBALS['myface']),"www.") === true){
$showmsg .= $lang['strings18']. '|||';
}
}
$face = $GLOBALS['myface'];
}
}elseif($GLOBALS['face'] != ''){
$face = $GLOBALS['face'];
}
$face = htmlspecialchars($face);
$face = str_replace("|","",$face);
if (!is_numeric($GLOBALS['oicq'])){
$GLOBALS['oicq'] = "";
}
if(is_array($character)) {
foreach($character as $val) {
$_character .= checkreal($val).',';
}
} else {
$_character = checkreal($character);
}
$userinfo = checkreal($GLOBALS['realname']). '|||' .$_character. '|||' .checkreal($GLOBALS['personal']). '|||' .checkreal($GLOBALS['country']). '|||' .checkreal($GLOBALS['province']). '|||' .checkreal($GLOBALS['city']). '|||' .checkreal($GLOBALS['shengxiao']). '|||' .checkreal($GLOBALS['blood']). '|||' .checkreal($GLOBALS['belief']). '|||' .checkreal($GLOBALS['occupation']). '|||' .checkreal($GLOBALS['marital']). '|||' .checkreal($GLOBALS['education']). '|||' .checkreal($GLOBALS['college']). '|||' .checkreal($GLOBALS['userphone']). '|||' .checkreal($GLOBALS['address']);
$usersetting = checkreal($GLOBALS['setuserinfo']). '|||' .checkreal($GLOBALS['setusertrue']). '|||' .$showre;
$userim = checkreal($GLOBALS['homepage']). '|||' .$GLOBALS['oicq']. '|||' .checkreal($GLOBALS['icq']). '|||' .checkreal($GLOBALS['msn']). '|||' .checkreal($GLOBALS['yahoo']). '|||' .checkreal($GLOBALS['aim']). '|||' .checkreal($GLOBALS['uc']);
$userim = htmlspecialchars($userim);
if ($showmsg != ''){
showmsg($showmsg);
}
$truepassword = Createpass(16);
$query=$db->query("Select usertitle,grouppic,usergroupid,issetting,parentgid From {$dv}usergroups Where parentgid=3 Order By minarticle Limit 1");
if ($groups =& $db->fetch_array($query)){
$userclass = $groups['usertitle'];
$titlepic = $groups['grouppic'];
$usergroupid = $groups['usergroupid'];
}else{
showmsg($lang['strings19']);
}
if ($fsetting['isnewuserlimited'] == 1){
$usergroupid = 5;
}
if ($GLOBALS['forum_passport'] != '' && $fsetting['maillimited'] == 1){
//$query=$db->query("Select userid From {$dv}user Where username='$username' Or useremail='$GLOBALS[e_mail]' Or passport='$GLOBALS[forum_passport]'");
$query=$db->query("(Select userid From {$dv}user Where username='$username') union all (Select userid From {$dv}user Where useremail='$GLOBALS[e_mail]') union all (Select userid From {$dv}user Where passport='$GLOBALS[forum_passport]')");
}elseif($GLOBALS['forum_passport'] != ''){
$query=$db->query("(Select userid From {$dv}user Where username='$username') union all (Select userid From {$dv}user Where passport='$GLOBALS[forum_passport]')");
}elseif($fsetting['maillimited'] == 1){
$query=$db->query("(Select userid From {$dv}user Where username='$username') union all (Select userid From {$dv}user Where useremail='$GLOBALS[e_mail]')");
}else{
$query=$db->query("Select userid From {$dv}user Where username='$username'");
}
if ($users =& $db->fetch_array($query, array('pageSize'=>1))){
if ($GLOBALS['forum_passport'] != '' && $fsetting['maillimited'] == 1){
showmsg($lang['strings20']);
}elseif($GLOBALS['forum_passport'] != ''){
showmsg($lang['strings21']);
}elseif($fsetting['maillimited'] == 1){
showmsg($lang['strings22']);
}else{
showmsg($lang['strings23']);
}
}
$userjointime = time();
$forum_user = explode(',',$fsetting['userpoint']);
$db->query("Insert Into {$dv}user (username,userpassword,useremail,userclass,titlepic,userquesion,useranswer,truepassword,userim,usersign,userpost,usertopic,usergroupid,lockuser,usersex,userbirthday,usergroup,joindate,userface,userwidth,userheight,usertoday,userlogins,lastlogin,userwealth,userep,usercp,userinfo,usersetting,userpower,userdel,userisbest,usermoney,userticket,userfav,ischallenge,userhidden,userlastip) Values ('$username','$password','$GLOBALS[e_mail]','$userclass','$titlepic','$GLOBALS[quesion]','$answer','$truepassword','$userim','$GLOBALS[signature]',0,0,'$usergroupid',0,'$sex','$GLOBALS[birthday]','$GLOBALS[usergroup]','$userjointime','$face','$GLOBALS[width]','$GLOBALS[height]','0|0|0|0|0',1,'$userjointime','$forum_user[0]','$forum_user[5]','$forum_user[10]','$userinfo','$usersetting',0,0,0,0,0,'$lang[strings24]',0,2,'$GLOBALS[usertrueip]')");
$query=$db->query("Select max(userid) From {$dv}user");
$users =& $db->fetch_array($query);
$userid = $users['max(userid)'];
//对上传头象进行过滤与改名
//Email通知密码
if ($fsetting['mailpassword'] == 1){
$fsetting['sendnewusermail'] = 1;
}
include_once CACHE_PATH.'mailconfig.php';
if ( $fsetting['sendnewusermail'] == 1 && $msetting['mailmod'] != 0 ){
$title = str_replace('{$forumname}',$fsetting['forumname'],$lang['tpl.str85']);
if ( $fsetting['mailpassword'] == 1 ){
$getpass = $spassword;
}else{
$getpass = $pass1;
}
$mailbody = $lang['tpl.str86'];
$mailbody = str_replace('{$username}',$username,$mailbody);
$mailbody = str_replace('{$password}',$getpass,$mailbody);
$mailbody = str_replace('{$copyright}',$fsetting['copyright'],$mailbody);
$mailbody = str_replace('{$version}','<a href="http://www.cndw.com" target=_blank>Dvbbs.Php '.$fsetting['forumversion'].'</a>',$mailbody);
include_once INC_PATH.'sendmail.php';
$issend = sendmail($GLOBALS['e_mail'],$title,$mailbody,"{$fsetting['forumname']} <{$fsetting['mastermail']}>");
if ( $issend == 1 ){
$sendmsg = $lang['strings27'];
}else{
$sendmsg = $lang['strings26'];
}
}else{
$sendmsg = $lang['strings25'];
}
//发送注册短消息
if ($fsetting['sendnewusermsg'] == 1){
$title = $lang['strings28'].$fsetting['forumname'];
$body = str_replace('{$forumname}',$fsetting['forumname'],$lang['strings29']);
$db->query("Insert Into {$dv}message (incept,sender,title,content,sendtime,flag,issend) Values ('$username','$fsetting[forumname]','$title','$body','".time()."',0,1)");
$query=$db->query("Select id From {$dv}message Order By id Desc Limit 1");
$message =& $db->fetch_array($query);
$usermsg = '1||' .$message['id']. '||' .$fsetting['forumname'];
$db->query("Update {$dv}user Set usermsg='$usermsg' Where userid='$userid'");
}
if ($fsetting['mailpassword'] == 0 && $fsetting['isnewuserlimited'] == 0){
$db->query("Delete From {$dv}online Where username='$GLOBALS[membername]' Or id='$GLOBALS[statuserid]'");
$cookiedate = $GLOBALS['usercookies'];
$joindate = gmdate('Y-m-d H:i:s');
set_cookie("userid",$userid,$cookiedate);
set_cookie("username",$username,$cookiedate);
set_cookie("password",$truepassword,$cookiedate);
set_cookie("userhidden",2,$cookiedate);
set_cookie("joindate",$joindate,$cookiedate);
}
set_cookie("regtime",$joindate,86400);
//Dedecms Api
$rcdata = SynchDedeCms($username,"reg",3600*24*15);
if($rcdata=="OK"){
if($GLOBALS['cfg_regJumpUrl']!=""){
$GLOBALS['goto'] = $GLOBALS['cfg_regJumpUrl'];
}
}
//----------------------------------------
//通行证部分
//更新缓存
$username = htmlspecialchars($username);
$db->query("UpDate {$dv}setup Set forum_usernum=forum_usernum+1,forum_lastuser='$username'");
require_once INC_PATH.'BoardCache.class.php';
$mycache =& new BoardCache($db);
$mycache->createForumSetting();
//成功信息
if ($GLOBALS['goto'] == ''){
$GLOBALS['goto'] = $fsetting['homepage'];
}
if ($sendmsg == ''){
$sendmsg = $lang['strings30'];
}else{
$sendmsg = $lang['strings30']. '|||' .$sendmsg;
}
$sendmsg = str_replace('{$forumname}',$fsetting['forumname'],$sendmsg);
$leftbar = isset($_COOKIE[$cookieprename.'setleftbar']) ? $_COOKIE[$cookieprename.'setleftbar'] : $fsetting['leftbar'];
if($leftbar) {
echo "<script language=\"JavaScript\">top.location.href=\"".$fsetting['homepage']."?targeturl=".urlencode($GLOBALS['goto'])."\"</script>";
exit;
}
showmsg($sendmsg,1,$GLOBALS['goto']);
//include_once printout('reg');
}
function IsTrueName($name){
global $fsetting, $lang;
//$name = trim($name);
if (1 == preg_match('/\s+/i', $name)) { // 用户名中不允许存在空白字符
return false;
}
$regsplitwords = trim($fsetting['regsplitwords']);
if ($regsplitwords !== '') {
$regsplitwords = preg_replace('#,(?=,)#i', '', $regsplitwords);
$len = strlen($regsplitwords);
($len > 1) AND (',' === $regsplitwords{$len - 1}) AND ($regsplitwords = substr($regsplitwords, 0, $len - 1));
$regsplitwords = str_replace(array(',', '/'), array('|', '\\/'), preg_quote($regsplitwords)).'|,';
if (1 == preg_match("/{$regsplitwords}/i", $name)) {
return false;
}
}
//if (1 == preg_match('/=|%|'.chr(32).'|\?|&|;|\||,|\'|'.chr(34).'|'.chr(9).'|'.preg_quote($lang['lang.str22']).'|\$/i',$name)) {
//if (1 == preg_match('/\x2f|\x5c|\x27|\x22|=|%|'.chr(32).'|\?|&|;|\||,|\'|'.chr(34).'|'.chr(9).'|'.preg_quote($lang['lang.str22']).'|\$/i',$name)) {
if (1 !== preg_match('/^(?:[-\w]|[\x80-\xff])+$/im', $name)) {
return false;
}
//简体编码的全角空白符\xa1\xa1 繁体编码的全角空白符\xa1\x40 utf-8编码的全角空白符\xe3\x80\x80
if (1 == preg_match('/\xa1\xa1|\xa1\x40|\xe3\x80\x80/i', $name)) {
return false;
}
$charscope = '\x'.strtoupper(dechex(10)).'-\x'.dechex(ord('A')-1).'\x'.dechex(ord('Z')+1).'-\x'.dechex(ord('a')-1).'-\x'.dechex(ord('z')+1).'\x'.dechex(ord('_')).'';
if (1 == preg_match('#^['.$charscope.']+$#i', $name)) {
return false;
}
return true;
}
function checkreal($str){
if (is_null($str)){return;}
$str = str_replace('|','',$str);
return $str;
}
//多项选取转换输出
function Chk_KidneyType($str0,$str1,$str2){
$str2 = explode(',',$str2);
$returnVal = array();
$count = count($str2);
for( $i = 0 ; $i < $count ; $i++ ){
$val = trim($str2[$i]);
$checked = ( strpos($str1,$val) !== false ? ' checked ' : '' );
$br = ( ($i+1) % 5 == 0 ? '<br>' : '' );
$returnVal[] = "<INPUT type=\"checkbox\" name=\"{$str0}[]\" value=\"{$val}\" {$checked} class=chkbox>{$val}{$br}";
}
if( empty($returnVal) ){
return '';
} else{
return implode('',$returnVal);
}
}//end function Chk_KidneyType
//下拉菜单转换输出
Function chk_select($str1,$str2){
$returnVal = array();
if( empty($str1) ){
$returnVal[] = '<option value="" selected>...</option>';
}
$str2 = explode(',',$str2);
if( !empty($str2) && is_array($str2) ){
foreach( $str2 as $val ){
$selected = ( $val == $str1 ? ' selected ' : '' );
$returnVal[] = "<option value=\"{$val}\" {$selected}>{$val}</option>";
}
}
if( empty($returnVal) ){
return '';
} else{
return implode('',$returnVal);
}
}//end function chk_select
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -