|
function generatePin($value)
{
return substr($value,5,5);
}
$_SESSION['admin_pin_value']=md5(rand(2,99999999));
$encodedPin =generatePin($_SESSION['admin_pin_value']);
## create an image not a text for the pin
$font = 6;
$width = ImageFontWidth($font) * strlen($encodedPin);
$height = ImageFontHeight($font);
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 199, 198, 198); //cell background
$text_color = imagecolorallocate ($im, 0, 0, 0);//text color
imagestring ($im, $font, 0, 0, $encodedPin, $text_color);
imagejpeg($im,"tmp/tmp_pin_".$_SESSION['admin_pin_value'].".jpg");
echo "";
imagedestroy($im);
?>
|