Guest User

Untitled

a guest
Jul 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php session_start(); ?>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  4. "DTD/xhtml1-transitional.dtd">
  5. <html>
  6. <head>
  7. <title>Captcha demo</title>
  8. </head>
  9. <body>
  10. <?php
  11. if (isset($_POST['submitBtn'])){
  12. $secCode = isset($_POST['secCode']) ? strtolower($_POST['secCode']) : "";
  13. if ($secCode == $_SESSION['securityCode']) {
  14. echo "<p>The result code was valid!<br/></p>";
  15. unset($_SESSION['securityCode']);
  16. $result = true;
  17. }
  18. else {
  19. echo "<p>Sorry the security code is invalid! Please try it again!</p>";
  20. $result = false;
  21. }
  22. }
  23.  
  24. if ((!isset($_POST['submitBtn'])) || (!$result)){
  25. ?>
  26. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
  27. <table width="400">
  28. <tr>
  29. <td>Security code:
  30. <input class="text" name="secCode" type="text" size="10" />
  31. </td>
  32. <td>
  33. <img src="securityCode.php" alt="security code" border="1" />
  34. </td>
  35. </tr>
  36. <tr>
  37. <td colspan="2" align="center"><br/>
  38. <input class="text" type="submit" name="submitBtn" value="Send" />
  39. </td>
  40. </tr>
  41. </table>
  42. </form>
  43. <?php
  44. }
  45. ?>
  46. </body>
Add Comment
Please, Sign In to add comment