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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.