Very simple anti-bot - Posted (1383 Views)
New Member
kyodai
Posts: 74
74
This is a very simply anti-bot modification but as it's quite custom it works against like 99% of all bots, even most dynamic ones.
The trick is just to add a "Are you a bot question" dropdown box in the registration page and make "YES" default, so even the dynamic bots stumble over it. I know there are better anti-bot mods available (Mikes seems to be awesome), but i was looking for a leightweight solution that doesnt produce much more traffic and SQL requests, so this is what i came up with.

here's how to implement it:


-----------------------------------------------------------


1. Open your inc_profile.asp and search for this block:
(Just search for <select name=""ReceiveEMail, as i deleted unnecessary spaces and tabs in my snitz)



Code:

if strMode = "Register" then
Response.Write "<td bgColor=""" & strPopUpTableColor & """ valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
"<select name=""ReceiveEMail"">" & vbNewLine & _
"<option value=""1"" selected>Yes</option>" & vbNewLine & _
"<option value=""0"">No</option>" & vbNewLine & _
"</select></font></td>" & vbNewLine


BELOW add the following:

Code:

'#############Kyodai bot check
Response.Write "<tr valign=""middle"">" & vbNewLine & _
"<td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" width=""10%"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Are you a bot: </font></b></td>" & vbNewLine
Response.Write "<td bgColor=""" & strPopUpTableColor & """ valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
"<select name=""IsBot"">" & vbNewLine & _
"<option value=""1"" selected>Yes</option>" & vbNewLine & _
"<option value=""5"">No</option>" & vbNewLine & _
"</select></font></td>" & vbNewLine
'##############Kyodai bot check



Open register.asp and search for the following block of code:
(Again just search for "UserName already in Use, Please Choose " as i got rid of unnecassary spaces and tabs)

Code:


Err_Msg = Err_Msg & "<li>UserName already in Use, Please Choose Another</li>"
end if

rs.close
set rs = nothing

AFTER add the following:


Code:

'##############Kyodai bot check
if Request.Form("IsBot") = "5" then
'nothing, everything fine
else
Response.write "<br><br>You have stated that you are a bot. However, bots may not register. Please check your info and try again.<br><br>"
response.end
end if
'##############Kyodai bot check



------------------------------------------------------------


That's it. No additional SQL queries and just a few more bytes on loading the register.asp due to the additional dropbox. I know it sounds to simple to be true but it really works against all bots so far on my forums. Maybe there's really intelligent dynamic page loading and parsing bots, but so far i haven't run into one.
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Advanced Member
Carefree
Posts: 4224
4224
1. Open your inc_profile.asp and search for this block:
(Just search for <select name=""ReceiveEMail, as i deleted unnecessary spaces and tabs in my snitz)



Code:

if strMode = "Register" then
Response.Write "<td bgColor=""" & strPopUpTableColor & """ valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
"<select name=""ReceiveEMail"">" & vbNewLine & _
"<option value=""1"" selected>Yes</option>" & vbNewLine & _
"<option value=""0"">No</option>" & vbNewLine & _
"</select></font></td>" & vbNewLine


BELOW add the following:

Code:

'#############Kyodai bot check
Response.Write "<tr valign=""middle"">" & vbNewLine & _
"<td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" width=""10%"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Are you a bot: </font></b></td>" & vbNewLine
Response.Write "<td bgColor=""" & strPopUpTableColor & """ valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
"<select name=""IsBot"">" & vbNewLine & _
"<option value=""1"" selected>Yes</option>" & vbNewLine & _
"<option value=""5"">No</option>" & vbNewLine & _
"</select></font></td>" & vbNewLine
'##############Kyodai bot check

Kyodai, you're opening a new row (see bit in red above) in the table (which subsequently isn't closed) before closing the previous one. Instead, I'd recommend this:

Code:

Look for the following lines (appx 101-110):

if strMode = "goModify" then
Response.Write " <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>Initial IP: </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""" & strIPLookup & ChkString(rs("M_IP"), "display") & """ target=""_blank"">" & ChkString(rs("M_IP"), "display") & "</a></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>Last IP: </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""" & strIPLookup & ChkString(rs("M_LAST_IP"), "display") & """ target=""_blank"">" & ChkString(rs("M_LAST_IP"), "display") & "</a></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if


Above those, insert the following:

Response.Write " <tr valign=""middle"">" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ align=""right"" valign=""middle"" width=""10%"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Are you a bot? </font></b></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <select name=""IsBot"">" & vbNewLine & _
" <option value=""1"" selected>Yes</option>" & vbNewLine & _
" <option value=""5"">No</option>" & vbNewLine & _
" </select></font></td>" & vbNewLine & _
" </tr>" & vbNewLine

Another recommendation that provides a back link that doesn't destroy data & closes bottom of page:

"register.asp"

Code:

Look for the following lines (appx 337-344:)

if rs.BOF and rs.EOF then
'## Do Nothing
else
Err_Msg = Err_Msg & "<li>UserName already in Use, Please Choose Another</li>"
end if

rs.close
set rs = nothing

Below those, insert the following:

if Request.Form("IsBot") <> "5" then
Response.Write "<br><br>You have stated that you are a bot. However, bots may not register. Please check your info and try again." & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back To Edit Data</a></font></p>" & vbNewLine
WriteFooter
Response.End
end if
Posted
New Member
kyodai
Posts: 74
74
Good call! Now that i look at it considering your comments i am surprised it even works the way i distributed it. Thanks for the improvement!!!
Posted
Advanced Member
Carefree
Posts: 4224
4224
You're welcome
 
You Must enter a message