-2

I'm a new php programmer so its very hard for me to catch errors. It would be of much help for me if someone could explain the error

Whilst running my php in several online debuggers I continue to get the error message:

Parse error: syntax error, unexpected 'exit' (T_EXIT) on line 11

However I do not believe this to be the case... could someone help me out?

    <?php 

if (isset($_POST['submit'])) {
    include_once 'dbh.inc.php';


    $uid = $_POST['uid'];
    $pwd = $_POST['pwd'];

    if (empty($uid) || empty($pwd)) {
        header("Location: ../index.php")
        exit()
    } else {
        $sql = "SELECT * FROM users WHERE user_uid ='$uid'"; 
        $result= mysqli_query($conn, $sql);
        $resultcheck = mysqli_num_rows($result);
        if ($resultcheck < 1) {
            header("Location: ../index.php")
            exit()
        } else {
            if ($row = mysqli_fetch_assoc($result)) {
                $hashedPwdCheck = password_verify($pwd, $row['user_pwd']);
                if ($hashedPwdCheck == false) {
                    header("Location: ../index.php")
                    exit()
                } elseif($hashedPwdCheck == true) {
                    $_SESSION['u_id'] = $row['user_id'];
                    $_SESSION['u_first'] = $row['user_first'];
                    $_SESSION['u_last'] = $row['user_last'];
                    $_SESSION['u_email'] = $row['user_email'];
                    $_SESSION['u_uid'] = $row['user_uid'];
                    echo "Correct";
                }
            }
        }
    }



} else { 
    header("Location: ../index.php?login=error")
    exit()

}

 ?> 
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

You are missing several semicolons

// you have
if (empty($uid) || empty($pwd)) {
    header("Location: ../index.php")
    exit()

// you should have
if (empty($uid) || empty($pwd)) {
    header("Location: ../index.php") ;
    exit() ;


// you have 
} else { 
    header("Location: ../index.php?login=error")
    exit()

// you should have
} else { 
    header("Location: ../index.php?login=error") ;
    exit() ;
Mr Glass
  • 1,186
  • 1
  • 6
  • 14