Changeset 10450 for temp/trunk/html/test
- Timestamp:
- 2006/12/08 12:21:42 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
temp/trunk/html/test/uehara/captcha/ajax_captcha/captcha.php
r10447 r10450 1 1 <? 2 /* 3 This is the back-end PHP file for the How to Create CAPTCHA Protection using PHP and AJAX Tutorial 4 5 You may use this code in your own projects as long as this 6 copyright is left in place. All code is provided AS-IS. 7 This code is distributed in the hope that it will be useful, 8 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 11 For the rest of the code visit http://www.WebCheatSheet.com 12 13 Copyright 2006 WebCheatSheet.com 14 */ 15 16 //Continue the session 2 // ¥»¥Ã¥·¥ç¥ó¥¹¥¿¡¼¥È 17 3 session_start(); 18 4 19 // Make sure that the input come from a posted form. Otherwise quit immediately20 if ($_SERVER["REQUEST_METHOD"] <> "POST") 21 die("You can only reach this page by posting from the html form");5 // ÆþÎÏÃͤò¼õ¤±¼è¤ë 6 $input_data = $_POST["input_data"]; 7 $session_data = $_SESSION["security_code"]; 22 8 23 //Check if the securidy code and the session value are not blank 24 //and if the input text matches the stored text 25 if ( ($_REQUEST["txtCaptcha"] == $_SESSION["security_code"]) && 26 (!empty($_REQUEST["txtCaptcha"]) && !empty($_SESSION["security_code"])) ) { 27 echo "<h1>Test successful!</h1>"; 9 // POST¥Ç¡¼¥¿¤Î¤ß¼õ¤±ÉÕ¤±¤ë 10 if ($input_data == "") { 11 echo "FORM¤«¤éÆþÎϤ·¤Æ²¼¤µ¤¤¡£"; 12 exit; 13 } 14 // ¥»¥Ã¥·¥ç¥ó¤ÎÃͤ¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯ 15 if (($input_data == $session_data) && ($input_data != "" && $session_data != "")) { 16 echo "ǧ¾ÚÀ®¸ù¡ª¡ª"; 28 17 } else { 29 echo "<h1>Test failed! Try again!</h1>";18 echo "ǧ¾Ú¼ºÇÔ¡ª¡ª"; 30 19 } 31 20 ?>
Note: See TracChangeset
for help on using the changeset viewer.
