home *** CD-ROM | disk | FTP | other *** search
- <?php
- $passLenght = 6;
- $background = 'bg.png';
- $fontLoc = 'font.ttf';
-
- $c = mysql_connect('localhost', 'user', 'haslo');
- mysql_select_db('nazwa_bazy', $c);
-
- if(!@ereg("[a-z0-9]{32}", $_GET['hash']))
- exit();
- $password = mysql_result(mysql_query('SELECT code FROM mi_secimg WHERE hash="'.$_GET['hash'].'"'), 0);
- if(strlen($password) != $passLenght)
- exit();
-
- header('content-type: image/png');
- $i = imagecreatefrompng($background);
- $color = imagecolorallocate($i, 255, 8, 8);
- $box = imagettfbbox (16, 3, $fontLoc, $password);
- imagettftext($i, 16, 3, (imagesx($i)-$box[2]+$box[0])/2, (imagesy($i)-$box[7]+$box[1])/2, $color, $fontLoc, $password);
- imagepng($i);
- ?>