Website Ideas blog dedicated to web-developers for design inspiration
February 09, 2012, 04:44:38 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome To Website Ideas blog dedicated to web-developers for design inspiration
 
 Website Ideas  Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: PHP Captcha Form  (Read 4247 times)
0 Members and 1 Guest are viewing this topic.
Aqueous
Newbie
*
Posts: 4


View Profile Email
« on: April 19, 2008, 10:23:58 AM »

This script generates images (known as "Captcha's") which contain security codes used for protecting a form from spam bots. This scripts works well and can be implemented into any php page, with very little php knowledge.

Please see code below:

Place the following code on your form. This will generate an image with a random string of characters along with the text field where the user will retype the code.

Quote
<img src="CaptchaSecurityImages.php" />
Security Code:
<input id="security_code" name="security_code" type="text" />

You can also specify certain options for the image by passing them as variables to CaptchaSecurityImages.php. The options available are the width and height of the image and the number of characters

<img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" alt="captcha" />
<input id="security_code" name="security_code" type="text" />

Then please also download the attachment and Place the following in the code where the form is submitted to. This code will check what the user has typed matches the code in the image.
Quote
<?php
   session_start();
   if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
      unset($_SESSION['security_code']);
   } else {
      // Insert your code for showing an error message here
   }
?>

Please post if you get stuck. and don't forget to download the attachment and place it in your root directory.

Best of luck
michaeldcoleman
Newbie
*
Posts: 1


View Profile Email
« Reply #1 on: December 28, 2009, 05:52:05 AM »

I downloaded the attachment from http://www.website-ideas.co.uk/2009/03/19/captcha-for-joomla/ and followed the forum support link to this thread.  I can use the sample form supplied in an article to get the code to display properly.  I have tried by adding to sobi2.details.tmpl at the end of the code the supplied lines.  I cannot get the image and code info to appear in any of the 'entry' type files.   sobi2.form.tmpl.php  also  sobi2.entry.php as an example.  I have tried the code in various places.  Can you point to what file and maybe which line to insert what code (I have tried the quoted code in the thread) ?  Thanks so much!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.03 seconds with 20 queries.

Google visited last this page February 01, 2012, 04:42:43 AM