Creating Captcha Forms

0
August 16, 2011

Hi,

I would like to create a form with a captcha security image.  I have managed to integrate the captcha and got it to get the image and audio files.  I am using a capctha script provided by

http://www.phpcaptcha.org

.

However unfortunately it seems that its not working..  When i submit the form, the form is submitted without the security code being validated.  I have went through the quick start, provided  by the developer (

http://www.phpcaptcha.org /documenta tion/quick start/

), however I still did not manage to get it working properly.

Can someone please help me and update the code or tell me what to do please?

Thanks

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<link href="assets/stylesheet/default/core/core.css" type="text/css" rel="stylesheet" />
<script src="assets/js/ACRunActiveContent.js" type="text/javascript"></script>
<script src="assets/js/dropdownmenu.js" type="text/javascript"></script>
</head>
<body>
<div align="center">
  <script type="text/javascript">
ACFLRunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','100%','height','100%','align','middle','src','assets/graphics/swf/home','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1ProdVersion=ShockwaveFlash','wmode','transparent','movie','assets/graphics/swf/test'); //end AC code
  </script>
  <noscript>
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%" align="middle">
    <param name="movie" value="assets/graphics/swf/test.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <embed src="assets/graphics/swf/test.swf" width="100%" height="100%" align="middle" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1ProdVersion=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
  </object>
  </noscript>
</div>
<div class="menu">
  <div class="divSpacer10"></div>
  <div align="center">
    <table width="980" border="0" align="center">
      <tr>
        <td width="100%"><a href="http://www.test.com" class="menulinkstyle"><strong>Back to test</strong></a></td>
      </tr>
    </table>
  </div>
</div>
<div class="content">
  <div align="center">
    <table width="100%" border="0" align="center">
      <tr>
        <td><div class="contentareasmall">
            <div align="center">
              <table width="800" border="0">
                <tr>
                  <td class="divSpacer5"> </td>
                </tr>
                <tr>
                  <td valign="top"><table width="98%" border="0" align="center">
                      <tr>
                        <td><h1 align="left">Become a Member</h1></td>
                      </tr>
                      <tr>
                        <td><p class="paddedtextblack">If you would like to become a member, kindly fill in the form below to receive information and special offers from testing.</p>
                          <div class="divSpacer10"></div>
                          <div align="center">
                            <form id="form1" name="form1" method="post" action="/cgi-bin/formmail/formmail.cgi" onsubmit="MMvalidateForm('Name','','R','Surname','','R','Address1','','R','Address2','','R','Street','','R','City','','R','Country','','R','PostalCode','','R','Tel','','R','Mob','','R','Email','','R');return document.MMreturnValue">
                                <input type="hidden" name="envreport" value="REMOTEHOST,REMOTEADDR,HTTPUSERAGENT,AUTHTYPE,REMOTEUSER">
                              <input type="hidden" name="recipient" value="info@test.com,forms@test.com" />
                              <input type="hidden" name="subject" value="Newsletter Subscription test" />
                              <input type="hidden" name="redirect" value="http://test.com/thankyou.html"/>
                              <input type="hidden" name="email" value="bookings@test.com" />
                              <table width="575" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="75" class="label">Name:</td>
                                  <td width="153"><div align="left">
                                      <input type="text" name="Name" id="Name" width="150px" />
                                    </div></td>
                                  <td class="contentText"> </td>
                                  <td colspan="2" rowspan="3" class="contentText"><table border="0" align="left" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td width="175"><img id="captcha" src="securimage/securimageshow.php" alt="CAPTCHA Image" /></td>
                                        <td><table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                              <td rowspan="2"><div class="divSpacer10"></div></td>
                                              <td><a href="#" onclick="document.getElementById('captcha').src = 'securimage/securimageshow.php?sid=' + Math.random(); return false"><img src="securimage/images/refresh.gif" alt="Refresh Image" width="22" height="20" border="0" /></a></td>
                                            </tr>
                                            <tr>
                                              <td><a href="/securimage/securimageplay.php"><img src="securimage/images/audioicon.gif" alt="Listen" width="22" height="20" border="0" /></a></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr>
                                        <td colspan="2"><input type="text" name="captchacode" size="10" maxlength="6" width="150px" />
                                           Enter the above code</td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td colspan="3"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td width="75" valign="top" class="label">Surname:</td>
                                  <td width="153" valign="top"><div align="left">
                                      <input type="text" name="Surname" id="Surname" width="150px" />
                                    </div></td>
                                  <td> </td>
                                </tr>
                                <tr>
                                  <td colspan="5"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td colspan="5" class="contentText"><hr /></td>
                                </tr>
                                <tr>
                                  <td width="75" class="label">Address 1:</td>
                                  <td width="153"><div align="left">
                                      <input type="text" name="Address1" id="Address1" width="150px" />
                                    </div></td>
                                  <td width="40"> </td>
                                  <td width="75" class="label">Tel:</td>
                                  <td width="193"><div align="left">
                                      <input name="Tel" type="text" id="Tel" size="20" maxlength="20" width="150px" />
                                    </div></td>
                                </tr>
                                <tr>
                                  <td colspan="5"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td width="75" class="label">Address 2:</td>
                                  <td width="153"><div align="left">
                                      <input type="text" name="Address2" id="Address2" width="150px" />
                                    </div></td>
                                  <td width="40"> </td>
                                  <td width="75" class="label">Mob:</td>
                                  <td width="193"><div align="left">
                                      <input name="Mob" type="text" id="Mob" size="20" maxlength="20" width="150px" />
                                    </div></td>
                                </tr>
                                <tr>
                                  <td colspan="5"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td width="75" class="label">Street:</td>
                                  <td width="153"><div align="left">
                                      <input type="text" name="Street" id="Street" width="150px" />
                                    </div></td>
                                  <td width="40"> </td>
                                  <td width="75" class="label">Email:</td>
                                  <td width="193"><div align="left">
                                      <input type="text" name="Email" id="Email" width="150px" />
                                    </div></td>
                                </tr>
                                <tr>
                                  <td colspan="5"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td width="75" class="label">City:</td>
                                  <td width="153"><div align="left">
                                      <input type="text" name="City" id="City" width="150px" />
                                    </div></td>
                                  <td width="40"> </td>
                                  <td width="75" rowspan="5" valign="top" class="label">Agreement:</td>
                                  <td width="193" rowspan="5" valign="top"><table width="99%" border="0" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td valign="top"><label>
                                          <input name="YesToNewsletter" type="radio" id="YesToNewsletter" value="YesToNewsletter" checked="checked" />
                                          </label></td>
                                        <td><div class="divSpacer5"></div></td>
                                        <td><div align="left"><span class="contentText">I hereby authorise<br />
                                            <strong>test</strong> to send periodical promotional material and special offers. I even confirm that the above information is correct.</span></div></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td colspan="3"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td width="75" class="label">Country:</td>
                                  <td width="153"><div align="left">
                                      <input type="text" name="Country" id="Country" width="150px" />
                                    </div></td>
                                  <td width="40"> </td>
                                </tr>
                                <tr>
                                  <td colspan="3"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td width="75" class="label">Postal Code:</td>
                                  <td width="153"><div align="left">
                                      <input name="PostalCode" type="text" id="PostalCode" size="8" maxlength="8" width="75px" />
                                    </div></td>
                                  <td width="40"> </td>
                                </tr>
                                <tr>
                                  <td colspan="5"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td colspan="5" class="contentText"> </td>
                                </tr>
                                <tr>
                                  <td colspan="5"><div class="divSpacer5"></div></td>
                                </tr>
                                <tr>
                                  <td> </td>
                                  <td> </td>
                                  <td> </td>
                                  <td> </td>
                                  <td><div align="left">
                                      <table border="0" align="right" cellpadding="0" cellspacing="0">
                                        <tr>
                                          <td><input name="Reset" type="reset" class="button" id="Submit" value="Clear" /></td>
                                          <td><div class="divSpacer10"></div></td>
                                          <td><input name="Submit" type="submit" class="button" id="Submit" value="Subscribe" /></td>
                                        </tr>
                                      </table>
                                    </div></td>
                                </tr>
                              </table>
                            </form>
                          </div></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td class="divSpacer10"> </td>
                </tr>
              </table>
            </div>
          </div></td>
      </tr>
    </table>
  </div>
</div>
<div class="footer">
  <div class="divSpacer5"></div>
  <div align="center">
    <table width="980" border="0" align="center">
      <tr>
        <td width="70%"><div align="left">address</div></td>
        <td width="30%"><div align="left"><a href="http://www.test.com/copyright.html" class="menulinkstyle">© test 2008</a></div></td>
      </tr>
      <tr>
        <td><div align="left">t: tel   f: fax </div></td>
        <td><div align="left"><a href="http://www.test.com/privacypolicy.html" class="menulinkstyle">Privacy Policy</a> | <a href="http://www.test.com/disclaimer.html" class="menulinkstyle">Disclaimer</a> | <a href="http://www.test.com/termsandconditions.html" class="menulinkstyle">Terms & Conditions</a> | <a href="sitemap.html" class="menulinkstyle">Sitemap</a></div></td>
      </tr>
      <tr>
        <td><div align="left">e: <a href="mailto:info@test.com?subject=Online Enquiry" class="menulinkstyle">info@test.com</a> </div></td>
        <td><div align="left">Site Developed by: <a href="http://www.testcom" class="menulinkstyle">www.test.com</a></div></td>
      </tr>
    </table>
  </div>
</div>
</body>
</html>
Attachments

6

answers

Comments See all(0)

Add comment
0
August 16, 2011

I've never used phpcaptcha, but this one works perfectly everytime:

http://recaptcha.net/

0
August 16, 2011

The problem is not CAPTCHA or your code, but formmail.cgi, I would say. You are using a very old version of Formmail. So either use a newer one (

http://www.tectite.com/dl formmail.p hp

), or use some other script (you can look here, for example:

http://cgi.resourceindex.c om/Program sandScri pts/Perl/ F orm_Proces sing/

).

I have tested your code, it's perfect. But I used my own PHP file to process the form (which I attach below). If you want to test it for yourself, change action="/cgi-bin/formmail/

formmail.c

gi" to action="process.php" in your form.

<?php session_start();
includeonce $SERVER['DOCUMENT_ROOT'].'/securimage/securimage/securimage.php';
$securimage = new Securimage();
echo "<pre>";
printr($POST);
echo "</pre>";
if ($securimage->check($POST['captchacode']) == false) {
  // the code was incorrect
  // handle the error accordingly with your other error checking
// or you can do something really basic like this
  die('The code you entered was incorrect.  Go back and try again.');
}
else echo "check OK";
?>
0
August 16, 2011

This is what I use - not very elaborate, but it works like a charm! HTH, ~Ray

<?php // CAPTCHA_NUMBER.PHP GENERATES A PICTURE OF A NUMBER
 $data  = base64_decode($_GET['dt']);
 $im    = imagecreate(46,13);
 $bg    = imagecolorallocate($im, 255,255,255);
 $gray  = imagecolorallocate($im, 188,188,188);
 $text  = imagecolorallocate($im, 178,34,34);  // firebrick
 imagestring($im,5,4,0,$data,$text);
 imageline($im,4,12,38,0,$gray);
 imagepng($im);
 imagedestroy($im);
?>






<html> <!-- GOES IN THE FORM SCRIPT -->
Type
<img style="display:inline;" src=captcha_number.php?dt=<?php $x = mt_rand(1000,10000); echo base64_encode($x);?> />
here:
<input type=hidden name='_newMd5' value="<?=md5($x)?>" />
 
<input name="_newCode" type="text" maxlength="64" size="6" autocomplete="off" />







<?php // GOES IN THE ACTION SCRIPT
$newCode    = $_POST["_newCode"];
$newMd5     = $_POST["_newMd5"];
$newCode    = md5($newCode);
if ($newCode != $newMd5)
{die('Security code number did not match');
}
0
August 16, 2011

Hi,

Thanks for your replies.  I am a beginner in this.. ive never worked in php..

Can someone tell me how to add the security image php code to the tectite code?  or other php formmail which doesnt include ads..?  The formmail I have is the one provided by my hosting, and thanks Delinek for informing me that its old..  I will have a chat with my hosting support.

Thanks

0
August 16, 2011

Hi,

I am uploading my form and the new tectite php script.  Can someone please modify the files for me as im a beginner and do not understand php that much..

I would like that once the form is submitted, the user is redirected to the thank you page, however I think I catered for this through the html coding.

Attachments
0
August 16, 2011

It is not possible to tell you explicitly what values you should use. I have put together a general list of what you need to do:

formmail.php:

line 241 - set as described here:

http://www.tectite.com/fmd oc/target_ email.php# defaultval ue

line 244 - set as described here:

http://www.tectite.com/fmd oc/def_ale rt.php

line 362 - if you want to include sttachments, set "define("FILEUPLOADS",fals

e);" to true AND take a look at variables below to see if you need to change anything else.

sampleform:

line 44: set action="formmail.php"

remove line 54 (<input type="hidden" name="recipient" value="info@test.com,forms

@test.com"

/>) as the recipients address(es) should be set in formmail.php (in $TARGET_EMAIL, line 241)

remove line 57 (<input type="hidden" name="email" value="bookings@test.com" />) as you have that field already defined later on (line 136)

change line 56 (<input type="hidden" name="redirect" value="

http://test.com/tha nkyou.html

"/>) to <input type="hidden" name="good-url" value="

http://test.com/tha nkyou.html

"/>

A very detailed info on how to create a form working with formmail can be found here:

http://www.tectite.com/fmd oc/creatin g_forms.ph p

Just read through and use variables you need.

Here you can find a set of Guides:

http://www.tectite.com/fmh owto/guide s.php

As I said, you will need to customize the script by yourself, but it is not difficult, just read what they say in documentation - you don't need to know PHP nor change a lot.

Let me know how you are doing and if you stuck on something.

Related Questions

PHP and mySQL forms maker?

Hello, I have to make 10 small web sites over the next 30 days and was looking for a tool that would help me make forms to be entered in EACH web sites mySQL database? &#160;I have seen form makers bu Read More

Views

45

Votes

0

Answers

1

August 16, 2011

online form not working

We are using http://www.tectite.com/ for an online form on the below website: http://myrascakes.com/orde r.html We keep getting an error and don&#39;t know how to fix it. &#160;There is a r Read More

Views

1k

Votes

0

Answers

15

August 15, 2011

This is the very first question

Hello guys! This is the first post in this site Read More

Views

2k

Votes

4

Answers

2

January 08, 2016

report values not showing up.

I have a crystal report which I pass a DataSet to using VB.NET. The report was working fine, but then I make some changes to the import query and now nothing shows up in the crystal report. Crystal do Read More

Views

1k

Votes

0

Answers

12

September 06, 2005

Event log doesn't overwrite as needed in SP4

Hello All, After upgrading from SP3 to SP4 on several Windows 2000 PRO machines everything looked fine, but from time to time applications can&#39;t write to the event log. When I try to view the appl Read More

Views

1k

Votes

0

Answers

9

May 11, 2003

"Failed to self-register XYZ.dll"

Hi there, I wrote a OLE-automation-server DLL in VB4.0. I use Installshield Express to install it as part of my program on the target computers. Now on some computers I get the message &quot;Failed to Read More

Views

8k

Votes

0

Answers

2

November 08, 1998

Please help understand these notes on image processing

Can someone please help me understand these lecture notes... On the right of the page; What does &quot;normalised by one notion of the area of a pixel&quot; mean? On the first formula for A, Is that a Read More

Views

1k

Votes

0

Answers

3

February 05, 2009

Can someone please explain this paragram on the chain rule in image processing

Please see the screenshot, How is 3133030 got from 10103322? Read More

Views

1k

Votes

0

Answers

1

January 05, 2009

AD on 2003

We have created an AD Domain on Windows 2000 Server with no problems. We just created an AD Domain on Windows 2003 and we&#39;re getting some weird problems. Both of these domains are behind firewalls Read More

Views

1k

Votes

0

Answers

15

May 11, 2003

ADDT ASP Upload Error " Type mismatch: 'tNG_isFileInsideBaseFolder' "

I am trying to create a simple insert record and upload image function on an ASP page built using Adobe Dreamweaver Developer Toolkit. I have done this many times before with no problem, however, i ha Read More

Views

1k

Votes

0

Answers

0

November 02, 2008

MYSQL Select query with custom ORDER BY

Hi, is it possible to customize the order of the returned rows in mysql? Example: I have a Table with a column &quot;name&quot;, now I want to have all entries ordered by name, but I want the entries Read More

Views

1k

Votes

0

Answers

5

July 02, 2010

Folder Redirection in Server 2003

We have a Windows Server 2003 Standard Ed. Is there a way to redirect the users my documents to a folder that has already been created on the server? Read More

Views

1k

Votes

0

Answers

2

July 05, 2007

Partiton magic  version 8.0 having error 1523 while executing batch

I followed the partition magic 8.0 wizard to partition my hard disk while rebooting &#160;I came across this problem &#160;&quot;error 1523 while executing batch&quot; What can I do to solve this prob Read More

Views

1k

Votes

0

Answers

2

May 11, 2003

Please explain this paragraph in image processing (screenshot attached)

Two questions; How is the equation (10.1-15) formed? &quot;are isotropic for rotation increments of 90 degrees and 45 degrees respectively&quot; What does this mean Read More

Views

1k

Votes

0

Answers

7

January 05, 2009

xp_cmdshell with net use

Hi, when I use &#39;net use \192.168.0.1\c$ password /user:username&#39; at the command prompt, it works fine. &#160;But if i try to use it in sql with &quot; exec master..xp_cmdshell &#39;net use \19 Read More

Views

999

Votes

0

Answers

5

April 11, 2003

hp ux11

i have a hp ux11 server. and i edited the /etc/resolv.conf to use my win2003 server dns server. That went fine, however, I would like to go the other way and add an entry on my win2003 dns to resolve Read More

Views

627

Votes

0

Answers

3

October 12, 2009

Using an application over a LAN

I have written an application that needs to be used on a LAN. &#160;The application setup wizard takes care of registering everything on a single PC, but how do you go about writing a setup program th Read More

Views

550

Votes

0

Answers

9

August 07, 1998

Need subnet of 12 IPs.

Please, Can someone help me to create a subnet consisting of 12 IP&#39;s. Thanks.. Read More

Views

558

Votes

0

Answers

5

April 11, 2003

Drill down in a cross-tabl report

Hello, Would some experts to show me if it is possible to do drill-up or drill-down (or both) in a cross-tab report? I would also like to know if it is possible to control what fields to be displayed/ Read More

Views

446

Votes

0

Answers

0

September 06, 2005

Using RDO, Enterprise V Professional

We would like to use RDO on our project made up of 4 developers. Do we need to have a copy of Enterprise for each developer or is it possible to use Professional for those developers not writing the R Read More

Views

537

Votes

0

Answers

6

January 07, 1998