I'm trying to add some type of anti spam to my contact page. At least several times a week I get some bogus submission that is filled with junk. I have the anti spam mod on my register.asp page but I can't figure out how to add it to my contact page.
Thanks carefree for looking at this so quickly! The numbers do show up but they do not really do anything. You can leave it blank and the form will still send. There is also no error message if the number is missing or incorrect. This is the error message from the mod. I've tried inserting it but it doesn't work for me.
'###########################
'#### Antispam Error Start
RandCode = Request.Form("reg_code")
strRCCode = Request.Form("regid")
RandCode2 = (strRCCode + 17456) / 50000
lenCode = Len(RandCode2)
NullStop = False
If LenCode < 6 and Nullstop = False then
For J = 1 to (6 - LenCode)
NullRC = NullRC & "0"
Next
NullStop = True
End If
RandCode2 = NullRC & RandCode2
If RandCode <> RandCode2 then
Err_Msg = Err_Msg & "<li>The registration code you have enterd is not correct!</li>"
End If
'#### Antispam Error End
'########################
In the code you've supplied, I've tried inserting the above at line 75. That is where the other error messages are located for the other fields of the form.
Thanks carefree for looking at this so quickly! The numbers do show up but they do not really do anything. You can leave it blank and the form will still send. There is also no error message if the number is missing or incorrect.
Try using my code by itself - your code is intact within it. The error message if the number is missing or incorrect is at lines 49-51. If the number is blank or incorrect, it will not send.
That cannot be my coding - the numbers aren't random anymore. Post a link to that page in .txt format and I'll see what's up.
Here's a small change to the randomization routine - vastly decreases chances of repetition in series.... Either use the code in my next reply (when I attempted to put both sets of code in here, the second wasn't included in a scrollcode box) or replace everything in my code above between the first and last lines (in red) below so it looks like this:
HowManyNbr=6
strCode=""
for kk = 1 to HowManyNbr
strCode=strCode+"8"
next
strCd=""
for kk = 1 to len(strCode)
strCd=strCd+"1"
next
kl=Int(strCode)
l=Int(strCd)
strCode = ""
Randomize
j=int(rnd * kl) + l
strCode=cStr(j)
For i = 1 to HowManyNbr
strjint=strImageURL+mid(strCode,i,1)+".gif"
Response.Write "<img src=""" & strjint & """ border=""0"" alt=""PicCode"">"& vbNewLine
I found your problem. The URL for the action of the form is still sending it to your "pop_contact_admin.asp" - but you renamed the file to "contacttest2.asp". That's why it isn't acting on the code.
To test it as "contacttest2.asp", go to line 222 and change it from:
A possible minor issue. If you view the source of the page the anti spam number images are clearly listed. In the register.asp page, the number gif's are not automatically identifiable. Is there a way to make them less obvious on the contact page?