-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,737
  • 7
  • 36
  • 85

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
  • 217,595
  • 99
  • 455
  • 496
1

Try this:

<?php
    session_start();
    if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true)
    {
        header('Location: login.php');
    }
?>
sensorario
  • 20,262
  • 30
  • 97
  • 159