Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Captcha into ASP mail form script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Zenfor
Junior Member

372 Posts

Posted - 02 April 2013 :  10:28:17  Show Profile  Reply with Quote
Hi,

I have a standard asp mail form script I have been using with a randomized number check yet I still get a lot of spam and nuisance emails. Does anyone know of a ready made script or where I can get a captcha routine that I can insert into my existing script? or does anyone have any ideas on how I can eliminate emails completed by bots?

Thanks!

Webbo
Average Member

United Kingdom
982 Posts

Posted - 02 April 2013 :  16:21:02  Show Profile  Visit Webbo's Homepage  Reply with Quote
Here you are: http://www.snitzbitz.com/mods/details.asp?Version=All&mid=230

Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 03 April 2013 :  07:34:06  Show Profile  Reply with Quote
Webbo, Zenfor wants "non-forum related" advice. CAPTCHA routines made to integrate into Snitz aren't the ideal solution.

That said, there are pros and cons for using CAPTCHA at all. Some advise NEVER to use them; but spam-bots will bury you if you don't. I cannot recommend any particular anti-spam routine from the information provided.

You could do something like this, you would have to edit the database path and put images titled "a"-"z" and "0"-"9" into an images folder. The database would require a table titled "CAPTCHA" with two fields (DTG) and (Captured), both of which set to varchar(16).

This method would write the CAPTCHA into the database set to the exact second of its creation (to preclude duplicates). When the user submits the form for validation, the CAPTCHA is deleted from the table.

"inc_captcha.asp"


<!DOCTYPE HTML>
<%
On Error Resume Next
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database.mdb")         				'	##	MS Access 2000 using virtual path
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Errors.Clear
Err.Clear
my_Conn.Open strConnString

Function doublenum(fNum)
	If fNum > 9 Then
		doublenum = fNum
	Else
		doublenum = "0" & fNum
	End If
End Function

If Request.Form("DTG") > "" Then
	strSql="SELECT * FROM CAPTCHA WHERE DTG='" & Request.Form("DTG") & "' AND CAPTURED='" & Request.Form("Captured") & "'"
	Set rsCheck=my_Conn.Execute(strSql)
	If not rsCheck.EOF Then
		'	CAPTCHA Matches, continue
		rsCheck.Close
		my_Conn.Execute("DELETE * FROM CAPTCHA WHERE DTG='" & Request.Form("DTG") & "' AND CAPTURED='" & Request.Form("Captured") & "'")
		Response.Write	"Correct ..."
		Response.End
	Else
		'	CAPTCHA Fails, do something here
		Response.Write	"CAPTCHA Failed<br /><br />"
		my_Conn.Execute("DELETE * FROM CAPTCHA WHERE DTG='" & Request.Form("DTG") & "'")
	End If
	Set rsCheck = Nothing
End If
strCap="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
intI=62
strCaptured=""
strCapture=""
Randomize
a=int(rnd*5)+3
For i = 1 to a
	Randomize
	j=int(rnd*intI)+1
	strA=uCase(mid(strCap,j,1))
	Response.Write	"<img src=""images/" & strA & ".png"" height=""24"" width=""24"">"
	strCapture=strCapture & cStr(j)
	strCaptured=strCaptured&strA
Next
Response.Write	"       "
strCaptured=strCaptured&" "
Randomize
a=int(rnd*5)+3
For i = 1 to a
	Randomize
	j=int(rnd*intI)+1
	strA=uCase(mid(strCap,j,1))
	Response.Write	"<img src=""images/" & strA & ".png"" height=""24"" width=""24"">"
	strCapture=strCapture & cStr(j)
	strCaptured=strCaptured&strA
Next
strDateNow = Year(Now())&DoubleNum(Month(Now()))&DoubleNum(Day(Now()))
strTimeNow = DoubleNum(Hour(Now()))&DoubleNum(Minute(Now()))&DoubleNum(Second(Now()))
strNow = strDateNow & strTimeNow
strSql="INSERT INTO CAPTCHA (DTG,CAPTURED) VALUES ('" & strNow & "', '" & strCaptured & "')"
my_Conn.Execute(strSql)

Response.Write	"<form action=""inc_captcha.asp"" method=""post"">" & vbNewLine & _
	"	<input type=""hidden"" name=""DTG"" value=""" & strNow & """>" & vbNewLine & _
	"	Enter the two images below:<br /><input type=""text"" name=""Captured"" size=""30"" maxlength=""17"" value="""">" & vbNewLine & _
	"	<input type=""submit"" name=""submit"">" & vbNewLine & _
	"</form>" & vbNewLine
%>

Edited by - Carefree on 03 April 2013 07:47:59
Go to Top of Page

Zenfor
Junior Member

372 Posts

Posted - 03 April 2013 :  15:28:34  Show Profile  Reply with Quote
Thanks for the replies. I'm glad I posted this here because it got me thinking, as a result, I think I solved it. I think they were bypassing the entry form and going right into the "processing of the form script". I put a check at the beginning of that now to verify the form random number. I won't know for sure unless I don't see them come in - my fingers are crossed... Thanks!
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 03 April 2013 :  17:45:17  Show Profile  Visit Webbo's Homepage  Reply with Quote
quote:
Originally posted by Carefree

Webbo, Zenfor wants "non-forum related" advice. CAPTCHA routines made to integrate into Snitz aren't the ideal solution......




Whoops, I never saw the forum title, just the post - my eyes bad lol
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000 Version 3.4.07