⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 register.php

📁 有一些论坛有特殊需要
💻 PHP
字号:
<?php
$wind_in='rg';
$ifecho = array
(
	'rg_info1' =>'<!--',
	'rg_info2' =>'-->',
	'rg_detail1' =>'<!--',
	'rg_detail2' =>'-->',
	'rg_rg1' =>'<!--',
	'rg_rg2' =>'-->'
);



require_once("./global.php");
include_once(R_P."data/bbscache/dbreg.php");


if($vip=='jihuo'){
	$u_db=$db->get_one("SELECT yz FROM pw_members WHERE uid='$r_uid'");
	if($u_db){
		if($pwd==$u_db['yz']){//利用时间戳验证
			$db->update("UPDATE pw_members SET yz=1 WHERE uid='$r_uid'");
			Showmsg("完成激活密码,您的帐号已经激活,谢谢您的支持");
		} else{
			Showmsg("激活失败,错误原因:您的验证参数有误!");
		}
	} else{
		Showmsg("激活失败,错误原因:您的用户名不存在");
	}
}

if($rg_allowregister==0){
	Showmsg("对不起,目前论坛禁止新用户注册,请返回。。");
}

if($rg_allowsameip==Y){
	if(file_exists(R_P.'data/bbscache/ip_cache.php')){
		$ipdata=readover(R_P.'data/bbscache/ip_cache.php');
		if(strpos($ipdata,"<$onlineip>")!==false){
			Showmsg("24小时内只能注册一次,取消此限制.请到后台核心设置处管理");
		}
	}
}

if($groupid=='guest' && $step==2){
	$reg_check=1;
	if (strlen($regname)>$rg_regmaxname || strlen($regname)<$rg_regminname){
		$error="注册名长度错误,请控制在$rg_regminname 与 $rg_regmaxname 个汉字以内";
		$reg_check=0;
	}
	$S_key=array('|',' ',"'",'"','/','*',',','~',';','<','>','$',"\\","\r","\t","\n");
	foreach($S_key as $value){
		if (strpos($regname,$value)!==false)
		{ 
			$error="用户名包含不可接受字符或空格( $value )  请使用中英文和数字"; 
			$reg_check=0; 
		}
		if (strpos($regpwd,$value)!==false)
		{ 
			$error="密码包含不可接受字符或空格( $value )  请使用中英文和数字"; 
			$reg_check=0; 
		}
	}
	if(empty($rg_rglower)){
		for ($asc=65;$asc<=90;$asc++){ 
			//strtolower() 此函数在一些服务器会产生乱码!
			if (strpos($regname,chr($asc))!==false){
				$error="为了避免论坛用户名混乱,用户名中禁止使用大写字母,请使用小写字母"; 
				$reg_check=0; 
			} 
		}
	}
	$rg_name=Char_cv($regname);
	//$rg_name=trim($rg_name);

	$regpwd = Char_cv($regpwd);
	//$regpwd=trim($regpwd);
	$rg_pwd=md5($regpwd);
	$rg_homepage =	Char_cv($reghomepage);
	$rg_from	 =	Char_cv($regfrom);
	$rg_introduce=	Char_cv($regintroduce);
	if(strlen($rg_introduce)>500) Showmsg("自我简介不要超过 500 字节");
	if($regsign!=""){
		if(strlen($regsign)>200) Showmsg("签名不要超过 200 字节");
		require_once('./require/bbscode.php');
		$rg_sign	 =	Char_cv($regsign);
		$lxsign=convert($rg_sign,$db_windpic,2);
		if($lxsign==$rg_sign){
			$rg_ifconvert=1;
		} else{
			$rg_ifconvert=2;
		}
	} else{
		$rg_ifconvert=2;
	}
	if(@include_once(R_P."data/bbscache/wordsfb.php")){
		if($wordsfb){
			while (list($key,$value)=each($wordsfb)){
				if (strpos($rg_sign,$key) !== false){
					$error="<span class=bold>此签名可能有非法言论或是法轮功内容<br><br><font color=red size=5>反对黄色内容,打倒法轮功分子!<br><font color=green>我们鄙视您!</font></font></span>";
					$reg_check=0;
				}
				if (strpos($rg_introduce,$key) !== false){
					$error="<span class=bold>自我介绍可能有非法言论或是法轮功内容<br><br><font color=red size=5>反对黄色内容,打倒法轮功分子!<br><font color=green>我们鄙视您!</font></font></span>";
					$reg_check=0;
				}
			}
		}
	}
if (ereg ( "[0-9]", $rg_name))
      {$error="只能用中文注册用户名,请返回重新填写。";
      $reg_check=0;}
    if (ereg ( "[a-z]", $rg_name)) 
      {$error="只能用中文注册用户名,请返回重新填写。";
      $reg_check=0;}
    if (ereg ( "[A-Z]", $rg_name)) 
      {$error="只能用中文注册用户名,请返回重新填写。";
      $reg_check=0;}
    if (ereg ( "[?|~|!|@|#|$|%|^|&|*|,|.|/]", $rg_name)) 
      {$error="只能用中文注册用户名,请返回重新填写。";
      $reg_check=0;}
    if (ereg ( "[`|'|-|<|>|:|\|+|=]", $rg_name)) 
      {$error="只能用中文注册用户名,请返回重新填写。";
      $reg_check=0;}
	if (strpos($rg_name,"|")!==false || strpos($rg_name,'.')!==false || strpos($rg_name,' ')!==false || strpos($rg_name,"'")!==false || strpos($rg_name,'/')!==false || strpos($rg_name,'*')!==false || strpos($rg_name,";")!==false || strpos($rg_name,",")!==false || strpos($rg_name,"<")!==false || strpos($rg_name,">")!==false) {
		$error="用户名包含不可接受字符,请使用中文英文和数字";
		$reg_check=0;
	}
	if (strpos($regpwd,"\r")!==false || strpos($regpwd,"\t")!==false || strpos($regpwd,"|")!==false || strpos($regpwd,"<")!==false || strpos($regpwd,">")!==false) {
		$error="密码包含不可接受字符,请使用英文和数字"; 
		$reg_check=0;
	}
	if (empty($regemail)) {
		$error="信箱没有填写,请填写";
		$reg_check=0;
	}
	if (!ereg("^[-a-zA-Z0-9_\.]+\@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,5}$",$regemail)) {
		$error="信箱不符合检查标准,请确认没有错误"; 
		$reg_check=0;
	} else{
		$rg_email=$regemail;
	}
	$rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_members WHERE username='$rg_name'");
	if($rs['count']>0) {
		$error="该用户名已经被注册了,请返回重新填写。"; 
		$reg_check=0;
	}
	/*
	if($rg_regdbemail==0){
		$rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_members WHERE email='$regemail'");
		if($rs['count']>0) {
			$error="该 Email 地址已经被注册了,请返回重新填写。"; 
			$reg_check=0;
		}
	}
	*/
	if(strpos($rg_banname,$rg_name)!==false || $rg_name=='guest') {
		$error="此用户名被管理员禁止,请更改或向管理员咨询"; 
		$reg_check=0; 
	}
	$ban_count=count($banname);
	for($i=0;$i<$ban_count;$i++){
		if (strpos($rg_name,$banname)!==false){
			$error="您注册的用户名违反了网络安全法公安网络系统已记录您的IP<br>警告您一次,如果发现再次发现您将负法律责任"; 
			$reg_check=0;
			break; 
		}
	}
	$rg_sex=$regsex ? $regsex : "none";
	$rg_birth= (!$regbirthyear||!$regbirthmonth||!$regbirthday)?'':$regbirthyear."-".$regbirthmonth."-".$regbirthday;
	$rg_oicq=($regoicq ? $regoicq :'');
	$rg_homepage=$reghomepage ? $reghomepage :''; 
	$rg_from=$regfrom ? $regfrom : '';
	
	if ($regoicq && !ereg("^[0-9]{5,}$",$regoicq)) {
		$error="OICQ号码不正确";
		$reg_check=0;
	}
//如果 reg_check 等于1 注册
	if ($reg_check==1){
		if($rg_ifcheck=='1'){
			$rg_groupid='7';//后台控制是否需要验证
		} else{
			$rg_groupid='-1';
		}
		require_once (R_P.'data/bbscache/level.php');
		asort($lneed);
		$rg_memberid=key($lneed);

		$rg_yz=$rg_emailcheck==1 ? $timestamp : 1;
		$rg_ifemail=$_POST['regifemail'];
		$rg_emailtoall=$_POST['regemailtoall'];
		$db->update("INSERT INTO pw_members (username, password, email,publicmail,groupid,memberid, icon, gender, regdate, signature, introduce, oicq, icq, site, location, postnum, rvrc, money, lastvisit, thisvisit, bday, receivemail, yz, onlineip,signchange)
		VALUES ('$rg_name', '$rg_pwd', '$rg_email', '$rg_emailtoall', '$rg_groupid','$rg_memberid', '$regicon', '$rg_sex', '$timestamp', '$rg_sign', '$rg_introduce', '$rg_oicq', '$rg_icq', '$rg_homepage', '$rg_from','0', '$rg_regrvrc', '$rg_regmoney', '$timestamp', '$timestamp', '$rg_birth', '$rg_ifemail', '$rg_yz', '$onlineip', '$rg_ifconvert')");
		$winduid=$db->insert_id();

		$db->update("UPDATE pw_bbsinfo SET newmember='$rg_name',totalmember=totalmember+1 WHERE id='1'");
		$windid=$rg_name;
		$windpwd=$rg_pwd;
		$iptime=$timestamp+86400;
		if($rg_allowsameip==Y){
			if(file_exists(R_P.'data/bbscache/ip_cache.php')){
				writeover(R_P.'data/bbscache/ip_cache.php',"<$onlineip>","ab");
			}else{
				writeover(R_P.'data/bbscache/ip_cache.php',"<?die;?><$onlineip>");
			}
		}
		//Cookie("ifregip",$onlineip,$iptime);
		if(!$rg_emailcheck){
			Cookie("windpwd",$windpwd,$cookietime);
			Cookie("winduid",$winduid,$cookietime);
			Cookie('lastvisit','',0);//将$lastvist清空以将刚注册的会员加入今日到访会员中
		}
		//addonlinefile();
		//发送邮件
		if($rg_regsendemail==1 || $rg_emailcheck==1){

			$title=$rg_name." 您好,感谢您注册$db_bbsname";
			$emailmsg=$rg_name.",您好!\n\n";
			$emailmsg.=$db_bbsname."欢迎您的到来!\n"; 
			if($rg_emailcheck==1){
				$emailmsg.="首先您得激活您的用户名(点击下行网址激活,如果用户名是中文请复制下行网址激活)\n";
				$emailmsg.="{$db_bbsurl}/register.php?vip=jihuo&r_uid=$winduid&pwd=$timestamp\n";
				$title="激活您在 {$db_bbsname} 会员帐号的必要步骤!"; 
			}
			$emailmsg.="您的注册名为:{$rg_name}\n您的密码为:{$regpwd}\n请尽快删除此邮件,以免别人偷看到您的密码\n\n如果忘了密码,可以到论坛写信请坛主重新设定\n请查看论坛各版的发贴规则,以免帖子被删除\n论坛地址:{$db_bbsurl}\n";

			if(@mail("$rg_email","$title","$emailmsg","From: $manager<".$db_ceoemail.">\nReply-To:$db_ceoemail\nX-Mailer: 论坛邮件快递")){
				$ifmail="我们已经发送了一封邮件到您的邮箱,请查收!";
			} else{
				$ifmail="偿试发送邮件失败,也许是空间禁用了mail()函数!";
			}
		}
		//发送结束
		//发送短消息
	
		if ($rg_regsendmsg){
			require_once('./require/msg.php');
			$rg_welcomemsg=str_replace('$rg_name',$rg_name,$rg_welcomemsg);
			$messageinfo=array($windid,'系统信息',"欢迎光临[{$db_bbsname}],祝您愉快!",$timestamp,$rg_welcomemsg,0);
			writenewmsg($messageinfo);
		}
		if($rg_emailcheck){
			showmsg('帐号还没有激活,请先到您注册的邮箱里激活帐号');
		} else{
			refreshto("./index.php",'恭喜您,完成论坛注册'.$ifmail.'现在可以开始使用您的会员权利了');
		}
	}
	if ($reg_check==0){
		Showmsg("注册出现错误:错误原因:<br><br>$error<br>");
	}
}
if ($groupid!='guest' && !$step){

	Showmsg("您已经是注册成员,请不要重复注册.");
}
if($rg_reg==0 &&!$wind){
	if ($groupid=='guest' && !$step){
		$ifecho[rg_info1]="";$ifecho[rg_info2]="";$ifecho[rg_detail1]="";$ifecho[rg_detail2]="";
		require_once("./header.php");	
		$regpermint=$rg_rgpermit;
		$msg_guide=headguide("注册");//做语言包时不用 headguide;
		require_once(PrintEot('register'));footer();
	}
} else{
	$wind=1;
}
if ($groupid=='guest' && !$step && $wind==1){
	if($rg_regdetail==1)  {$ifecho[rg_detail1]="";$ifecho[rg_detail2]="";}
	$ifecho[rg_rg1]="";$ifecho[rg_rg2]="";
	if($rg_emailcheck==1)$tpemailcheck='<font color=red>所有帐号需要EMAIL激活,请如实填写</font>';
	
	if(ereg("^http",$picpath)){
		$picpath=basename($picpath);//如果您将图片路径更名为其他服务器上的图片,请务必保持图片目录同名,否则出错不在程序bug 之内
		if(!file_exists($picpath))
			$imgpatherror="--图片路径发生错误,请到后台更正您的图片路径为与您论坛图片保存的目录";
	}
	
	$img=@opendir("$picpath/face");
	while ($imagearray=@readdir($img)){
		if ($imagearray!="." && $imagearray!=".." && $imagearray!="" && $imagearray!="none.gif"){
			$imgselect.="<option value='$imagearray'>$imagearray</option>";
		}
	}
	@closedir($img);

	require_once("./header.php");
	$msg_guide=headguide("注册");
	require_once(PrintEot('register'));footer();
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -