asp classic - .asp honeypot for contact form -
i'm caught in hard place being forced use asp classic on web forms. don't want spammed, unaware of how create honeypot .asp classic.
is possible or have use captcha field?
or there better way prevent spam asp classic?
form fields:
<div class="row"> <div class="col-md-offset-1 col-md-10"> <form class="form-horizontal" role="form" method="post" action="submit.asp"> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <input type="text" class="form-control" name="name" placeholder="name" required/> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <input type="email" class="form-control" name="email" placeholder="email" required/> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <input type="tel" class="form-control" name="phone" placeholder="phone number"> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <input type="text" class="form-control" name="subject" placeholder="subject"> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <textarea name="info" class="form-control" rows="3" placeholder="message"></textarea> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <button class="btn btn-theme btn-lg btn-block"type="submit" value="send">send message</button> </div> </div> </form> <% dim emailfrom dim emailto dim subject dim name dim phone dim email dim questions emailfrom = "name@company.com" emailto = "chad.bridges@company.com" subject = trim(request.form("subject")) name = trim(request.form("name")) phone = trim(request.form("phone")) email = trim(request.form("email")) questions = trim(request.form("info")) dim body body = body & "name: " & vbcrlf body = body & name & vbcrlf body = body & "subject: " & vbcrlf body = body & subject & vbcrlf body = body & "phone: " & vbcrlf body = body & phone & vbcrlf body = body & "email: " & vbcrlf body = body & email & vbcrlf body = body & "questions: " & vbcrlf body = body & questions & vbcrlf dim objsendmail set objsendmail = createobject("cdo.message") objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="10.000.00.000" objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 00 objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 objsendmail.configuration.fields.update objsendmail.to = "chad.bridges@company.com" objsendmail.subject = "website request" objsendmail.from = emailfrom objsendmail.textbody = body objsendmail.send set objsendmail = nothing response.redirect("index.html#contact") %>
i have had luck using 3 types of spam prevention on every submit page sign in , sign pages. because asp kind of old might want keep simple , use numeric values checks 1 hidden spam bot field. keep human approach. note: code pieces of active site, take ideas , creative site.
- email forms: hidden field, math question , captcha.
- registration page: math question , captcha.
- login (sign in): math question.
1. hidden field
<input type="hidden" name="email" value="" /> maybe code looks this:
response.write("<input type=""hidden"" name=""email"" value="""" />" & vbcrlf) 2. numeric question: requires simple function , job. want randomize numbers 1 9 no answer ever higher 18 , never 0.
str1r = randomnumber(1,9) str2r = randomnumber(1,9) session("str3") = (str1 + str2) function randomnumber(lownumber, highnumber) randomize randomnumber = round((highnumber - lownumber + 1) * rnd + lownumber) end function html might like:
<label>question: <%=str1r%> + <%=str2r%> ?</label> <div> <div> <input type="number" name="question" id="question" required /> <input type="hidden" name="a" id="a" value="1" /> </div> </div> stra = request.form("a") strquestion = left(request.form("question"),2) if isnumeric(strquestion) 'do notta else strquestion = -1 end if if isnumeric(session("str3r")) session("str3r") = trim(session("str3r")) else session("str3r") = 0 end if strmath = ((session("str3r") - strquestion) = 0) 'now have true or false if (strmath = true) 'do asp classic stuff. select case stra case 1 'sends email case 2 'submits registration end select end if 3. captcha mean checkcaptcha() function not "i can't ever seem read" i've used numeric values captcha 16 years , had 2 complaints, when tried more complex versions many couldn't see letters , numbers clearly. (asp = old + members)
google: dim newbitmap(21,87) dim vdistort(8) in number 1 slot of google results should full asp classic numeric captcha code. it's old, it's numbers, works. don't think modern bots detect old bitstream. (humor)
if need working examples ask, takes bit setup test page if you're new forms , need spam prevention it's best learn more 1 method. @ "false" point of form submissions should know if it's human or bot.
i stop code on bot traffic response.end
with humans response instructions , might have gone wrong "the math question, missed x much"
the math question can replaced image "what in picture?" using dog,apple, cat, limited possible responses.
Comments
Post a Comment