lordphate Posted August 20, 2006 Share Posted August 20, 2006 hello, I was having trouble with image verifications. I'm pretty sure my code is correct but JUST in case here it is [code]<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>[/code] that's for the page that needs verified now here's ver.php [code]<?phpfunction 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);?>[/code] 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? Link to comment https://forums.phpfreaks.com/topic/18097-image-verification/ Share on other sites More sharing options...
lordphate Posted August 20, 2006 Author Share Posted August 20, 2006 any have any ideas? here s the page http://www.programeddl.com/admin/admincp.php Link to comment https://forums.phpfreaks.com/topic/18097-image-verification/#findComment-77576 Share on other sites More sharing options...
Barand Posted August 20, 2006 Share Posted August 20, 2006 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? Link to comment https://forums.phpfreaks.com/topic/18097-image-verification/#findComment-77668 Share on other sites More sharing options...
lordphate Posted August 20, 2006 Author Share Posted August 20, 2006 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? Link to comment https://forums.phpfreaks.com/topic/18097-image-verification/#findComment-77713 Share on other sites More sharing options...
Barand Posted August 20, 2006 Share Posted August 20, 2006 In php.ini file check the path to your extensions folder[code]extension_dir = path/to/extensions[/code]and make sure "php_gd2.dll" ( or .so if linux) is in the folder.Also in php.ini find the line[code];extension=php_gd2.dll[/code]and remove the ";" from beginning Link to comment https://forums.phpfreaks.com/topic/18097-image-verification/#findComment-77722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.