Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title>Captcha demo</title>
- </head>
- <body>
- <?php
- if (isset($_POST['submitBtn'])){
- $secCode = isset($_POST['secCode']) ? strtolower($_POST['secCode']) : "";
- if ($secCode == $_SESSION['securityCode']) {
- echo "<p>The result code was valid!<br/></p>";
- unset($_SESSION['securityCode']);
- $result = true;
- }
- else {
- echo "<p>Sorry the security code is invalid! Please try it again!</p>";
- $result = false;
- }
- }
- if ((!isset($_POST['submitBtn'])) || (!$result)){
- ?>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
- <table width="400">
- <tr>
- <td>Security code:
- <input class="text" name="secCode" type="text" size="10" />
- </td>
- <td>
- <img src="securityCode.php" alt="security code" border="1" />
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center"><br/>
- <input class="text" type="submit" name="submitBtn" value="Send" />
- </td>
- </tr>
- </table>
- </form>
- <?php
- }
- ?>
- </body>
Add Comment
Please, Sign In to add comment