![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||
|
index.htm
<form action="check.php" method="post"> <img src="cap.php"><input type="text" name="cap"> <input type="submit" value="Check"> </form> check.php <?php if ($_SESSION['cap'] == $_POST['cap']) echo "Correct."; else echo "Wrong."; ?> cap.php <?php session_start(); $charNum = 6; for ($i=1;$i<=$charNum;$i++) { $ran = array(chr(rand(65,90)), rand(1,9)); $captchastr .= $ran[rand(0,1)]; } $_SESSION['cap'] = $captchastr; $captcha = imageCreate(150,40); $backcolor = imageColorAllocate($captcha, 225, 235, 242); $txtcolor = imageColorAllocate($captcha, 17, 80, 152); for($i=1;$i<=$charNum;$i++) { $font = "tahoma"; imagettftext($captcha,rand(14,20),0,($i*20),30,$tx tcolor,$font,substr($captchastr,($i-1),1)); } $ecolor = imageColorAllocate($captcha, 217, 84, 100); for($i=1; $i<=2;$i++) imageellipse($captcha,rand(1,150),rand(1,40),rand( 40,100),rand(12,25),$ecolor); for($i=1; $i<=5;$i++) imageline($captcha, rand(1, 150), 0, rand(1, 150), 40, $txtcolor); header('Content-type: image/jpeg'); imageJPEG($captcha); imageDestroy($captcha); ?> |
|
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Quick and simple image hosting. - Hostbigger | GTFO | Free web hosting offers and requests | 2 | 07-06-2008 00:39 |
| PHP Tutorial | Sarunasas | Website Design Forum | 1 | 03-27-2008 00:00 |
| 80 cheap Script for sale | teampower | Content | 0 | 06-29-2007 01:08 |
| A Simple RSS Feed Phraser in PHP | admans | Website Design Forum | 5 | 10-05-2005 11:59 |
| How To : Improve Your PHP Programming | admans | Website Design Forum | 0 | 07-17-2005 06:58 |