<?php
@error_reporting(0);
@ini_set("session.bug_compat_42","1");
@ini_set("session.gc_divisor","100");
function ponDigitoEnSession($d)
{
$dddd = $d."";
$_SESSION['digit'] = $dddd;
}
$inc=$inc+1;
$image = imagecreate(120, 30);
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x50, 0x50, 0x50);
srand((double)microtime()*1000000);
for ($i = 0; $i < 30; $i++) {
$x1 = rand(0,120);
$y1 = rand(0,30);
$x2 = rand(0,120);
$y2 = rand(0,30);
imageline($image, $x1, $y1, $x2, $y2 , $gray);
}
for ($i = 0; $i < 5; $i++) {
$a=rand(0,1);
/*if ($a==0) {
$cnum[$i] = chr(rand(65,90));
}else{*/
$cnum[$i] = chr(rand(97,122));
//}
}
for ($i = 0; $i < 5; $i++) {
$fnt = rand(5,7);
$x = $x + rand(12 , 20);
$y = rand(7 , 12);
imagestring($image, $fnt, $x, $y, $cnum[$i] , $darkgray);
$digit=$digit.$cnum[$i];
}
session_start();
ponDigitoEnSession($digit);
$_SESSION['inc'] = $inc;
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>