Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 登录会话的问题_Php_Mysql_Login - Fatal编程技术网

Php 登录会话的问题

Php 登录会话的问题,php,mysql,login,Php,Mysql,Login,我的登录有一个小问题:所有的验证都可以,但在提交时,页面变为空白,url:login.php而不是假定的index.php,类似于下面的屏幕截图 以下是我的代码和屏幕截图: <?php logged_in_redirect(); //to prevent access from user already logged in //when Line 2 is un-commented it displays the following error message:"Fatal error

我的登录有一个小问题:所有的验证都可以,但在提交时,页面变为空白,url:login.php而不是假定的index.php,类似于下面的屏幕截图 以下是我的代码和屏幕截图:

<?php
logged_in_redirect();  //to prevent access from user already logged in

//when Line 2 is un-commented it displays the following error message:"Fatal error: Call to undefined function logged_in_redirect() in /www/htdocs/w00f3b5f/kari/SAMS/login.php on line 2”

include 'core/init.php';

if(empty($_POST) === false) {
    $email_address = $_POST['email_address'];
    $password = $_POST['password'];

    if(empty($email_address) === true || empty($password) === true) {
        $errors[] = 'You need to enter an email and password’;

   } else if (email_exists($email_address) === false) { //edit to suit my system
        $errors[] = 'This email address cannot be found. Have you registered?’;

    } else if (user_active($email_address) === false) {
        $errors[] = 'Your account has not been activated!’;

    } else  {
        //validate email_address and password
        $login = login($email_address, $password);

        if ($login === false) {
            $errors[] = 'The email address/password combination is incorrect’;

        } else {
            $_SESSION['user_id'] = $login; //login returns the user id
            header('Location: index.php');
            exit();
        }   
    }   
} else {
    $errors[] = 'No data received';  
}
include 'includes/overall/header.php';

if(empty($errors) === false) {
?>
    <h2>We tried to log you in, but ...</h2>
<?php
    echo output_errors($errors);
} 

include 'includes/overall/footer.php';
?>
下面的屏幕截图是从重定向中删除出口的结果,我知道不应该这样做。我真的不知道错误的来源在哪里。 提示:问候语应该是“你好,[名字]!但它不显示登录用户的名字。”

$errors[] = 'You need to enter an email and password’;
                                               this ^


这将是你的问题,用“.

你确实有一些斜逗号”,而不是普通的逗号。不确定这是否会给你带来错误。只是确保用户确实有一个名字。是吗?我还能看到侧边栏的代码吗?@amethystdragon:我不确定为什么它显示为斜逗号,它是一个我不知道为什么它会显示为倾斜的逗号,就像你写的一样,它都是规则的直逗号。
$errors[] = 'Your account has not been activated!’;
                                            this ^