VeroneK -
Joined: 14 Jun 2008 Posts: 1
|
Posted: Sat Jun 14, 2008 8:43 am Post subject: Captcha problem. No image :( |
|
|
Hello. Im new user of Abyss Web Server.
I have my own Private server to game. And I'm using register script.
I installed PHP on Abyss Web Server, and put my scripts into htdocs. But when I'm opening script, there is no CAPTCHA image :(
Quote: | <?php
class Captcha
{
private $font = 'arial.ttf';
function generateCode($characters) {
$possible = '23456789bcdfghjkmnpqrstvwxyz';
$code = '';
for($i=0;$i<$characters;$i++) {
$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
}
return $code;
}
function __construct($width='120',$height='40',$characters='6') {
$code = $this->generateCode($characters);
$_SESSION['captcha'] = $code;
$font_size = $height * 0.60;
$image = imagecreate($width, $height);
$background_color = imagecolorallocate($image, 0, 0, 0);
$text_color = imagecolorallocate($image, 255, 255, 80);
$noise_color = imagecolorallocate($image, 255, 100, 80);
for($i=0; $i<($width*$height)/3;$i++) {
imagefilledellipse($image,mt_rand(0,$width)
,mt_rand(0,$height)
,1,1
,$noise_color);
}
for($i=0;$i<($width*$height)/150;$i++) {
imageline($image,mt_rand(0,$width)
,mt_rand(0,$height)
,mt_rand(0,$width)
,mt_rand(0,$height)
,$noise_color);
}
$textbox = imagettfbbox($font_size, 0, $this->font, $code);
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code);
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
}
}
?> |
This is that Captcha.
And site:
https://91.121.75.11:50004/
I tried on IE, Mozilla, Opera... No working.
When I'm trying open it (Righ Mouse -> Show Image):
Quote: | Fatal error: Call to undefined function imagecreate() in C:\Abyss Web Server\htdocs\Captcha.php on line 20 |
On XAMPP, or other Apatche service, everything was good.
Can anyone help me?
And sorry for my bad english. I hope you understand me :) |
|