www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Reg.asp

    <!--#include file="include/conn.asp" -->
<!--#include file="include/char.asp" -->
<!--#include file="include/cb_main.asp" -->
<!--#include file="include/md5.asp" -->
<!--#include file="include/function.asp" -->
<%
If Caluoob.Com=true Then Response.Redirect "./"
If Caluoob.Isinstall(1)=1 Then Caluoob.ShowErr("很抱歉,目前系统禁止注册新用户。")
Dim Asp,nicknames,StrHtml,Password,Chkpwd,Email,myrs
Asp=Replace(Request.QueryString("asp"),"'","''")
nicknames=Replace(CheckStr(Request("name")),"'","''")
Password=Replace(CheckStr(Request.Form("password")),"'","''")
Chkpwd=Replace(CheckStr(Request.Form("chkpwd")),"'","''")
Email=Replace(CheckStr(Request.Form("email")),"'","''")

Select Case Asp
Case "reg"
	If Not Caluoob.ChkPost Then Response.end
	If email="" then Caluoob.ShowErr("邮件地址不能为空!")
	If IsValidEmail(email)=False then Caluoob.ShowErr("邮件地址格式不正确!")
	If nicknames="" then Caluoob.ShowErr("帐号不能为空!")
	If len(nicknames)<2 or len(nicknames)>10 then Caluoob.ShowErr("用户名长度应为2-10个字符!")
	If IsValidUserName(nicknames)=False then Caluoob.ShowErr("非法帐号,只能是数字或者字母,或者两者结合!")
	If 	Password="" or Chkpwd="" then Caluoob.ShowErr("密码不能为空!")
	If Password<>Chkpwd then Caluoob.ShowErr("请核对密码")
	If len(Password)<6 or len(Chkpwd)<6  then Caluoob.ShowErr("密码不能小于6位!")

	Set myrs = Caluoob.Execute("SELECT top 1 nicknames,emails from [cb_user] where nicknames='"&nicknames&"' or emails='"&email&"'")
	if not(myrs.eof or myrs.bof) then
	   Caluoob.ShowErr("很遗憾,该昵称或邮箱已经存在的,请更换再试!")
	else
	   Caluoob.Execute("insert into [cb_user] (nicknames,passwords,emails,mywebmode) values('"&nicknames&"','"&md5(Password)&"','"&Email&"',1)")
	   Caluoob.Execute("update [cb_system] set newuser='"&nicknames&"',alluser=alluser+1 where id=1")
	   Application(CachesName&"loadSystem")=False
	   Response.Redirect "?asp=ok"
	end if
	myrs.close:set myrs=nothing

Case "ok"
	Caluoob.OtherHerder Caluoob.SystemName&" | 注册成功"
	StrHtml=Caluoob.Loadskins("other_table.txt")
	StrHtml=Replace(StrHtml,"$table_content","<div class=""sysmsg""> 恭喜您!注册成功,请使用您的注册信息登陆! </div><meta http-equiv=""refresh"" content=""3; url=login.asp"">")
	Response.Write StrHtml
	Caluoob.Footer
	Response.Flush()
	
Case else
	Caluoob.OtherHerder Caluoob.SystemName&" | 注册"
	StrHtml=Caluoob.Loadskins("reg_table.txt")
	StrHtml=Replace(StrHtml,"$table_name","注册")
	StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("reg.txt"))
	Response.Write StrHtml
	Caluoob.Footer
	Response.Flush()
End Select
%>