session_start(); $security_number = rand(1000,9999); $md5 = md5($security_number); $k = MakeImage($security_number); function MakeImage($rand) { $width = 70; $height = 30; $image = imagecreate($width, $height); $bgColor = imagecolorallocate ($image, 0, 0, 0); //#000000 $textColor = imagecolorallocate ($image, 255, 255, 255); //#ffffff $noise = 10; // Add Random noise for ($i = 0; $i < $noise; $i++) { $rx1 = rand(0,$width); $rx2 = rand(0,$width); $ry1 = rand(0,$height); $ry2 = rand(0,$height); $rcVal = rand(0,255); $rc1 = imagecolorallocate($image, rand(0,255), rand(0,255), rand(100,255)); imageline ($image, $rx1, $ry1, $rx2, $ry2, $rc1); } imagestring($image, 5, rand(2,20), rand(2,15), $rand, $textColor); //@header('Content-type: image/png'); imagepng($image,"images/s.png"); imagedestroy($image); } ?>