Source for file img_rand.php
Documentation is available at img_rand.php
* Script che mostra una stringa alfanumerica casuale sotto forma di immagine.
* Lo script viene utilizzato nel caso di modifica della password
* ed è richiamato dalla pagina {@link password_recover.php}
* @author Mario Marcello Verona <marcelloverona@gmail.com>
* @copyright 2007 Mario Marcello Verona
* @license http://www.gnu.org/licenses/gpl.html GNU Public License
unset ($a[96],$a[95],$a[94],$a[93],$a[92],$a[91]);
for($i= 0;$i< count($x);$i++ ){
// create the hash for the random number and put it in the session
$_SESSION['image_random_value'] = md5($rand);
$image = imagecreate(70, 20);
// use white as the background image
$bgColor = imagecolorallocate ($image, 255, 255, 255);
// the text color is black
$textColor = imagecolorallocate ($image, 0, 0, 0);
// write the random number
imagestring($image, 6, 5, 5, $rand, $textColor);
// send several headers to make sure the image is not cached
// taken directly from the PHP Manual
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// send the content type header so the image is displayed properly
header('Content-type: image/jpeg');
// send the image to the browser
// destroy the image to free up the memory
|