Verify script.
Posted: Wed May 31, 2006 7:25 am
Strange.
If no code is entered you get the error message...ok, fine. If random numbers are entered it some how bypasses the error message.
This is bugging me...
Dir:
module/GuestBook/index.php:
Form that displays the head.php number/image(code) with a text field for that code
Dir:
module/GuestBook/head.php:
Generates the code/image
Dir:
module/GuestBookVerify/index.php:
Requests and verifies code, if correct displays "HIDDEN DATA" else "WRONG CODE ERROR MESSAGE"... well, supposed too...
I tried swapping things about, no avail. Even tried having two "=", no good. Also tried swapping the "=" for a "->", it gave me a "WRONG CODE ERROR MESSAGE" no matter what...
As you can see, with a ratio of 1 to 100, my php skills rate closely around the mark of 1...
Any clues?...I must be close...
I will provide a link to an example if requested.
If no code is entered you get the error message...ok, fine. If random numbers are entered it some how bypasses the error message.
This is bugging me...
Dir:
module/GuestBook/index.php:
Form that displays the head.php number/image(code) with a text field for that code
Code: Select all
<form method="post" action="/modules/GuestBookVerify/index.php">
<?php $die=rand(1,10000); ?>
<img src="modules/GuestBook/head.php?text=<?php echo($die); ?>" /><br />
Please enter the number in the above picture<br>
<input name="code" type="text" /><br />
<input type="hidden" name="coder" value="<?php echo($die); ?>">
<input type="submit" value="Verify" />
</form>Dir:
module/GuestBook/head.php:
Generates the code/image
Code: Select all
<?php
header ("Content-type: image/png");
$string=$_GET['text'];
$img_handle = ImageCreate (45, 20) or die ("Cannot Create image");
$back_color = ImageColorAllocate ($img_handle, 255, 255, 255);
$txt_color = ImageColorAllocate ($img_handle, 345, 23, 6);
ImageString ($img_handle, 31, 5, 5, $string, $txt_color);
ImagePng ($img_handle);
?>Dir:
module/GuestBookVerify/index.php:
Requests and verifies code, if correct displays "HIDDEN DATA" else "WRONG CODE ERROR MESSAGE"... well, supposed too...
Code: Select all
<?php
$code = $_REQUEST['coder'];
$inp = $_REQUEST['code'];
if ($code=$inp) /*<- see below*/
{
echo(" HIDDEN DATA ");
}
else
{
echo(" WRONG CODE ERROR MESSAGE ");
}
?>As you can see, with a ratio of 1 to 100, my php skills rate closely around the mark of 1...
Any clues?...I must be close...
I will provide a link to an example if requested.