ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkewebvumi.com/ |
<?php //Start the session so we can store what the security code actually is session_start(); //Send a generated image to the browser create_image(); exit(); function create_image() { //Let's generate a totally random string using md5 $md5_hash = md5(rand(0,999)); //We don't need a 32 character long string so we trim it down to 5 $security_code = substr($md5_hash, 15, 3); //Set the session to store the security code $_SESSION["security_code"] = $security_code; //Set the image width and height $im = imagecreate(80, 25); //white background and blue text $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 128, 0, 0); //Add randomly generated string in white to the image imagestring($im, 5, 20, 8, $security_code, $textcolor); //Tell the browser what kind of file is come in header("Content-Type: image/jpeg"); //Output the newly created image in jpeg format imagejpeg($im); //Free up resources imagedestroy($im); } ?>