reg.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 219 行

ASP
219
字号
<!--#include file="inc/inc_syssite.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/inc_antispam.asp"-->
<!--#include file="inc/class_blog.asp"-->
<!-- #include file="API/Class_API.asp" -->
<%
If Is_ot_User=1 Then
	If Not IsObject(conn) Then link_database
	Response.Redirect(ot_regurl)
	Response.End()
End If
'response.Write(oblog.defaultGroup)
'response.End()

Dim Action, sReg, sKeepKey,G_P_Show
Action = Trim(Request("action"))

sKeepKey = Application(cache_name_user & "_RegKey")
If sKeepKey = "" Then
	Application(cache_name_user & "_RegKey") = GetDateCode(2) & RndPassword(12)
Else
	If DateDiff("n", DeDateCode(Left(sKeepKey, 12)), Now) > C_Spam_RegCodeTime Then
		Application(cache_name_user & "_RegKey") = GetDateCode(2) & RndPassword(12)
  End If
End If
Call CheckBase()
Select Case action
    Case "save"
        Call Save
	Case "checkssn"
		Call checkssn
	Case "protocol"
		Call protocol
    Case Else
        Call ShowRegForm
End Select
G_P_Show=oblog.readfile("oblogstyle/reg/","reg.html")
G_P_Show = Replace(G_P_Show, "$show_title$", oblog.CacheConfig(2) & "-新用户注册")
G_P_Show = Replace(G_P_Show, "$show_list$", sReg)
G_P_Show = replace(G_P_Show,"$footer$", oblog.site_bottom)
Response.Write G_P_Show

'进行基础检测
Sub CheckBase()		
    If oblog.CacheConfig(15) = 0 Then
       If oblog.CheckAdmin() = False Then
            oblog.adderrstr ("当前系统已关闭注册。")
            oblog.showerr
            Exit Sub
        End If
    End If
    If oblog.chkiplock() Then
        oblog.adderrstr ("对不起!你的IP已被锁定,不允许注册!")
        oblog.showerr
        Exit Sub
    End If
End Sub
'进行数据有效性服务端检测


'----------------------------------------------
Sub protocol()
	G_P_Show=oblog.readfile("oblogstyle/reg/","reg.html")
    G_P_Show = Replace(G_P_Show, "$show_list$", "当前位置:<a href='index.asp'>首页</a>→注册条款<hr />" & oblog.setup(9, 0))
	G_P_Show = replace(G_P_Show,"$footer$", oblog.site_bottom)
    response.Write G_P_Show
    response.End
End Sub

Sub ShowRegForm()
	Dim sUserType
	sUserType = "<select name=usertype id=usertype onBlur='out_usertype()' onChange='out_usertype()'>"
	sUserType=sUserType&oblog.show_class("user",0,0)
	sUserType=sUserType&"</select>"
	sReg=sReg&"<form name=oblogform method=post action=""reg.asp"">" &  vbcrlf
	sReg=sReg&"<div id='ob_reg'><div class='reg_content'><fieldset><legend>您的名称</legend>" &  vbcrlf
	If oblog.CacheConfig(17) = 1 Then
		sReg=sReg&"<ul> " &  vbcrlf
		sReg=sReg&"<li class='r_left'>邀请码:</li>" &  vbcrlf
		sReg=sReg&"<li class='r_right'><input name=obcode type=text size=36 maxlength=32>" &  vbcrlf
		sReg=sReg&"</li></ul>" &  vbcrlf
	End If
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_uname_img' /> 您的登录名:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'> <input name=username type=text id=uname size=15 maxlength=30 onfocus=""on_input('d_uname');"" onblur='out_uname();'>" &  vbcrlf
	sReg=sReg&"</li>" &  vbcrlf
	sReg=sReg&"<li class='r_msg'><div id='d_uname' class='d_default'></div></li>" &  vbcrlf
	sReg=sReg&"</ul>" &  vbcrlf
	If oblog.CacheConfig(4)<>"" And oblog.CacheConfig(5) = 1 Then
		sReg=sReg&"<ul> " &  vbcrlf
		sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_udomain_img' /> 域名:</li>"&vbcrlf
		sReg=sReg&"<li class='r_right'> <input name=domain type=text id=domain size=15 maxlength=30 onfocus=""on_input('d_udomain');"" onblur='out_udomain();'> <select name='user_domainroot' id='domainroot'>"&oblog.type_domainroot("") & "</select>" &  vbcrlf
		sReg=sReg&"</li>" &  vbcrlf
		sReg=sReg&"<li class='r_msg'><div id='d_udomain' class='d_default'></div></li>" &  vbcrlf
	Else
		sReg=sReg&"<input name=domain type=hidden id=domain size=15 maxlength=30><input type=hidden name='user_domainroot'>" &  vbcrlf
	End If
	sReg=sReg&"</ul><ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'> <span id='chkssn_stat'></span> </li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><input type='button' id='ssnbotton' onclick='checkssn();' value='查看用户名、域名是否可用'>" &  vbcrlf
	sReg=sReg&"</li>" &  vbcrlf
	sReg=sReg&"</ul>" &  vbcrlf
	sReg=sReg&"</fieldset></div>" &  vbcrlf
	sReg=sReg&"<div class='reg_content'><fieldset><legend>安全资料</legend><ul>" &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_upwd1_img' /> 输入登录密码:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><input name=password type=password id=upwd size=20 maxlength=12 onKeyUp='EvalPwdStrength(this.value);' onfocus=""on_input('d_upwd1');"" onblur='out_upwd1();'> "
	sReg=sReg&"<li class='r_msg'><div id='d_upwd1' class='d_default'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul><li class='r_left'></li><li class='r_right'><div id='pws' class='ob_pws'><div id='idSM1' class='ob_pws0'><span style='font-size:1px'>&nbsp;</span><span id='idSMT1' >弱</span></div><div id='idSM2' class='ob_pws0'  style='border-left:solid 1px #DEDEDE'><span style='font-size:1px'>&nbsp;</span><span id='idSMT2' >中</span></div><div id='idSM3' class='ob_pws0' style='border-left:solid 1px #DEDEDE'><span style='font-size:1px'>&nbsp;</span><span id='idSMT3' >强</span></div></div>"
	sReg=sReg&"</li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_upwd2_img' /> 登录密码确认:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><input name=repassword type=password id=repassword size=20 maxlength=12 onfocus=""on_input('d_upwd2');"" onblur='out_upwd2();'></li>" &  vbcrlf
	sReg=sReg&"<li class='r_msg'><div id='d_upwd2' class='d_default'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_question_img' /> 密码提示问题:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><select id='question' name='question' onBlur='out_question()' onChange='out_question()'><option selected value=''>--请您选择--</option><option value='我的宠物名字?'>我的宠物名字?</option><option value='我最好的朋友是谁?'>我最好的朋友是谁?</option><option value='我最喜爱的颜色?'>我最喜爱的颜色?</option><option value='我最喜爱的电影?'>我最喜爱的电影?</option><option value='我最喜爱的影星?'>我最喜爱的影星?</option><option value='我最喜爱的歌曲?'>我最喜爱的歌曲?</option><option value='我最喜爱的食物?'>我最喜爱的食物?</option><option value='我最大的爱好?'>我最大的爱好?</option><option value='我中学校名全称是什么?'>我中学校名全称是什么?</option><option value='我的座右铭是?'>我的座右铭是?</option><option value='我最喜欢的小说的名字?'>我最喜欢的小说的名字?</option><option value='我最喜欢的卡通人物名字?'>我最喜欢的卡通人物名字?</option><option value='我母亲/父亲的生日?'>我母亲/父亲的生日?</option><option value='我最欣赏的一位名人的名字?'>我最欣赏的一位名人的名字?</option><option value='我最喜欢的运动队全称?'>我最喜欢的运动队全称?</option><option value='我最喜欢的一句影视台词?'>我最喜欢的一句影视台词?</option></select></li>" &  vbcrlf
	sReg=sReg&"<li class='r_msg'><div id='d_question' class='d_default'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_an_img' /> 密码提示答案:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><input name=answer type=text id=answer size=30 maxlength=30  onfocus=""on_input('d_an');"" onblur='out_an();'>" &  vbcrlf
	sReg=sReg&"</li><li class='r_msg'><div id='d_an' class='d_default'></div></li></ul></fieldset></div>" &  vbcrlf
	sReg=sReg&"<div class='reg_content'><fieldset><legend>个人资料</legend><ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_email_img' /> 电子邮箱:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><input name=email id=email type=text size=30 maxlength=32 onfocus=""on_input('d_email');"" onblur='out_email();'></li>"
	sReg=sReg&"<li class='r_msg'><div id='d_email' class='d_email'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_city_img' /> 地区(省/市):</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'>"&show_city()  & "</li>" &vbcrlf
	sReg=sReg&"<li class='r_msg'><div id='d_city' class='d_city'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_blogname_img' /> Blog名称:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'><input name=blogname id=blogname type=text size=30 maxlength=30 onfocus=""on_input('d_blogname');"" onblur='out_blogname();'></li>" &  vbcrlf
	sReg=sReg&"<li class='r_msg'><div id='d_blogname' class='d_default'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_usertype_img' /> Blog类别:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'>"&sUserType&"</li>" &  vbcrlf
	sReg=sReg&"<li class='r_msg'><div id='d_usertype' class='d_default'></div></li></ul>" &  vbcrlf
	sReg=sReg&"<ul> " &  vbcrlf
	sReg=sReg&"<li class='r_left'><img src='images/li_none.gif' class='okimg' id='d_passregtext_img' /> 注册条款:</li>" &  vbcrlf
	sReg=sReg&"<li class='r_right'> <input name=passregtext id=passregtext type=radio value='1' checked onClick='out_passregtext();' >同意 <input type=radio name=passregtext id=passregtext1 value='0' onClick='out_passregtext();' >不同意 <a href='reg.asp?action=protocol' target='_blank'>查看注册条款</a></li>" &  vbcrlf
	sReg=sReg&"</li><li class='r_msg'><div id='d_passregtext' class='d_default'></div></li></ul>" &  vbcrlf
	If oblog.CacheConfig(16) = 1 Then
		sReg=sReg&"<ul> " &  vbcrlf
		sReg=sReg&"<li class='r_left'>验证码:</li>" &  vbcrlf
		sReg=sReg&"<li class='r_right'><input name=codestr id=codestr type=text size=6 maxlength=4> "&oblog.getcode&"</li>" &  vbcrlf
		sReg=sReg&"</ul>" &  vbcrlf
	End If
	sReg=sReg&"</fieldset></div><ul>" &  vbcrlf
	sReg=sReg&"<li class='r_left'><span id='save_stat'></span> </li><li><input type=button name=submit value=' OK!确认提交注册信息 ' onclick='chk_reg();' id='regbotton'></li>" &  vbcrlf
	sReg=sReg&"</ul>" &  vbcrlf
	sReg=sReg&"</div>" &  vbcrlf
	sReg=sReg&"</form>" &  vbcrlf
End Sub

Sub Save()
'	If oblog.ChkPost() = False Then
'        oblog.adderrstr ("系统不允许从外部提交!")
'    End If
    Dim rsreg, sql, ajax, buttonface, rearr
    Dim regusername, regpassword, sex, question, answer, email, reguserlevel, userispass, blogname, usertype, nickname
    Dim re_regpassword, user_domain, user_domainroot
	Dim chk_regname
	chk_regname=oblog.chk_regname(regusername)
	buttonface=2
    set ajax=new AjaxXml
    chk_regtime()
    If oblog.CacheConfig(16)=1 Then
        If Not oblog.codepass Then
			oblog.adderrstr ("验证码错误,请刷新后重新输入!")
			rearr=split(oblog.errstr&"$$1","$$")
			ajax.re(rearr)
			response.end
		end if
    End If
    If oblog.CacheConfig(17)=1 Then
    	if oblog.CheckOBCode(Request("obcode"),0)=false Then
    		oblog.adderrstr ("邀请码错误或已经被使用!")
    		rearr=split(oblog.errstr&"$$1","$$")
				ajax.re(rearr)
				response.end
			End If
		End If
    regusername = oblog.filt_badstr(Trim(request("username")))
    regpassword = trim(request("password"))
    re_regpassword = trim(request("repassword"))
    email = Trim(request("email"))
    question = Trim(request("question"))
    answer = Trim(request("answer"))
    blogname = Trim(request("blogname"))
    usertype = CLng(request("usertype"))
    user_domain = LCase(Trim(request("domain")))
    user_domainroot = Trim(request("user_domainroot"))
    If regusername = "" Or oblog.strLength(regusername) > 14 Or oblog.strLength(regusername) < 4 Then oblog.adderrstr ("用户名不能为空(不能大于14小于4)!")
	if chk_regname>0 then 
'		if chk_regname = 1 Then oblog.adderrstr("用户名不合规范,只能使用小写字母,数字及下划线!")
		if chk_regname = 2 Then oblog.adderrstr("用户名中含有系统不允许的字符!")
		if chk_regname = 3 Then oblog.adderrstr("用户名中含有系统保留注册的字符!")
		if chk_regname = 4 Then oblog.adderrstr("用户名中不允许全部为数字!")
	End If
	If oblog.CacheConfig(6) <> "1" Then 
		If oblog.chkdomain(regusername) = False Then oblog.adderrstr  ("用户名不合规范,只能使用小写字母,数字及下划线!")
	End if
    If oblog.CacheConfig(4) <>"" And oblog.CacheConfig(5) = 1 Then
        If user_domain = "" Or oblog.strLength(user_domain) > 14 Then oblog.adderrstr  ("域名不能为空(不能大于14个字符)!")
        If user_domain <> request("old_userdomain") And oblog.strLength(user_domain) < 4 Then oblog.adderrstr  ("域名不能小于4个字符!")
        If oblog.chk_regname(user_domain) Then oblog.adderrstr  ("此域名系统不允许注册!")
        If oblog.chk_badword(user_domain) > 0 Then oblog.adderrstr  ("域名中含有系统不允许的字符!")
        If oblog.chkdomain(user_domain) = False Then oblog.adderrstr  ("域名不合规范,只能使用小写字母,数字!")
        If user_domainroot = "" Then oblog.adderrstr  ("域名根不能为空!")
		If oblog.CheckDomainRoot(user_domainroot) = False Then oblog.adderrstr  ("域名根不合法!")
    End If
    If regpassword = "" Or oblog.strLength(regpassword) > 14 Or oblog.strLength(regpassword) < 4 Then oblog.adderrstr  ("密码不能为空(不能大于14小于4)!")
    If re_regpassword = "" Then oblog.adderrstr  ("重复密码不能为空!")
    If regpassword <> re_regpassword Then oblog.adderrstr  ("两次输入密码不同!")
    If question = "" Or oblog.strLength(question) > 50 Then oblog.adderrstr  ("找回密码提示问题不能为空(不能大于50)!")
    If answer = "" Or oblog.strLength(answer) > 50 Then oblog.adderrstr  ("找回密码问题答案不能为空(不能大于50)!")
    If blogname = "" Or oblog.strLength(blogname) > 50 Then oblog.adderrstr  ("blog名不能为空(不能大于50字符)!")
    If oblog.chk_badword(blogname) > 0 Then oblog.adderrstr  ("blog名中含有系统不允许的字符!")
    If InStr(regusername, "=") > 0 Or InStr(regusername, "%") > 0 Or InStr(regusername, Chr(32)) > 0 Or InStr(regusername, "?") > 0 Or InStr(regusername, "&") > 0 Or InStr(regusername, ";") > 0 Or InStr(regusername, ",") > 0 Or InStr(regusername, "'") > 0 Or InStr(regusername, ",") > 0 Or InStr(regusername, Chr(34)) > 0 Or InStr(regusername, Chr(9)) > 0 Or InStr(regusername, "

⌨️ 快捷键说明

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