_w = $width; $this->_h = $height; $this->ttf_font = $font; $this->image = imagecreate($this->_w, $this->_h); if($_SESSION['verification_key']) $this->char_count = strlen($_SESSION['verification_key']); } // sets the bgcolor function set_bgcolor($r,$g,$b) { $this->bg_color = imagecolorallocate($this->image, $r, $g, $b); } // sets the textcolor function set_textcolor($r,$g,$b) { $this->text_color = imagecolorallocate($this->image, $r, $g, $b); } // sets the fontsize function set_fontsize($s) { $this->font_size = $s; } // sets the number of chars function set_charcount($c) { $this->char_count = $c; } // draws the string function draw() { $code = $this->generate_code(); // register the code in the session $this->register_code($code); // offsets for x and y in the image $x = 1; $y = $this->font_size; // walk through each character in the // code, to print it for($i = 0; $i < strlen($code); $i++) { $calc_y = rand(10*$y,250) / 10; //imagestring( $this->image, 3, $x, $calc_y, $code{$i}, $this->text_color); $angle = rand(-20,20); $this->write_string($x, $calc_y, $angle, $code{$i}); $x += rand(17,19) ; } } function write_string($x_offset, $y_offset, $angle, $string) { // check if a font is set if($this->ttf_font != "") { // does the file font exist on the server if(file_exists($this->ttf_font)) { putenv('GDFONTPATH=' . realpath('.')); $grey = imagecolorallocate($this->image, 128, 128, 128); // draw a shadow imagettftext($this->image, $this->font_size, $angle, $x_offset + 1, $y_offset + 1, $grey, $this->ttf_font, $string); // draw the text imagettftext($this->image, $this->font_size, $angle, $x_offset, $y_offset, $this->text_color, $this->ttf_font, $string); } else { die("Font doesn't exist, or not in same directory as a .ttf"); } } else { die("No font set."); } } // generates a time based random code // offset is the minutes to be added function generate_code() { // define the seed out of which characters the seed will be constructed $string = md5(rand(0,9999).time()); $output = substr($string, rand(0, 32-$this->char_count), $this->char_count); return $output; } // returns the code that is registered // in the session function get_registered_code() { return $_SESSION['verification_key']; } // sets the code, this will be registered as // the code in the session function register_code($c) { $_SESSION['verification_key'] = $c; } // checks if the code is valid function validate_code($code) { return (strlen($code) == $this->char_count && $code == $this->get_registered_code()); } // output it to screen function _output() { if(!$this->bg_color) $this->set_bgcolor(255,255,255); if(!$this->bg_color) $this->set_bgcolor(255,34,91); // draw the image $this->draw(); header("Content-type: image/png"); imagepng($this->image); // destroy the image to free resources imagedestroy($this->image); } } ?> Pedromyndir

Pedromyndir ehf.

https://www2.pedro.is/

Pedromyndir @ Akureyri

Efni

Hvağ er GSM númeriğ şitt?




Öryggiskóği

Upp aftur

Vinstri hliğ

Leturstærğir

Upp aftur
Upp aftur