ÿØÿà JFIF ` ` ÿþ
|
Server : Apache/2.4.58 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.13 System : Linux cpanel4.trivietit.net 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64 User : cungcapmhutbui ( 1010) PHP Version : 5.6.40-86+ubuntu24.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen Directory : /home/cungcapmhutbui/web/cungcapmayhutbui.com/public_html/captcha/ |
Upload File : |
<?php
define('PATH',realpath(dirname(__FILE__)));
class AuthImage {
var $length;
var $background;
var $code;
function AuthImage($length=6) {
if(!session_id()) session_start();
$this->length=$length;
$this->background=PATH."/backgrounds/rain.gif";
if(isset($_SESSION['captcha'])) {
$this->code = $_SESSION['captcha'];
} else {
$_SESSION['captcha'] = $this->generateCode($this->length);
$this->code = $_SESSION['captcha'];
}
}
function renewCode() {
$_SESSION['captcha'] = $this->generateCode($this->length);
$this->code = $_SESSION['captcha'];
}
function showImage() {
header("Content-type: image/gif");
$image = @imagecreatefromgif($this->background) or die("Cannot Initialize new GD image stream");
$textColor = imageColorAllocate($image, 0x00, 0x00, 0x00);
ImageString($image, 5, 7, 2, $this->code, $textColor);
ImageGif($image);
ImageDestroy($image);
}
function generateCode() {
$str = "";
for ($i = 0; $i < $this->length; $i++) {
$a = rand(1,3);
switch($a) {
case 1:
// this numbers refer to numbers of the ascii table (small-caps)
$str .= chr(rand(97, 122));
break;
case 2:
// this numbers refer to numbers of the ascii table (upper-caps)
$str .= chr(rand(65, 90));
break;
case 3:
// number
$str .= rand(1,9);
break;
}
}
return $str;
}
}
?>