_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); } } ?> Ís-Forsa - Samtök um rannsóknir í félagsráðgjöf - isforsa.net

Steinunn Bergmann

http://www.isforsa.net/

Ís-Forsa - Samtök um rannsóknir í félagsráðgjöf - er félag þeirra sem vilja styðja við og efla rannsóknir í félagsráðgjöf. Ís-Forsa var stofnað í apríl 2002.

Efni

Hva er GSM nmeri itt?




ryggiski

Upp aftur

Vinstri hli

Leturstrir

Upp aftur

Pstlisti




ryggiski

Rannsóknarstofnun í barna og fjölskylduvernd
Samtök félagsmálastjóra í Evrópu (ESN)
NSWR

Heimsknir

115 heimsóknir í dag og 369681 samtals
218 flettingar í dag og 414986 samtals

Vefurinn fr lofti 29.03.2007

Upp aftur