Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Add Captcha to shopmaillist.asp?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

go4gold
VP-CART New User

151 Posts

Posted - November 09 2009 :  14:42:30  Show Profile  Visit go4gold's Homepage  Reply with Quote
I have Captcha for my product reviews and Contact Us form but for some reason not for my mailing list. Can anyone tell me how to add Captcha to my shopmaillist.asp file please? I have a spamming issue now so any help would be much appreciated.

Thank you.

Go4Gold

creativechaos
VP-CART New User

Australia
64 Posts

Posted - November 10 2009 :  00:16:43  Show Profile  Visit creativechaos's Homepage  Reply with Quote
Hi,

There are a few modifications you need to make to your shopmaillist.asp file to implement this.

In the sub routine "DisplayMinimumForm" around line 231 locate:


CreateCustRow  getlang("LangCustEmail"), "strEmail", strEmail, "Yes"


Change this to:


CreateCustRow  getlang("LangCustEmail"), "strEmail", strEmail, "Yes"
  
'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
if getconfig("xprotectemailforms") = "Yes" then
  CreateCAPTCHA
end if




Further on in the shopmaillist.asp file you will need to alter the "ValidateMinimumInfo" subroutine.

Around line 256 just before the "End Sub" line which ends the "ValidateMinimumInfo" subroutine, add the following code:


'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
if getconfig("xprotectemailforms") = "Yes" then
	%><!-- #include file="captcha/captcha_process_form.asp" --><%
	If blnCAPTCHAcodeCorrect Then 
		'Fine
	Else
	 sError = sError & getlang("langcaptchawrong") & "<br />"
	End If
End if



Finally, at the end of the shopmaillist.asp file, before the closing %> symbol, add the following new subroutine:


'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
Sub CreateCAPTCHA
	if getconfig("xprotectemailforms") <> "Yes" then exit sub
	
	Response.write tablerow & tablecolumn 
	Response.write "*" & getlang("langcaptchaenter") & TablecolumnEnd
	Response.write tablecolumn
	getCAPTCHA
	Response.write tablecolumnend & tableRowend
End Sub




Once done, save and re-upload the file to your server. If you have xprotectemailforms set to Yes in your configuration settings you should now see the CAPTCHA form on the shopmaillist.asp page.

Similar customization is required if you want to add the CAPTCHA form to other forms on your site.

If you need assistance implementing this change feel free to get in touch at http://www.creativechaos.com.au/contactus.htm

Hope this helps.

Cheers,

Michael Dunkley
Creative Chaos
http://www.creativechaos.com.au
Go to Top of Page

go4gold
VP-CART New User

151 Posts

Posted - November 10 2009 :  01:42:07  Show Profile  Visit go4gold's Homepage  Reply with Quote
Many thanks for your help Michael! Sorry I should have said I am using version 6.09 and added Captcha with the add-on. Will this still work for me? I don't have a xprotectemailforms setting to change.

Thanks again.

Go4Gold
Go to Top of Page

creativechaos
VP-CART New User

Australia
64 Posts

Posted - November 10 2009 :  01:51:33  Show Profile  Visit creativechaos's Homepage  Reply with Quote
Hi,

The directions above should be pretty similar for v6.09. The line numbers won't be the same, but the location within the subroutines that you need to modify is the same.

If there is no configuration setting xprotectemailforms then you will need to remove the if getconfig("xprotectemailforms") lines and any associated "end if" lines from the above code.

Cheers,

Michael Dunkley
Creative Chaos
http://www.creativechaos.com.au
Go to Top of Page

go4gold
VP-CART New User

151 Posts

Posted - November 11 2009 :  15:34:50  Show Profile  Visit go4gold's Homepage  Reply with Quote
Many thanks Michael. Just done it and it works a treat!

Cheers!

Go4Gold
Go to Top of Page

go4gold
VP-CART New User

151 Posts

Posted - November 12 2009 :  09:34:37  Show Profile  Visit go4gold's Homepage  Reply with Quote
I spoke too soon. Your code works percectly for shopmaillist.asp but I also have a simplified sign up form in shoppage-trailier.htm (and various other places) which are now reacting in a strange way. The code I've used in shoppage-trailier.htm is below which you'll see refers to shopmaillist.asp. Although it does not currently display captcha, when a customer hits "submit" it diverts to shopmaillist.asp and tells them they put in the wrong captcha code. (or at least it did until I substituted a duplicate of the previous shopmaillist.asp file).

Do you know what I can do to fix this please?

<form action="http://www.myfavouritepubwalks.co.uk/shopping/shopmaillist.asp" name="shipping" method="post">
<div style="text-align: center;">
<table border="0" cellspacing="0" cellpadding="1" style="width: 138px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td valign="top" width="150" style="text-align: left; font-family: Arial,Helvetica,sans-serif; font-size: 8pt; color: rgb(0, 0, 0);">First Name</span></td>
<td valign="top" width="250" align="left"><span style="font-family: Arial,Helvetica,sans-serif; font-size: 8pt; color: rgb(0, 0, 0);">
<input style="width: 100%;" class="txtfield" value="" name="strfirstname"/></span><br>
</tr>
<tr>
<td valign="top" width="150" align="left"><span style="font-family: Arial,Helvetica,sans-serif; font-size: 8pt; color: rgb(0, 0, 0);">* Surname</span></td>
<td valign="top" width="250" align="left"><span style="font-family: Arial,Helvetica,sans-serif; font-size: 8pt; color: rgb(0, 0, 0);">
<input style="width: 100%;" class="txtfield" value="" name="strLastname"/></span></td>
</tr>
<tr>
<td valign="top" width="150" align="left"><span style="font-family: Arial,Helvetica,sans-serif; font-size: 8pt; color: rgb(0, 0, 0);">* Email</span></td>
<td valign="top" width="250" align="left"><span style="font-family: Arial,Helvetica,sans-serif; font-size: 8pt; color: rgb(0, 0, 0);">
<input style="width: 100%;" class="txtfield" value="" name="strEmail"/></span></td>
</tr>
</tbody>
</table></div><br/>
<div style="text-align: center;">
<!--&lt;tablecellspacing="1" cellpadding="1" border="0" style="text-align: left; font-size: 8pt; margin-left: auto; margin-right:auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="150" valign="top"style="text-align: left;"&gt;&lt;span style="font-family:Tahoma,Verdana; font-size: 8pt; color: rgb(0, 0, 0);"&gt;Remove frommailing list&lt;/span&gt;&lt;/td&gt;&lt;td width="150" valign="top"style="text-align: left;"&gt;&lt;span style="font-family:Tahoma,Verdana; font-size: 10pt; color: rgb(0, 0, 0);"&gt;&lt;inputtype="checkbox" name="blnmaillist" value="TRUE"/&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;-->
</div>
<input name="action" src="images/Click-to-Register-button.jpg" border="0" type="image"><br>
<br></center></center>
<div align="left"><span style="text-align: left; font-size: 1"><b>10 Reasons to Sign Up:</b><br>
1. etc., etc.<br><br></span></div>

<span style="text-align: left; font-size: 8pt; font-family: Arial,Helvetica,sans-serif;"><a href="http://myfavouritepubwalks.co.uk/shopping/privacy.asp" target="_blank">Privacy policy</a>. <a href="http://myfavouritepubwalks.co.uk/shopping/shopmaillist.asp" target="_blank">Unsubscribe</a>.

</span>
</form>

Thanks again for your help.

Regards,

Go4Gold
Go to Top of Page

creativechaos
VP-CART New User

Australia
64 Posts

Posted - November 12 2009 :  16:08:43  Show Profile  Visit creativechaos's Homepage  Reply with Quote
Hi Go4Gold,

It seems like you have basically taken the original shopmaillist.asp form code and placed that into your shoppage_trailer.htm file. When you post this to the new shopmaillist.asp page, since it is a form post, the script tries to run the validation routine where it now has a check for CAPTCHA.

Your option here is either to add the CAPTCHA functionality to the shoppage_trailer.htm file or to modify the shopmaillist.asp script to accept posts from different forms (basically you would need to add a hidden field into each form and then validate them according to what options you have on the form)

If you move the "Sub CreateCAPTCHA" subroutine mentioned in my earlier post into the shop$db.asp file, you can include the call <% CreateCAPTCHA %> anywhere in your site including in your shoppage_trailer.htm file.

Adding in separate validation routines depending on whether the form was posted from shopmaillist.asp or from the shoppage_trailer.htm page is getting a bit beyond what I can realistically describe on the forum so feel free to get in touch if you'd like a quote to put something like that together.

Cheers,

Michael Dunkley
Creative Chaos
http://www.creativechaos.com.au
Go to Top of Page

go4gold
VP-CART New User

151 Posts

Posted - November 12 2009 :  18:51:05  Show Profile  Visit go4gold's Homepage  Reply with Quote
Thanks Michael, I'll have a play and keep your offer in mind.

Regards,
Leigh

Go4Gold
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00