rjcfan4ever Posted July 27, 2011 Share Posted July 27, 2011 I'd wanna delete the security code of my guestbook script but I don't know exactly what to delete, can you maybe help me? Here is the script: <?php session_start(); if( isset($_POST['submit'])) { if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. echo 'Thank you. Your message said "'.$_POST['message'].'"'; unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here echo 'Sorry, you have provided an invalid security code'; } } else { ?> <h1>Guestbook with Captcha</h1> <form action="form.php" method="post"> <table> <tr> <td>Name</td><td> <input type="text" name="name" id="name" /></td> </tr> <tr> <td>Email</td><td> <input type="text" name="email" id="email" /></td> </tr> <tr> <td valign="top">Message</td><td> <textarea rows="5" cols="30" name="message" id="message"></textarea></td> </tr> <tr> </tr> <tr> <td><td valign="top">Security Code</td><td> <img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br /> <input id="security_code" name="security_code" type="text" /> </td></td><td> <input type="submit" name="submit" value="Submit" /> </td> </tr> </table> </form> <?php } ?> Quote Link to comment Share on other sites More sharing options...
TOA Posted July 27, 2011 Share Posted July 27, 2011 You would want to remove the input on the form, and remove the if/else that checks for the security code when processing. Quote Link to comment Share on other sites More sharing options...
rjcfan4ever Posted July 27, 2011 Author Share Posted July 27, 2011 So what to delete? So but i am afraid to delete something difference Quote Link to comment Share on other sites More sharing options...
TOA Posted July 27, 2011 Share Posted July 27, 2011 Try this. I didn't test it though. Just removed the parts I mentioned in my previous post <?php session_start(); if( isset($_POST['submit'])) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. echo 'Thank you. Your message said "'.$_POST['message'].'"'; } else { ?> <h1>Guestbook with Captcha</h1> <form action="form.php" method="post"> <table> <tr> <td>Name</td><td> <input type="text" name="name" id="name" /></td> </tr> <tr> <td>Email</td><td> <input type="text" name="email" id="email" /></td> </tr> <tr> <td valign="top">Message</td><td> <textarea rows="5" cols="30" name="message" id="message"></textarea></td> </tr> <tr> </tr> <tr> <td <input type="submit" name="submit" value="Submit" /> </td> </tr> </table> </form> <?php } ?> Quote Link to comment Share on other sites More sharing options...
rjcfan4ever Posted July 27, 2011 Author Share Posted July 27, 2011 Okey thank you Quote Link to comment Share on other sites More sharing options...
TOA Posted July 27, 2011 Share Posted July 27, 2011 No problem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.