Вход Регистрация
Файл: Script/includes/captcha.php
Строк: 63
<?php
// Set the header
header("Content-type: image/jpeg");

// Start the session
session_start();

// Generate the 6 digits random string
$text mt_rand(100000999999);

// Explode the letters into separate array elements
$letters str_split($text);

// Store the generated code into the _SESSION captcha
$_SESSION['captcha'] = $text;
 
// Define the Image Height & Width
$width 75;
$height 37;  

// Create the Image
$image imagecreate($width$height); 

// Set the background color
$black imagecolorallocate($image8818022);
// Set the text color
$white imagecolorallocate($image255255255);

// Set the font size
$font_size 1

// Draw background circles
for($i 0$i 1$i++) {
    
// The outside circle diameter
    
$outside 60-$i*20;

    
// The inside circle diamater
    
$inside 59-$i*20;

    
// Randomize the horizontal position and vertical position
    
$oc = array(mt_rand(3040), mt_rand(1020));

    
// Draw the outer circle
    
imagefilledellipse($image$oc[0], $oc[1], $outside$outside$white);
    
    
// Draw the inner circle
    
imagefilledellipse($image$oc[0], $oc[1], $inside$inside$black);
}

// Generate noise
for($noise 0$noise <= 15$noise++) {
    
$x mt_rand(10$width-10);
    
$y mt_rand(10$height-10);
    
imageline($image$x$y$x$y$white);
}

// Letter position
$position = array(81828384858);

for(
$i 0$i count($letters); $i++) {
    
// Generate an rgb random value, from light gray to white
    
$color rand(220255);
    
    
// Output the letters
    
imagestring($image5$position[$i], mt_rand(911), $letters[$i], imagecolorallocate($image$color$color$color));
}

// Generate random vertical and horizontal lines
imageline($image0mt_rand(10$height-10), $widthmt_rand(10$height-10), $white);
imageline($imagemt_rand(15$width-15), 00mt_rand(15$width-15), $white);

// Output the $image, don't save the file name, set quality
imagejpeg($imagenull100); 
?>
Онлайн: 1
Реклама