Guestbook Validation
Alright, I had made a guestbook, made it safe with filters and such, but I want to make it so you have to validate your post so no one can spam it with cURL. Soooo, my basic idea is, Generate a random number that a person has to enter, then if it isn't the correct number, then it never gets posted. I'm aware of how to generate random numbers, but not exactly sure how to get it to go through the next page. If anyone has any ideas or wants to help or something, just post your ideas. Thanks in advance.
Alright, it would be better with the images, BUT, I'm not quite sure how to transfer whatever the number is to the other site that registers it. Hmm, I think the way I'm thinking of it is a bit complicated, hmm. Like, let me give you an example. A random number is generated taht shows an image with this in it: x5yy22, so after that, you enter it in and go to the next site, but how would you check what that number is? I was thinking of putting in that number letter combination into a hidden input field. But not sure how I would do that, :-\. Not sure if I'm still wording this right.
If you did it with numbers and not letters, you could make it like this:
$_SESSION['num'] = rand();
$num = $_SESSION['num'];
echo '<img src="img.php?num='.$num.'">;
and then have img.php do something with $_GET['num'], like 2-43*3 and that's the number it puts on the image.
The page that does the actual posting can then check to see if:
if($_SESSION['num']*2-4*3*3 == $_POST['validation_num'])
{
do_guestbok_post();
}
Hope that makes sense
mastergamer wrote: If you did it with numbers and not letters, you could make it like this:
$_SESSION['num'] = rand();
$num = $_SESSION['num'];
echo '<img src="img.php?num='.$num.'">;
and then have img.php do something with $_GET['num'], like 2-43*3 and that's the number it puts on the image.
The page that does the actual posting can then check to see if:
if($_SESSION['num']*2-4*3*3 == $_POST['validation_num'])
{
do_guestbok_post();
}
Hope that makes sense
The major flaw in here is that any bot could find the GET query. Perhaps something like use of the GD library?