标题不会重定向并显示空白页面

时间:2016-08-13 19:28:10

标签: javascript php redirect

在我的网站上,我有一个登录页面。单击登录按钮时,它会将您重定向到fbregister.php,后者将用户详细信息存储在数据库中。提交用户详细信息后,需要将用户重定向到index.php,但并不总是有效。

它有时会卡在fbregister.php上并显示一个空白页面。我尝试过使用header()。我还尝试echo <script></script>阻止。

以下是 fbregister.php 的代码:

<?php
    include_once('mysqli_connect.php');

    if(isset($_COOKIE['user_email'])) {
        $email=$_COOKIE['user_email'];
        $query="Select * from user where u_email='$email'";
        $res=mysqli_query($dbc,$query);

        $result=mysqli_fetch_assoc($res);
        $ures=mysqli_num_rows($res);

        if($ures>0) {
            session_start();
            $session = Array('user_email' => $email);
            $_SESSION=$session;
            header('Location:home.php');
            exit();
            }

        else {
            header('Location:index.php?id=1');
            exit();
            }
        }
    ?>

我不知道为什么它没有正确重定向,所以如果您有建议或解决方案,请告诉我。

0 个答案:

没有答案
相关问题