View Single Post
  #7 (permalink)  
Old 07-12-2007, 09:26 PM
siLenTz's Avatar
siLenTz siLenTz is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Posts: 87
iTrader: (0)
siLenTz will become famous soon enoughsiLenTz will become famous soon enough
Full source:

PHP Code:
<html>
<head>
    <title>CAPTCHA</title>
</head>
<body>
<?php
    session_start
();

    if (isset(
$_POST['submit']) && 
        
md5($_POST['textcode']) == $_SESSION['vcode']) {
        die (
'Correct');
    } else {
        echo (
'Incorrect');
    }

    
$string md5(microtime() * mktime());
    
$string substr($string05);

    
$im imagecreatefromjpeg('back.jpg');

    
$white_color imagecolorallocate($im255255255);

    
imagestring($im5257$string$white_color);

    for(
$i 0$i 5$i++) {
        
imageline($imrand(0100),rand(020), rand(50100), rand(50100), $white_color); 
    }

    
imagejpeg($im'verify.jpg'); 
    
imagedestroy($im);

    
$_SESSION['vcode'] = md5($string);
?>
<form method="POST" action="">
    <img src="verify.jpg"><br>
    <input type="text" name="textcode">
    <input type="submit" value="Verify" name="submit">
</form>
</body>
</html>

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote