CAPTCHA protection using PHP

Do you want to share WYSIWYG Web Builder tips, tricks, tutorials or useful HTML code? You can post it here...
(no questions or problems please, this section is not monitored by support).
Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
User avatar
chattd
 
 
Posts: 47
Joined: Wed Nov 26, 2008 7:03 pm

Post by chattd » Sat Jan 03, 2009 7:21 pm

Hi
Have it working now but it is saying the code you entered is wrong

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Sat Jan 03, 2009 8:20 pm

The Edit Box name should be named captcha_code, but in your form is has an extra space (shown as #): captcha_code#.

Please remove that extra space.

User avatar
chattd
 
 
Posts: 47
Joined: Wed Nov 26, 2008 7:03 pm

Post by chattd » Sat Jan 03, 2009 8:27 pm

Thank you so much for all your help

User avatar
iamafireman
 
 
Posts: 91
Joined: Mon May 26, 2008 2:41 am
Location: Tennessee

Post by iamafireman » Sat Jan 03, 2009 10:18 pm

i have done this once and all went well, I tried it again for a different site and i cannt get the image to show.
http://ttmptest.info/Availability.php

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Sat Jan 03, 2009 10:36 pm

I think you forgot to upload the font file.

Or the font file is not spelled correctly. The font name must be spelled exactly as in the script.

User avatar
iamafireman
 
 
Posts: 91
Joined: Mon May 26, 2008 2:41 am
Location: Tennessee

Post by iamafireman » Sun Jan 04, 2009 12:13 am

i have the font loaded its arial.ttf and thats what in captcha.php I have read through all 6 pages and still missing something

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Sun Jan 04, 2009 9:04 am

When I call captcha.php directly in the url bar it shows this error message:
Warning: imagettftext(): Could not read font in /home/content/d/o/n/donnajarrett/html/ttmptest/captcha.php on line 29

Warning: imagettftext(): Could not read font in /home/content/d/o/n/donnajarrett/html/ttmptest/captcha.php on line 31
So there must be something wrong with that font file.

When I call arial.ttf directly in the url bar a message indicates that the file is not a valid font file.

User avatar
Navaldesign
 
 
Posts: 1051
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Post by Navaldesign » Tue Jan 06, 2009 10:52 pm

Only one captcha per page is possible, unless you modify the script.

However, i don't see how you have used more than one forms in the same page with Form Wizard. Did you use a separate script ?
www.dbtechnosystems.com

User avatar
Navaldesign
 
 
Posts: 1051
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Post by Navaldesign » Wed Jan 07, 2009 10:57 pm

Ok, here is a fast one. It takes care of multipe departments (actually unlimited...) using a dropdowm.

You can test it at http://www.dbtechnosystems.com/wb5/contact_multiple.php

And you can download it at http://www.dbtechnosystems.com/wb5/mult ... tments.wbs

Please note that this script combines the method described in viewtopic.php?t=14938 with your requirements.

The code in the form page Start of Page should not be changed. Neither should the value of the hidden field.

The processing script is in the page confirm1.php
Please note that you will need to add here the email addresses. You will see the code:



$subject = 'New Submission from our Mulriple Department Website form';
$message = 'Values submitted from web site form to department: '.$_POST['department'];
$error_url = 'errorpage1.php';

$address['Sales'] = "sales@yourdomain.com";
$address['Warranty]' = "warranty@yourdomain.com";
$address['Manufacturing'] = "manufacturing@yourdomain.com";

$department_error = "Invalid department selection!<br>";// You can change this as required


Customize the parts in red as required.

Please note that i have used three departments in the listbox: Sales, Warranty, Manufacturing (taken from your page).

The values in the square brackets MUST be exactly as the values in the form combobox. The email addresses MUST be, for each one, the email address where you want the mail to be sent.

You can also cusomize the Subject, start of the message, and the error hat will be displayed (though it NEVER should) if the email address is not found due to a mistype.
Last edited by Navaldesign on Fri Jan 09, 2009 6:52 am, edited 1 time in total.
www.dbtechnosystems.com

RobertZyski
 
 
Posts: 7
Joined: Mon Jun 25, 2007 10:51 am

Post by RobertZyski » Mon Jan 19, 2009 4:46 pm

Kees, here is my contact page http://www.comtechcentral.com/contact_us.php
I am getting tons of spam. Your code above will work on my current form right? I am nervous about messing it up since I have to upload it to see if it works. It seems like alot to do, making me very nervous.
RZ

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Mon Jan 19, 2009 5:13 pm

Yes, it will work.

One remark about your form: Using the built-in form processor, you should have a field named email (lower case). Yours is named Email.

RobertZyski
 
 
Posts: 7
Joined: Mon Jun 25, 2007 10:51 am

Post by RobertZyski » Mon Jan 19, 2009 5:24 pm

This is the html code on my form right now:

<form name="Contact_Form" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form1" onsubmit="return ValidateContact_Form(this)">
<div id="wb_Text27" style="position:absolute;left:38px;top:15px;width:76px;height:14px;z-index:89" align="left">
<font style="font-size:11px" color="#004040" face="Arial"><b>Name</b></font></div>
<input type="text" id="Editbox4" style="position:absolute;left:124px;top:15px;width:200px;border:1px #004040 solid;font-family:Courier New;font-size:16px;z-index:90" size="20" name="Name" value="">
<div id="wb_Text28" style="position:absolute;left:38px;top:44px;width:76px;height:14px;z-index:91" align="left">
<font style="font-size:11px" color="#004040" face="Arial"><b>Email</b></font></div>
<input type="text" id="Editbox5" style="position:absolute;left:124px;top:44px;width:200px;border:1px #004040 solid;font-family:Courier New;font-size:16px;z-index:92" size="20" name="email" value="">
<div id="wb_Text29" style="position:absolute;left:38px;top:73px;width:76px;height:14px;z-index:93" align="left">
<font style="font-size:11px" color="#004040" face="Arial"><b>Phone</b></font></div>
<input type="text" id="Editbox6" style="position:absolute;left:124px;top:73px;width:200px;border:1px #004040 solid;font-family:Courier New;font-size:16px;z-index:94" size="20" name="Phone" value="">
<div id="wb_Text30" style="position:absolute;left:38px;top:102px;width:76px;height:28px;z-index:95" align="left">
<font style="font-size:11px" color="#004040" face="Arial"><b>Your Message</b></font></div>
<textarea name="Your Message" id="TextArea1" style="position:absolute;left:124px;top:102px;width:200px;height:100px;border:1px #004040 solid;z-index:96" rows="4" cols="18"></textarea>
<input type="submit" id="Button1" name="""" value="Submit" style="position:absolute;left:124px;top:207px;width:96px;height:25px;border:1px #004040 solid;color:#004040;font-family:Arial;font-weight:bold;font-size:13px;z-index:97">
<input type="reset" id="Button2" name="Reset" value="Reset" style="position:absolute;left:228px;top:207px;width:96px;height:25px;border:1px #004040 solid;color:#004040;font-family:Arial;font-weight:bold;font-size:13px;z-index:98">
<div id="wb_Html2" style="position:absolute;left:320px;top:253px;width:100px;height:38px;z-index:99" align="left">
<!-- captcha -->
<img src="http://www.dbtechnosystems.com/wb5/captcha.php" alt="Click for new image" title="Click for new image" style="cursor:pointer" onclick="this.src='http://www.dbtechnosystems.com/wb5/capt ... m()"></div>
<div id="wb_Text23" style="position:absolute;left:202px;top:301px;width:221px;height:15px;z-index:100" align="left">
<font style="font-size:12px" color="#666666" face="Arial"><i><u>Click on the image to try an easier one</u></i></font></div>
<div id="wb_Text22" style="position:absolute;left:9px;top:256px;width:204px;height:32px;z-index:101" align="left">
<font style="font-size:13px" color="#666666" face="Arial"><i>Please input the verification code<br>
as seen in the image to the right.</i></font></div>
<input type="text" id="Editbox1" style="position:absolute;left:213px;top:260px;width:80px;font-family:Courier New;font-size:16px;z-index:102" size="8" name="captcha_code" value="">
</form>

Can't I just alter this code? I have since uploaded the captcha box and image to my site but right now it doesn't stop you from submitting.
And actually, I think they are just getting my email address from the site since it's all over it. How do I stop that? I have an html protector program, should I just protect the entire site? Will that mess up my form if I protect the site?

Thanks so much for your help!!
RZ

User avatar
Navaldesign
 
 
Posts: 1051
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Post by Navaldesign » Mon Jan 19, 2009 8:12 pm

If spammers have already got your email address from the site, and send you spam directly (not through your form) there is no way to stop them.

I suggest installing on your PC Windows Live Mail instead of the classic Outlook Express, as it has pretty good spam filters and gets continously updated with the newest spam servers lists.
www.dbtechnosystems.com

RobertZyski
 
 
Posts: 7
Joined: Mon Jun 25, 2007 10:51 am

Post by RobertZyski » Mon Jan 19, 2009 8:17 pm

I use aol mail. Thank you for your response!
RZ

madjamonline
 
 
Posts: 55
Joined: Tue Jun 19, 2007 4:27 pm
Location: United Kingdom
Contact:

Post by madjamonline » Wed Mar 11, 2009 9:43 pm

CAPTCHA is so that robots or non-humans cannot submit the form. However, I recon technology is developing to read images! If you just did a simple plain text question, the robot could read the html to find the answer!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests