WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : CAPTCHA[Image verification]
Categories : PHP, Security, GD image library, Graphics, Sessions Click here to Update Your Picture
Suzzane Bruce
Date : May 07th 2007
Grade : 2 of 5 (graded 5 times)
Viewed : 23673
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Suzzane Bruce
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

A CAPTCHA ( "Completely Automated Public Turing test to tell Computers and Humans Apart") is a type of challenge-response test used in computing to determine whether or not the user is human. A CAPTCHA involves one computer (a server) which asks a user to complete a test. While the computer is able to generate and grade the test, it is not able to solve the test on its own. Because computers are unable to solve the CAPTCHA, any user entering a correct solution is presumed to be human. A common type of CAPTCHA requires that the user type the letters of a distorted image, sometimes with the addition of an obscured sequence of letters or digits that appears on the screen.

This is the form.php
<?php
session_start
();
?>
<form name="form1" method="post" action="form.php">
<table border="1" width="380" align="center" cellspacing="2" cellpadding="0" bgcolor="#C1DBFF"><TR><TD>
<table bgcolor="" align="center">
<tr>  <td align="center" colspan="2"><img src="http://192.168.0.6/workbench/lekha/test/captcha.php"></td><tr>
<td align="center"> Please enter the string shown in the image.</td><tr>
<td align="center"><input name="number" type="text"></td><tr>
<td align="center"><input name="Submit" type="submit"   value="Submit"></td> </tr>
</table>
</TD></TR></table>
</form>
<div align="center">
<?php
if(isset($_REQUEST['Submit'])){
     
$key=substr($_SESSION['key'],0,5);

     
$number = $_REQUEST['number'];
      if(
$number!=$key){
          echo
' Validation string not valid! Please try again!';}
      else{
           echo
' Thank You for the verification!';}

     }
?>
</div>



//Second file which is called in form.php-captcha.php
<?php
session_start
();
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,5);
//echo $string;
//$string="bac12g";
$image = imagecreatefromjpeg("images/box5");
$black = imagecolorallocate($image, 0, 0, 0);
$line = imagecolorallocate($image,233,239,239);
$line2 = imagecolorallocate($image, 153,165,123);
imageline($image,10,1,30,25,$line2);
imageline($image,1,60,40,10,$line2);
imageline($image,5,8,20,20,$line2);
imageline($image,6,40,20,15,$line2);


for (
$i = 0; $i <= 256; $i++) {
$point_color = imagecolorallocate ($image, rand(0,255), rand(0,255), rand(0,255));
imagesetpixel($image, rand(6,128), rand(2,38), $point_color);
}

$str_array=array();
$len=strlen($string);
for(
$i=0;$i<$len;$i++) $str_array[]=$string{$i};
imagestring($image, 5, rand(2,10), rand(2,11), $str_array[0], $black);// Draw a random string horizontally
imagestring($image, 5, rand(18,25), rand(2,11), $str_array[1], $black);// Draw a random string horizontally
imagestring($image, 5, rand(33,40), rand(2,11), $str_array[2], $black);// Draw a random string horizontally
imagestring($image, 5, rand(47,55), rand(2,11), $str_array[3], $black);// Draw a random string horizontally
imagestring($image, 5, rand(61,68), rand(2,11), $str_array[4], $black);// Draw a random string horizontally
//imagestring($image, 5, 4, 13, $string, $black);
$_SESSION['key'] = $string;

header("Content-type: image/jpeg");
imagejpeg($image);
?>



A captcha image allows you to prevent spam posting when users reload the page and stop bots from submitting forms automatically. This version allows you to use your own fonts (.ttf) to show the text.
Categories : PHP, Security, Graphics, GD image library
Securing Web Forms with Simple PHP-CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart)
Categories : PHP, Security, GD image library, Sessions
Generate image with random number (CAPTCHA)
Categories : PHP, GD image library, Graphics, Security
A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
PHP Image Compression using GD library
Categories : PHP, Compression, GD image library, Graphics
session out Timer
Categories : PHP, Sessions, Security, Beginner Guides
Line graphics generation library written in PHP + GD library (spanish comments)
Categories : PHP, Graphics, GD image library
a simple pie-chart in php3 (with gd)
Categories : PHP, Graphics, GD image library, Charts and Graphs
EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly.
Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library
Display a bar chart based on random values.
Categories : Graphics, PHP, GD image library, Charts and Graphs
imageMarker v 3.00 with new advanced features
Categories : PHP, PHP Classes, Graphics, GD image library
Session Validation Methods (Security Checks)
Categories : PHP, Sessions, Security
Dynamic Image Authentication System in Signup Pages (CAPTCHA)
Categories : PHP, Security, GD image library
Function to generate readable/remeberable random password
Categories : PHP, Security, Security
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
 Bruce Borner wrote : 1690
img src="http://192.168.0.6/workbench/lekha/test/captcha.php"&gt;&lt;/

Can you specify the non-local address of the above?
 
 Bruce Borner wrote :1691
="http://192.168.0.6/workbench/lekha/test/captcha.php"&gt;&lt;/

There is no captcha.php ...
There is only form.php and form.php-captcha.php
form.php is looking for the image on 192.168.0.6