Jump to content

image verification


lordphate

Recommended Posts

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]<?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);
?>[/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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.