-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

Beep
  • 2,691
  • 6
  • 32
  • 79

2 Answers2

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) {
John Conde
  • 212,985
  • 98
  • 444
  • 485
1

Try this:

<?php
    session_start();
    if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true)
    {
        header('Location: login.php');
    }
?>
sensorario
  • 18,131
  • 26
  • 91
  • 148