phyllis-fantasies/sitesrc/verification_image.php

33 lines
741 B
PHP
Raw Normal View History

<?php
// Verification image script - AGRT 8/7/2016 (after TheWebHelp.com)
header('Content-Type: image/jpeg');
header('Cache-Control: no-store');
$width = 50;
$height = 24;
$my_image = imagecreatetruecolor($width, $height);
imagefill($my_image, 0, 0, 0xFFFFFF);
// add noise
$noise = ($width * $height) / 30;
for ($c = 0; $c < $noise; $c++) {
$x = rand(0, $width - 1);
$y = rand(0, $height - 1);
imagesetpixel($my_image, $x, $y, 0x000000);
}
$x = rand(1, 10);
$y = rand(1, 10);
$rand_num = rand(1000, 9999);
$rand_string = "$rand_num";
imagestring($my_image, 5, $x, $y, $rand_string, 0x000000);
$cv = "VC:" . sha1($rand_string) . 'a4xn';
setcookie('vericon', $cv, 0, '/');
imagejpeg($my_image);
imagedestroy($my_image);
?>