Hallo,
Ich habe ein Syntax Error in meiner Klasse verstehe diesen aber kein bisschen.
Error:
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in C:\xampp\htdocs\encarnium\includes\classes\captcha .php on line 42
Code:
PHP-Code:
<?php
session_start();
unset($_SESSION['captcha_spam']);
header('Content-type: image/png');
/**
* Bitte am Anfang des Verwender Code´s header('Content-type: image/png'); einfügen.
* Oder bevor der ersten Ausgabe
*/
class createCaptcha {
private $usec;
private $sec;
private $possible;
private $str;
private $text;
private $img;
private $color;
private $ttf;
private $ttfsize;
private $angle;
private $t_x;
private $t_y;
function randomString($len) {
function make_seed(){
list($this -> usec , $this -> sec) = explode (' ', microtime());
return (float) $this -> sec + ((float) $this -> usec * 100000);
}
srand(make_seed());
//Der String $possible enthält alle Zeichen, die verwendet werden sollen
$this -> possible="ABCDEFGHJKLMNPRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789";
$this -> str="";
while(strlen($this -> str)<$len) {
$this -> str.=substr($this -> possible,(rand()%(strlen($this -> possible))),1);
}
return($this -> str);
}
$this -> text = randomString(5); //Die Zahl bestimmt die Anzahl stellen
$_SESSION['captcha_spam'] = $this -> text;
$this -> img = ImageCreateFromPNG('./captcha-Data/captcha.PNG'); //Backgroundimage
$this -> color = ImageColorAllocate($img, 255, 255, 255); //Farbe
$this -> ttf = "./captcha-Data/XFILES.TTF"; //Schriftart
$this -> ttfsize = 25; //Schriftgrösse
$this -> angle = rand(0,5);
$this -> t_x = rand(5,30);
$this -> t_y = 35;
imagettftext($this -> img, $this -> ttfsize, $this -> angle, $this -> t_x, $this -> t_y, $this -> color, $this -> ttf, $this -> text);
imagepng($this -> img);
imagedestroy($this -> img);
}
?>