ASP programmers: a little help, please?

I’m trying add Recaptcha to the forms on my Web site to block the form spammers, and I found this pair of ASP scripts: challenge1.txt and challenge2.txt.

I’ve been able to get them to work for a single page, but the internal comments indicate that you should be able to use the same script pair to handle multiple pages. Not being an ASP maven, I haven’t been able to figure out the syntax to make it work.

Could someone show me examples of how to do multiple pages?

(I’ve e-mailed the original author, but haven’t heard back yet.)

Thanks.

What exactly do you mean by “multiple pages”?

Do you mean you want it on different forms on your Web site?

Yes. The comments refer to using the “sending_page” value to direct the script to different results pages, but I’m not clear how that has to be coded in either script.

Ok your forms are going to need a hidden field called sending_Page



<input type="hidden" name="sending_Page" value="1">


That value (1) would be different for each form. Best to use 1, 2, 3 etc.

Then, see this line on challenge2.asp?



' If sending_Page=1 then response.redirect "where the correct url goes.asp"


Get rid of the ’ and make a copy of that line for each results page. For instance…



If sending_Page=1 then response.redirect "EmailContactThankYou.asp"
If sending_Page=2 then response.redirect "MailingListThankYou.asp"
If sending_Page=3 then response.redirect "CustomerSurveyThankYou.asp"


So, the form with the hidden send_Page value of 1 will end up at the EmailContactThankYou.asp page, the form with the value of 2 will end up at MailingListThankYou.asp and the form with the value of 3 will end up at CustomerSurveyThankYou.asp.

Got it? Let me know if I need to be more clear.

Thanks, ZipperJJ

That’s kind of what I was thinking, and I tried something like that (I don’t have my versions in front of me right now), but it didn’t work. I’ll have a chance to try it out tomorrow, and will let you know.

Where in each script should these lines go?

I looked a little harder at the scripts, and looked on your site and I see the problem.

This line, on challenge1:



<input type="hidden" name="sending_page" value="<%=Request.querystring("sending_page")%>">


Is expecting that you have a querystring for the page that is showing the form. So for example, it is expecting subscribe.asp?sending_page=1

If you make all of your links to subscribe.asp have that query, then it will pass the 1 to the form and the form will pass the 1 to challenge2 and then challenge2 will redirect the user to the page you specified on line 28 of challenge2.

The code I gave you, the If/Then stuff, should all go on line 28 (well, 28, 29, 30, etc) of challenge2. You’ll also need to change the links to every page you want to use the challenge to have their own query, sending_page=# (each with a different number).

This is kind of a crap way to do a captcha…you’re not really protecting the form if you’re just using a captcha to get to the form. Anyone can bypass that. If you want, PM me and you can send me your pages and I will help you sort it out. It’s too much to explain here without boring our friends to tears.

Thanks. Check your PM.