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
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
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 : 21804
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 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
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
Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality.
Categories : PHP, GD image library, Graphics
Creates a CAPTCHA image in PHP, which displays 5 numbers stored in a session.
Categories : PHP, GD image library, Form Processing, Security
Create a Thumbnail Using PHP, GD and Exif
Categories : PHP, Graphics, Exif, GD image library
Authenticator for Exchange Server LDAP
Categories : PHP, Authentication, LDAP, Security, Sessions
A login page that require username, password and userlevel.
Categories : PHP, Security, Sessions, MySQL, Databases
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Advanced Image WaterMarker
Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented
Image Generation Class ( PNG Format )
Categories : PHP, GD image library, PHP Classes, Graphics
A simple PHP login script that you can modify to suite your needs. It use a session to store data in a session file submited by the page.
Categories : PHP, Sessions, Security, Authentication
Simple PHP Bar Graph using GD library
Categories : PHP, GD image library, Graphics, Arrays
PHP Image Compression using GD library
Categories : PHP, Compression, 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