doubi9615 2016-03-03 22:56
浏览 14

登录重定向是登录被接受

This is login page code. After I insert the right login nothing the page does not redirect me to "customer_account_summary.php". The page just refreshes and asks me to log in again. but if I access "customer_account_summary.php" manually I can tell that it has logged in successfully.

    $sql="SELECT email,password FROM customer WHERE email='$username' AND password='$password'";
$result=mysql_query($sql) or die(mysql_error());
$rws=  mysql_fetch_array($result);

$user=$rws[0];
$pwd=$rws[1];    

if($user==$username && $pwd==$password){
    session_start();
    $_SESSION['customer_login']=1;
    $_SESSION['cust_id']=$username;
header('location:customer_account_summary.php'); 
die();  
}
else{
    header('location:index.php');  
}}
?>
<?php 
session_start();

if(isset($_SESSION['customer_login'])) 
    header('location:customer_account_summary.php'); 

?>

this is the login table html

        <div class="user_login">
        <form action='' method='POST'>
    <table align="left">
        <tr><td><span class="caption">Secure Login</span></td></tr>
        <tr><td colspan="2"><hr></td></tr>
        <tr><td>Username:</td></tr>
        <tr><td><input type="text" name="uname" required></td> </tr>
        <tr><td>Password:</td></tr>
        <tr><td><input type="password" name="pwd" required></td></tr>

        <tr><td class="button1"><input type="submit" name="submitBtn" value="Log In" class="button"></td></tr>
    </table>
            </form>
        </div>
  • 写回答

1条回答 默认 最新

  • dtcaw02086 2016-03-03 22:59
    关注

    After you set the header redirect, you need to stop the script execution.

    header('Location: /customer_account_summary.php'); 
    die(); // <-- important!
    
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭