![]() |
How to use captcha in php? How to use captcha in php? |
Re: How to use captcha in php? This is very simple program captcha in php you should go to google and search captcha in php and you got hundred and more link and resolved your problem |
Re: How to use captcha in php? <?php session_start(); include("./phptextClass.php"); /*create class object*/ $phptextObj = new phptextClass(); /*phptext function to genrate image with text*/ $phptextObj->phpcaptcha('#162453','#fff',120,40,10,25); ?> |
Re: How to use captcha in php? 1. Create file "capcha.php": <?php $seccode = mt_rand(10000, 99999); session_start(); $_SESSION['seccode'] = $seccode; header("Content-Type: image/png"); $im = imagecreate(60, 18) or die('Error on create image!'); $corfundo = imagecolorallocate($im, 255, 244, 234); $corfonte = imagecolorallocate($im, 255, 128, 0); $corlinha = imagecolorallocate($im, 255, 200, 150); $corborda = imagecolorallocate($im, 255, 128, 0); for($x=10; $x <= 100; $x+=10){ imageline($im, $x, 0, $x, 50, $corlinha); } imageline($im, 0, 9, 100, 9, $corlinha); imageline($im, 0, 0, 0, 50, $corborda); imageline($im, 0, 0, 100, 0, $corborda); imageline($im, 0, 17, 100, 17, $corborda); imageline($im, 59, 0, 59, 17, $corborda); imagestring($im, 5, 8, 1, $seccode, $corfonte); imagepng($im); imagedestroy($im); ?> 2. Create file "check.php": <?php session_start(); if(isset($_POST['key']) AND isset($_SESSION['seccode']) AND $_POST['key']==$_SESSION['seccode']){ echo 1; } else { echo 0; } ?> 3. Create file "index.html": <html> <head><title>Capcha</title></head> <body> <form action="check.php" method="post"> <img src="capcha.php" alt="" /> <input type="text" name="key" /> <input type="submit" value="send" /> </form> </body> </html> |
| All times are GMT -6. The time now is 04:06 PM. |