www.gusucode.com > 易心博客[圣诞版] 3.5手动安装码程序 > UserReg.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="conn.asp"--> <!--#include file="Ex_Cls/Ex_SkinCls.asp"--> <!--#include file="Ex_Cls/Ex_SplitPageCls.asp"--> <% Dim ExComm Set ExComm=new Ex_CommonCls ExComm.GetConfigCache("runmode,ShowName,CmtPageSize,IsCheckCode,cmtmsgcheckre,iscmtmsgcheck,LogNum,blogname,BlogDescription,BlogKeyWord,IndexAddWord,blogurl,logourl,DefaultSkin") ExComm.CheckInstall ExComm.IsIpAllow Dim Title,Show_logids,show_blogKeyword '*********************************************** '输出注册表单 '*********************************************** function show_reg dim str str="" str=str& "<form id=""form1"" name=""form1"" method=""post"" action=""?action=add"">" str=str& "<table width=""98%"" border=""0"">" str=str& " <tr>" str=str& " <td colspan=""2""><div align=""center""><strong>用户注册</strong></div></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td width=""40%""><div align=""right"">用户名:</div></td>" str=str& " <td style=""text-align:left""><label>" str=str& " <input name=""username"" type=""text"" id=""username"" />" str=str& " <font color=red>*</font></label></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">密 码:</div></td>" str=str& " <td style=""text-align:left""><label>" str=str& " <input name=""userpwd"" type=""password"" id=""userpwd"" />" str=str& " <font color=red>*</font></label></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">密码确认:</div></td>" str=str& " <td style=""text-align:left""><label>" str=str& " <input name=""userpwd1"" type=""password"" id=""userpwd1"" />" str=str& " <font color=red>*</font></label></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">电子信箱:</div></td>" str=str& " <td style=""text-align:left""><label>" str=str& " <input name=""email"" type=""text"" id=""email"" />" str=str& " <font color=red>*</font> <font color=red>忘记密码时,用于取回密码" str=str& "</span></label></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">个人主页:</div></td>" str=str& " <td style=""text-align:left""><input name=""homepage"" type=""text"" id=""homepage"" /></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">QQ:</div></td>" str=str& " <td style=""text-align:left""><input name=""QQ"" type=""text"" id=""QQ"" /></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">性别:</div></td>" str=str& " <td style=""text-align:left""><label>" str=str& " <input type=""radio"" name=""sex"" value=""男"" checked/>" str=str& " 男 " str=str& " <input type=""radio"" name=""sex"" value=""女"" />" str=str& " 女 " str=str& " <input type=""radio"" name=""sex"" value=""保密"" />" str=str& " 保密</label></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">密码提示问题:</div></td>" str=str& " <td style=""text-align:left""><input name=""question"" type=""text"" id=""question"" /></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">密码提示答案:</div></td>" str=str& " <td style=""text-align:left""><input name=""answer"" type=""text"" id=""answer"" /></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">注册条款:</div></td>" str=str& " <td style=""text-align:left""><label>" str=str& " <input type=""radio"" name=""protocol"" value=""yes"" />" str=str& " 同意 " str=str& " <input type=""radio"" name=""protocol"" value=""no"" />" str=str& " 不同意 <a href=""userEditinfo.asp?action=protocol"">查看注册条款</a> </label></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td><div align=""right"">验证码:</div></td>" str=str& " <td style=""text-align:left""><input name=""checkcode"" type=""text"" id=""checkcode"" size=""15"" /><img src=""inc/checkcode.asp"" style=""cursor:hand"" onclick=""this.src='inc/checkcode.asp';"" alt=""看不清?点一下"" /></td>" str=str& " </tr>" str=str& " <tr>" str=str& " <td colspan=""2""><label>" str=str& " <div align=""center"">" str=str& " <input type=""submit"" name=""Submit"" value=""注册"" />" str=str& " <input type=""reset"" name=""Submit2"" value=""重置"" />" str=str& " </div>" str=str& " </label></td>" str=str& " </tr>" str=str& "</table>" str=str& " </form>" show_reg=str end Function '**************************************************** '检测用户名是否被占用 '参数 str----用户名 '**************************************************** sub checkname(ByVal str) dim rs str=ExComm.G(str) rs=Conn.execute ("select count(*) as num from Ex_user where username='"&trim(str)&"'") if rs("num")<>0 then response.Write("<script>alert('用户名已经被占用')</script>") response.Write("<script>history.go(-1)</script>") response.end end if End sub '************************************************* '填加注册用户信息 '************************************************* sub Add dim username,userpwd,userpwd1,sex,protocol,homepage,email,QQ,question,answer,checkcode,usersql Dim ExNow ExNow=ExComm.ExNow() protocol=request.Form("protocol") if protocol="yes" then checkcode=request.Form("checkcode") if session("excheckcode")<>checkcode Or Session("excheckcode")="" then ExComm.ShowMsg "验证码不正确","" end if username=ExComm.F(trim(request.Form("username"))) if trim(username)="" then ExComm.ShowMsg "用户名不能为空","" end If If InStr(Trim(username),"'")<>0 Then ExComm.ShowMsg "用户名中不能有单引号","" End If call checkname(username) userpwd=trim(request.Form("userpwd")) userpwd1=request.Form("userpwd1") if trim(userpwd)="" then ExComm.ShowMsg "密码不能为空","" end if if trim(userpwd)<>trim(userpwd1) then ExComm.ShowMsg "两次输入的密码不一致","" end If If InStr(Trim(userpwd),"'")<>0 Then ExComm.ShowMsg "密码中不能有单引号","" End If If Len(Trim(userpwd))>20 Then ExComm.ShowMsg "密码不能大于20位","" End If email=ExComm.F(request.Form("email")) if trim(email)="" then ExComm.ShowMsg "电子信箱不能为空","" end If If InStr(email,"@")=0 Then ExComm.ShowMsg "请填写正确的邮箱地址","" End If sex=ExComm.F(request.Form("sex")) homepage=ExComm.F(request.Form("homepage")) QQ=ExComm.F(request.Form("QQ")) question=ExComm.F(request.Form("question")) answer=ExComm.F(request.Form("answer")) UserSql="insert into Ex_User (username,userpwd,sex,homepage,email,qq,question,answer,lock,regtime) values('"&UserName&"','"&Md5(UserPwd)&"','"&sex&"','"&homepage&"','"&email&"','"&qq&"','"&question&"','"&answer&"',false,#"&ExNow&"#)" Conn.Execute UserSql ExComm.ShowMsg "注册成功,请先登陆。","index.asp" else ExComm.ShowMsg "只有同意注册条款后才能注册","" end if end sub if request.QueryString("action")="add" then Add end if '主模板标记替换开始 Dim ExSkin,Head,Body,Bottom,Skin1 Set ExSkin=new Ex_SkinCls Skin1=ExSkin.GetTxtSkin("default.html") Body=Replace(Skin1,"$show_log$",show_reg) Body=Replace(Body,"$show_info$",ExSkin.Info) Body=Replace(Body,"$show_login$",ExSkin.Login) Body=Replace(Body,"$show_calendar$",ExSkin.calendar("","","")) Set ExSkin=Nothing Bottom=ExComm.BottomInfo Title="用户注册" '输出内容 Head=Head&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&vbcrlf Head=Head&"<head>"&vbcrlf Head=Head&"<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">"&vbcrlf Head=Head&"<meta name=""generator"" content=""易心博客"">"&vbcrlf Head=Head&"<meta name=""Description"" content="""&Application(sn&"BlogDscription")&""">"&vbcrlf Head=Head&"<meta name=""Keywords"" content="""&Application(sn&"BlogKeyWord")&""">"&vbcrlf Head=Head&"<title>"&Title&Application(sn&"IndexAddWord")&"</title>"&vbcrlf Head=Head&"<script src=""inc/Main.js""></script>" Head=Head&"<script src=""inc/UserInfo.js""></script>" Head=Head&"<script src=""inc/jquery.js""></script>" Head=Head&"<link href=""inc/OblogSkin.Css"" rel=""stylesheet"" type=""text/css"" />"&vbcrlf Head=Head&"</head>"&vbcrlf Head=Head&"<body>"&vbcrlf If ExComm.IsOblogSkin Then Response.Write Head Response.Write Body Response.Write "</body></html>" Else Body=Replace(Body,"$show_blogtitle$",Title&Application(sn&"IndexAddWord")) Body=Replace(Body,"$show_blogkeyword$",Application(sn&"blogkeyword")) Body=Replace(Body,"$show_blogdescription$",Application(sn&"blogdescription")) Response.Write Body End If If request.querystring("action")="add" Then Call add() End if If Application(Sn&"Runmode")<>"静态" Then ExComm.visitorCount End If Set ExComm=Nothing %>