我的服務器運行在PHP 5.2.9,當我使用刷新和標題函數它無法正常工作。這裏是我的代碼PHP標題和刷新不工作
header("location: index.php");
header("Refresh: 0;");
以前我在不同的服務器上工作,它工作正常。我怎麼解決這個問題?
這是我的完整代碼
if($_POST['sign_in'])
{
$email = $_POST['email'];
$password = $_POST['password'];
$sql = "SELECT * FROM tbl_members WHERE m_email='$email' and m_password='$password'";
$res = mysql_query($sql);
$count = mysql_num_rows($res);
if($count==1)
{
session_register("email");
header("location: index.php");
}
else
{
$sql = "SELECT * FROM tbl_temp_members WHERE email='$email'";
$res = mysql_query($sql);
$count = mysql_num_rows($res);
if($count==1)
{
echo "Login unsuccessful,Account still not activated";
}
else
{
echo "Login unsccessful";
}
}
}
在調用'header'之前你有輸出嗎?你有錯誤報告激活?你能檢查錯誤(警告)嗎? – 2011-05-31 11:11:07
SQL注入FTW。 :)不要介意重定向。首先解決它。 – 2011-05-31 11:30:38
我附上了完整的代碼問題。 – 2011-05-31 11:30:41