php header location couldn't jump to correct page
Posted: Sun Jun 14, 2009 3:16 pm
Code: Select all
<?php
if (isset($_POST['login'])){
require_once('Connections/Conn.php');
mysql_select_db($database_Conn, $Conn);
$username = $_POST['username'];
$password = $_POST['password'];
$query_rs_post = sprintf("SELECT * FROM web_user WHERE username='%s' AND password='%s'",$username,$password);
$rs_post = mysql_query($query_rs_post, $Conn) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($rs_post);
mysql_free_result($rs_post);
if ($totalRows_Recordset1 > 0){
//echo 'login success';
setcookie("gsbay_username", $username,time()+60*60*24*999);
setcookie("gsbay_password", $password,time()+60*60*24*999);
header("location:index.php");
}else{
echo 'login no';
}
}
?>header("location:index.php");
unfortunately,it will jump to a "The page cannot be displayed", and i have checked the url,it is correct..why man?