| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 564 人关注过本帖
标题:网站防注册机
只看楼主 加入收藏
zhanyong
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-12-7
结帖率:0
收藏
已结贴  问题点数:10 回复次数:2 
网站防注册机
网站被群发了。加了中文验证码也没用,总是被注册一些不相关的垃圾公司的信息。听说要加个判断,哪位大侠会吗?以下是提交页面。具体要怎么加?望大侠们赐教。万分感谢。以下是代码:
<%
dim UserName,Password,PwdConfirm,Question,Answer,usersf,Comane,kind,province,city,Somane,Sex,Phone,mobile,Fox,add,Zip,checkimg,Email,qq,HomePage
UserName=trim(request("UserName"))
Password=trim(request("Password"))
PwdConfirm=trim(request("PwdConfirm"))
Question=trim(request("Question"))
Answer=trim(request("Answer"))
usersf=request("usersf")
Comane=trim(request("Comane"))
kind=trim(request("kind"))
province=trim(request("province"))
city=trim(request("city"))
Somane=trim(request("Somane"))
Sex=trim(Request("Sex"))
Phone=trim(request("Phone"))
mobile=trim(request("mobile"))
Fox=trim(request("Fox"))
add=trim(request("add"))
Zip=trim(request("Zip"))
Email=trim(request("Email"))
qq=trim(request("qq"))
HomePage=trim(request("HomePage"))
checkimg=trim(request("checkimg"))


if UserName="" then
        founderr=true
        errmsg=errmsg & "<li>请输入用户名(不能大于14小于4)</li>"
               
else
    if strLength(UserName)>14 or strLength(UserName)<4 then
        founderr=true
        errmsg=errmsg & "<br><li>用户名不能小于4大于14</li>"
        end if
  
          if Instr(UserName,"=")>0 or Instr(UserName,"%")>0 or Instr(UserName,chr(32))>0 or Instr(UserName,"?")>0 or Instr(UserName,"&")>0 or Instr(UserName,";")>0 or Instr(UserName,",")>0 or Instr(UserName,"'")>0 or Instr(UserName,",")>0 or Instr(UserName,chr(34))>0 or Instr(UserName,chr(9))>0 or Instr(UserName,"?")>0 or Instr(UserName,"$")>0 then
                errmsg=errmsg+"<br><li>用户名中含有非法字符</li>"
                founderr=true
        end if
end if
if Password="" or strLength(Password)>12 or strLength(Password)<6 then
        founderr=true
        errmsg=errmsg & "<br><li>请输入密码(不能大于12小于6)</li>"
else
        if Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"?")>0 or Instr(Password,"$")>0 then
                errmsg=errmsg+"<br><li>密码中含有非法字符</li>"
                founderr=true
        end if
end if
if PwdConfirm="" then
        founderr=true
        errmsg=errmsg & "<br><li>请输入确认密码(不能大于12小于6)</li>"
else
        if Password<>PwdConfirm then
                founderr=true
                errmsg=errmsg & "<br><li>密码和确认密码不一致</li>"
        end if
end if
if Question="" then
        founderr=true
        errmsg=errmsg & "<br><li>密码提示问题不能为空</li>"
end if
if Answer="" then
        founderr=true
        errmsg=errmsg & "<br><li>密码答案不能为空</li>"
end if

if userSf="公司" then
    if comane=""then
    founderr=true
    errmsg=errmsg & "<br><li>公司名称不能为空</li>"
        end if
        
        if instr(Comane,"公司")=0 then
    founderr=true
    errmsg=errmsg & "<br><li>您的公司名称并非公司的正式名称或不完整</li>"
        end if
'判断是不是化妆品相关行业
    if instr(Comane,"化妆品")=0 and instr(Comane,"精细化工")=0 and instr(Comane,"生物科技")=0 and instr(Comane,"美容")=0  and instr(Comane,"集团")=0 and instr(Comane,"国际")=0 and instr(Comane,"有限公司")=0 and instr(Comane,"药业")=0 and instr(Comane,"实业")=0  and instr(Comane,"日化")=0 and instr(Comane,"经贸")=0 then
'如果还不能阻止群发软件注册,就不提示了,直接终止程序。        
        founderr=true
    errmsg=errmsg & "<br><li>非化妆品相关行业的公司,本站不接受注册</li>"
    end if
'结束
end if

if Sex="" then
        founderr=true
        errmsg=errmsg & "<br><li>性别不能为空</li>"
else
        sex=cint(sex)
        if Sex<>0 and Sex<>1 then
                Sex=1
        end if
end if
if Email="" then
        founderr=true
        errmsg=errmsg & "<br><li>Email不能为空</li>"
else
        if IsValidEmail(Email)=false then
                errmsg=errmsg & "<br><li>您的Email有错误</li>"
                   founderr=true
        end if
end if
if Somane="" then
        founderr=true
        errmsg=errmsg & "<br><li>联系人不能为空</li>"
        end if
if add=""then
founderr=true
errmsg=errmsg &"<br><li>联系地址不能为空</li>"
end if

if Phone="" then
        founderr=true
        errmsg=errmsg & "<br><li>联系电话不能为空</li>"
end if

if checkimg<>Session("word_") then
        founderr=true
        errmsg=errmsg & "<br><li>验证码错误,请重新填写。</li>"

else
if founderr=false then
'判断是不是重复注册信息
'*******************************************
    dim sqlReg,rsReg  
    set rsReg=server.createobject("adodb.recordset")
        sqlReg="select * from [user] where comane like '%"&comane&"%' and province='"&province&"' and Phone='"&Phone&"'"
        rsReg.open sqlReg,conn,1,1
    if not rsReg.eof then
    response.write "<script lanage='javascript'>alert('请不要重复注册用户!');</script>"
    response.Write"<script lanage='javascript'>location.replace('index.asp')</script>"   
        rsReg.close
        set rsReg=nothing
        response.end()
        else
        rsReg.close'如果不重复要关闭对象,因为下面的打开对象和这个相同,不关会出错。
    end if
'结束********************************************

        sqlReg="select * from [User] where UserName='" & Username & "'"        
        rsReg.open sqlReg,conn,1,3
        if not(rsReg.bof and rsReg.eof) then
                founderr=true
                errmsg=errmsg & "<br><li>您注册的用户已经存在!请换一个用户名再试试!</li>"
        else        
                rsReg.addnew
                rsReg("UserName")=UserName
                rsReg("Password")=md5(Password)
                rsReg("passwordtrue")=Password
                rsReg("Question")=Question
                rsReg("Answer")=md5(Answer)
                rsReg("usersf")=usersf
                rsReg("Comane")=Comane
                rsReg("kind")=kind
                rsReg("province")=province
                rsReg("city")=city
                rsReg("Somane")=Somane
                rsReg("Sex")=Sex
                rsReg("Phone")=Phone
                rsReg("mobile")=mobile
                rsReg("Fox")=Fox
                rsReg("Add")=add
                rsReg("Zip")=Zip
                rsReg("Email")=Email
                rsReg("qq")=qq
                rsReg("HomePage")=HomePage
                rsReg.update
                rsReg.close
                '以下是在USERSETTING表中增加新用户名记录
                sqlsetting="select * from usersetting"        
            rsReg.open sqlsetting,conn,1,3
                rsReg.addnew
                rsReg("UserName")=UserName
                rsReg.update
                '结束               
                founderr=false        
        end if
        rsReg.close
        set rsReg=nothing
end if        
end if
end if
%>
<html>
<head>
<title></title>
<link href="user_style.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="777" border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td>
      <%
if founderr=false then
       call Back()
        
    else
           call WriteErrmsg()
end if
%>
    </td>
  </tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing

sub WriteErrMsg()
    response.write "<table width='300' align='center' border='0' cellpadding='5' cellspacing='0' class='border'>"
    response.write "<tr class='admintitle'><td align='center' height='25'><b>由于以下的原因,您未能成功注册本站用户!</b></td></tr>"
    response.write "<tr><td align='left' height='100'>" & errmsg & "<p align='center'>【<a href='javascript:history.back()'>返 回</a>】<br></p></td></tr>"
        response.write "</table>"
end sub


sub Back()
    response.write "<table width='300' align='center' border='0' cellpadding='5' cellspacing='0' class='border'>"
    response.write "<tr class='admintitle'><td align='center' height='25'><b>注册成功,欢迎您!</b></td></tr>"
    response.write "<tr><td align='left' height='100'>" & errmsg & "<p align='center'>【<a href='index.asp'>请返回首页登陆</a>】<br></p></td></tr>"
        response.write "</table>"
end sub
   



sub sendmail()
'+++++++++++++++++++++++++++++
'            
'+++++++++++++++++++++++++++++

'用来发送邮件的SMTP服务器
mailserver="smtp.

'如果服务器需要SMTP身份验证则:
'登录用户名
mailserverloginname="1121358081"
'登录密码
mailserverloginpass="qdwcel"
'域名(如果你用“[email]name@[/email]”这样的用户名登录时,请指明
mailuserdomain="1121358081@

'+++++++++++++++++++++++++++++

                '=============== 发 信 ================
                dim JMail
                set JMail=server.CreateObject("Jmail.message")

                fromname=sitename
        frommail="1121358081@
                toname=Somane
        tomail=Email
                mailtitle="成功注册"&sitename&"会员通知"
                mailbody= "<table width='100%'><tr><td style='font-size:14px;line-height:25px'>亲爱的"&Somane & ":<br>    您好!<br>欢迎您注册成为<a href='"&siteUrl&"' target='_blank'>"&sitename&"</a>会员,你的用户名:"&username&" 密码:"&password&" 请妥善保管。"
        mailbody= mailbody&"感谢您对本站的支持!<br><br><br><br>------------------------------<br><a href='"&siteUrl&"' target='_blank'><img src='"&siteUrl&"/"&LogoUrl&"' border='0'></a></td></tr></table>"

        JMail.Silent=true
                JMail.Charset = "gb2312"
                JMail.ContentType = "text/html"
        JMail.FromName = fromname
        JMail.from = frommail
        JMail.AddRecipient tomail,toname
                JMail.Subject = mailtitle
        jmail.Body=mailbody

        JMail.MailServerUserName = mailserverloginname
        JMail.MailServerPassWord = mailserverloginpass
        JMail.MailDomain = mailuserdomain
        sendok=JMail.send(mailserver)
                Set Jmail=nothing
                if sendok then
                response.Redirect "userReg_success.asp?username="&username&"&sendmail=ok"
                else
        response.Redirect "userReg_success.asp?username="&username
                response.end()               
                end if
end sub
%>
搜索更多相关主题的帖子: 注册机 
2010-12-07 14:55
hams
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:18
帖 子:912
专家分:3670
注 册:2008-7-30
收藏
得分:5 
具体问题具体分析,主动权掌握在你手里,只要思路对了,没有解决不了的。

俺不高手,俺也是来学习的。
俺的意见不一定就对,当你不认同时请点忽视按钮。
当走到十字路口不知该如何走时,可在论坛问下路,但你若希望别人能一路把你送到目的地,显然是不现实的,因为别人也有自己要走的路。
2010-12-07 17:19
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:5 
禁止外部提交数据,可能会解决你的问题!或注册成功后将Session("word_")=""

QQ:63572063
2010-12-08 21:32
快速回复:网站防注册机
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017540 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved