my.php驗証成功會轉到ok.php,失敗會到yahoo,但是未輸入驗証碼直接按送出,竟然都轉到ok.php!!!!嗚~~~~搞了四個小時找不出原因~~~~好鬱卒!!!! 拜託老師Orz拜託~~~~ 程式碼如下: <?php //啟動 Session if (!isset($_SESSION)) { session_start(); } //若表單送出時即先檢查驗證碼 if(isset($_POST['security_code'])){ if(($_SESSION['security_code'] != $_POST['security_code'])||(empty($_SESSION['security_code']))){ header("Location: http://tw.yahoo.com/?auth=false"); break; } } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無標題文件</title> <script language="JavaScript" type="text/javascript"> //更換驗證碼圖片 function RefreshImage(valImageId) { var objImage = document.images[valImageId]; if (objImage == undefined) { return; } var now = new Date(); objImage.src = objImage.src.split('?')[0] + '?width=100&height=40&characters=5&s=' + new Date().getTime(); } </script> </head>
<body> <form id="form1" name="form1" method="post" action="ok.php"> <p>請輸入姓名: <input name="textfield1" type="text" id="textfield" size="15"/> <br> <img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" name="imgCaptcha" id="imgCaptcha" /><a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')" style="font-size:9pt">更換圖片<br /> </a> <input name="security_code" type="text" id="security_code" value="請輸入上方驗證碼" maxlength="10" onfocus="this.value=''" /> <br> <input type="submit" name="button" id="button" value="送出" /> </form> </body> </html>
|