Jump to content


Photo

image verification


  • Please log in to reply
4 replies to this topic

#1 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 20 August 2006 - 01:22 PM

hello, I was having trouble with image verifications. I'm pretty sure my code is correct but JUST in case here it is
<tr>

            <td width="50%"><p align="right">Username: </p></td>

            <td><input name="username" class="FacetInput" id="username" maxlength="20"></td>

          </tr>

          <tr align="right">

            <td>Password: </td>

            <td align="left"><input name="password" type="password" class="FacetInput" id="password" maxlength="25"></td>

          </tr>

          <tr>

            <td></td>

            <td><img src="ver.php" alt="security image" border="0"/></td>

          </tr>

          <tr>

            <td><p align="right">Verification: </p></td>

            <td><input name="answer" class="FacetInput" id="answer" maxlength="8"></td>

          </tr>
that's for the page that needs verified now here's ver.php
<?php
function randstr($length, $hash = "abcdefghijklmnopqrstuvwxyz0123456789") {
    $strlength = strlen($hash);
    $string = "";
    for($i = 0; $i < $length; $i++) {
                $random = rand(0, $strlength) - 1;
            $string .= substr($hash, $random, 1);
    }
    return $string;
}
$string = randstr(5);
setcookie("hash", md5($string), time()+3600);
$width = 100;
$height = 35;
$imgTXT = $string;
$hTXT = rand(25,25); 
$wTXT = rand(10,30);
$angleTXT = rand(-25, 25);
$sizeTXT = 13;
$imgCreate = ImageCreate($width, $height);
$imgBg = ImageColorAllocate($imgCreate, 0, 0, 0);
$imgFg = ImageColorAllocate($imgCreate, 255, 255, 255);
ImageFill($imgCreate, 1, 1, $imgBg); 
Imagettftext($imgCreate,$sizeTXT,$angleTXT,$wTXT,$hTXT,$imgFg,'font/tahoma.ttf',$string) or die ("Please refresh");
header('Content-type: image/png');
ImagePNG($imgCreate);
ImageDestroy($imgCreate);
?>

What it's doing is:
Its just showing up as no image...it has an image holder(in opera) saying 'security image" or what ever...but no picture...any suggestions?

#2 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 20 August 2006 - 03:16 PM

any have any ideas? here s the page http://www.programed...min/admincp.php


#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 20 August 2006 - 06:02 PM

It seems fine to me, except for most of last character sometimes being lost off the edge on downward sloping images.

Is ver.php in same folder as the form script?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#4 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 20 August 2006 - 08:12 PM

Yes in the same, i did a GD LIbrary Test and it failed i don't have it installed...how would i got about instaling it?

#5 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 20 August 2006 - 08:22 PM

In php.ini file check the path to your extensions folder

extension_dir = path/to/extensions

and make sure "php_gd2.dll" ( or .so if linux) is in the folder.


Also in php.ini find the line
;extension=php_gd2.dll

and remove the ";" from beginning
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users