note 94975 added to function.imagettftext

From: Date: Sun, 06 Dec 2009 04:35:25 +0000
Subject: note 94975 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-163610@lists.php.net to get a copy of this message
Here's a good number verification captcha i just made: 1. on the page/s it will be used on, enter: <?php $pageToGo = "http://example.com/" #the page to go to if captcha correct if ($_POST["captchaused"] == "true") { if ($_POST["numcaptcha"] == $_POST["captcha"]) { header('Location: ' . $pageToGo); } else { echo '<form action="' . $_SERVER['php_self'] . '" method="post">'; $text = mt_rand(); echo '<input type="hidden" name="captchaused" value="true" />'; echo '<input type="hidden" name="numcaptcha" value="' . $text . '" />'; echo 'Enter the numbers you see: <br><input type="text" name="captcha" />'; require_once('numcaptcha.php'); echo '<input type="submit" value="enter site" /></form>'; } ?> 2. create a page called numcaptcha.php and enter: <?php header('Content-type: image/png'); $im = imagecreatetruecolor(400, 30); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); imagettftext($im, 20, 0, 10, 20, $black, $font, $text); imagepng($im); imagedestroy($im); ?> it might have a few security issues but it still works fine. ---- Server IP: 117.104.162.229 Probable Submitter: 219.90.177.198 (proxied: 219.90.177.198) ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- https://master.php.net/note/edit/94975 Del: integrated -- https://master.php.net/note/delete/94975/integrated Del: useless -- https://master.php.net/note/delete/94975/useless Del: bad code -- https://master.php.net/note/delete/94975/bad+code Del: spam -- https://master.php.net/note/delete/94975/spam Del: non-english -- https://master.php.net/note/delete/94975/non-english Del: in docs -- https://master.php.net/note/delete/94975/in+docs Del: other reasons-- https://master.php.net/note/delete/94975 Reject -- https://master.php.net/note/reject/94975 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163610) next »