PHP Code:
ob_start();
session_start();
$chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J",
"k","K","L","m","M","n","N","o","p","P","q","Q","r","R","s","S","t","T",
"u","U","v","V","w","W","x","X","y","Y","z","Z","2","3","4","5","6","7","8","9");
$textstr = '';
for ($i = 0, $length = 6; $i < $length; $i++) {
$textstr .= $chars[rand(0, count($chars) - 1)];
}
$hashtext = md5($textstr);
$_SESSION['strSec'] = $hashtext;
# custom image
header("Content-type: image/jpeg");
$im = @imagecreatetruecolor(70, 30)
or die("Cannot Initialize new GD image stream");
# custom image
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 255, 255, 204);
imagestring($im, 25, 7, 7, $textstr, $text_color);
imagejpeg($im);
ob_end_flush();
You can tweak it as needed to include a custom background and many other aspects and elements.
Bookmarks