Guestbook

More
17 years 4 months ago #710 by ronniej
Guestbook was created by ronniej
Hi,
If wrong image verification code is entered, the following error message appears.

Wrong Image Verification Code Entered!
Please go back and enter it again.

My question is: When I go back to enter a new code, the message that I have written disappears. How can I avoid that?

Best regards
Ronnie Johansson

Please Log in or Create an account to join the conversation.

More
17 years 4 months ago #712 by Pete
Replied by Pete on topic Guestbook
Hello Ronnie,

This behavior is by design, in order to make it more difficult for spammer(s) to post spam. To change this behavior, all you would have to do is to assign the value of submitted textboxes in "add.php" to session variables, and set the "value" property of form elements in "guestbook.php" to those values.

Let me know if you require further detail / code and I will be happy to post it for you.

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
17 years 4 months ago #713 by ronniej
Replied by ronniej on topic Guestbook
Hello Pete,

Thanks for your reply, and yes, I'd appreciate very much if you could please give me further details and code.

Best regards
Ronnie

Please Log in or Create an account to join the conversation.

More
17 years 4 months ago #720 by Pete
Replied by Pete on topic Guestbook

ronniej wrote: Hello Pete,

Thanks for your reply, and yes, I'd appreciate very much if you could please give me further details and code.

Best regards
Ronnie


Hello again Ronnie, and sorry for the delayed response (been really busy this past few days). Here is the actual code change for your request:

Open file "guestbook.php":

Replace your existing line 76 to 116 with this:
Code:
<br> <form name="post" action="add.php" method="post"> <table border="0" cellpadding="0" cellspacing="2"> <tr> <td> <p><b><font size="2"><?php echo $yournametxt; ?></font></b></p> </td> <td><input type="text" name="yourname" size="20" value="<? echo $_SESSION['a1']; ?>"></td> </tr> <tr> <td> <p><b><font size="2"><?php echo $youremailtxt; ?></font></b></p> </td> <td><input type="text" name="youremail" size="20" value="<? echo $_SESSION['a2']; ?>"></td> </tr> <?php if($image_verify == 1) { echo '<tr><td><p><b><font size="2">Verify:</font></b></p></td><td><input type="text" name="txtNumber" size="20" value=""><img src="random.php"></td></tr>'; } ?> <tr> <td> <p><b><font size="2"><?php echo $yourMessagetxt; ?></font></b></p> </td> <td> <div align="right"> <textarea name="yourmessage" cols="45" rows="10"><? echo $_SESSION['a3']; ?></textarea></div> </td> </tr> <tr> <td></td> <td> <div align="right"> <input type="submit" name="ok" value="<?php echo $submitbutton; ?>"> </td> </tr> </table> </form> </td></tr></table><!-- End of toolbar table -->

Then open the file "add.php" and replace your existing line 9 to 24 with this:
Code:
if($image_verify == 1) { $number = $_POST['txtNumber']; if (md5($number) == $_SESSION['image_random_value']) { // echo "Nice Job"; } else { include("header.php"); echo "<br><br><font color=red><center>Wrong Image Verification Code Entered!<br>Please go back and enter it again.</center></font><br><br>"; include("footer.php"); $_SESSION['a1'] = $_POST['yourname']; $_SESSION['a2'] = $_POST['youremail']; $_SESSION['a3'] = $_POST['yourmessage']; exit; } }

This will help keep the entered text in memory if the user enters the wrong image verification.

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds
Powered by Kunena Forum