Re: [問題]$_SERVER["PHP_SELF"]?
※ 引述《buganini (霸格尼尼)》之銘言:
: ※ 引述《yorjing (托兒所嬰兒)》之銘言:
: : 請問一下各位大大
: : $_SERVER["PHP_SELF"]這要怎麼用?
: : 小弟今天無聊爬一下文
: : 發現了驗證碼
: : 抓來跑一跑
: : 圖跟文字都有了
: : 可是要驗證我輸入的文字正不正確時
: : 他居然跑出"未授權您檢視此網頁"的訊息
: : 看了一下程式碼
: : 好像問題出現在$_SERVER["PHP_SELF"]
: : 看一看上下文程式碼
: : 再看了一下結果
: : 推敲出他是跑到自己的網頁
: : 可是驗証程式碼時
: : 居然跳到"未授權您檢視此網頁"XD
: : 更奇怪的是
: : 在按驗證紐後
: : 火狐跟ie網址列網址不一樣
: : 火狐:http://localhost/files/%3C?=$_SERVER['PHP_SELF']?%3E
: : IE:http://localhost/files/<?=$_SERVER['PHP_SELF']?>
: : 程式在這
: : http://www.devshed.com/c/a/PHP/Security-Images-in-PHP/5/
: : 在兩個執行結果圖案的上面
: : 如果我推敲的沒錯的話
: : 按了"Sign up!"之後應該要執行
: : 最下面的表單的上面那一段php程式碼
: : 可是他卻沒有執行
: : 而是跳到"未授權您檢視此網頁"
: : 可以請各位大大指導一下小弟一下嗎
: : 小弟不知道怎麼改這個bug
: : 先在這裡謝謝各位大大
: 你的PHP parser沒有被呼叫到
: 確認你的php.ini裡面
: short_open_tag = On
謝謝B大的幫忙
小弟已經不會跑到"未授權你檢視網頁"
可是
他沒有跑下面這段
<?php
if (isset($HTTP_POST_VARS["name"]) && isset($HTTP_POST_VARS["security_try"]))
{
//Connect to database
mysql_connect("localhost", "username", "password");
mysql_select_db("dw_php");
//Set variables, and call checkSecurityImage
$security_refid = $HTTP_POST_VARS["security_refid"];
$security_try = $HTTP_POST_VARS["security_try"];
$checkSecurity = checkSecurityImage($security_refid, $security_try);
//Depending on result, tell user entered value was correct or incorrect
if ($checkSecurity) {
$validnot = "correct";
} else {
$validnot = "incorrect";
}
//Write output
echo("<b>You entered this as the security text:</b><br>\n
".$security_try."<br>\n
This is ".$validnot.".<br>\n
-------------------------------<br><br>\n
");
}
?>
所以我不知道他的驗證結果是錯誤還是正確
請問各位大大
要怎樣才能讓他跑出驗證結果
再次麻煩各位大大了
謝謝各位大大的幫忙
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.224.207.201
→
02/12 23:04, , 1F
02/12 23:04, 1F
→
02/12 23:05, , 2F
02/12 23:05, 2F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章