-3

I have a problem with my check.php for a login system I am building, the error reads

Parse error: syntax error, unexpected '{' in /home/ob219/public_html/logsystem/check.php on line 3

My code is

    <?php
session_start();
if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true {
header('Location: login.php');
}
?>

I have tried to remove the brackets {} but then it has a problem with header

2

2 Answers 2

1

You're missing your closing parenthesis:

if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true {

should be

if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true) {
Sign up to request clarification or add additional context in comments.

Comments

1

Try this:

<?php
    session_start();
    if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true)
    {
        header('Location: login.php');
    }
?>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.