0

The error is

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\project\inc\header.inc.php on line 35

The code below is for the header file where the error is meant to be:

<?php 
include ("./inc/connect.inc.php");
session_start();
if (!isset($_SESSION["user_login"])){
}
else
{
header("location: home.php")
?>


<html>
     <head>
         <title>Memory Lane</title>
         <link rel="stylesheet" type="text/css" href="./css/style.css"
 </head>
     <body>
         <div class="HeaderMenu">
         <div id="wrapper">
             <div class="logo">
                 <img src="./Image/Memorylane_logo.jpg"/>
             </div>
             <div class="search_box"> 
                <form action="search.php" method="GET" ID="search"> 
                <input type="text" name="q" size="60" placeholder="Search ..."/>
                </form>
             </div>
             <div id="menu"> 
             <a href ="#"/>Home</a>
             <a href ="#"/>About</a>
             <a href ="#"/>Sign Up</a>
             <a href ="#"/>Sign In</a>
             </div>
         </div>
    </div>
chris85
  • 23,846
  • 7
  • 34
  • 51

3 Answers3

1

You're missing a closing } at the end of the file to close the else block:

         </div>
    </div>
<?php
}

?>

Edit: Noticed that you're trying to do a redirect. In that case, the } should be right after the line that says:

header("location: home.php")
John Nicely
  • 1,006
  • 8
  • 18
1

You're messing a closing } here :

<?php 
include ("./inc/connect.inc.php");
session_start();
if (!isset($_SESSION["user_login"])){
}
else
{
header("location: home.php"); // <-- You were also missing a semicolon here 
exit; // <-- and an exit is a good thing to use after an header
} // <--- You should add this one
?>

also if you indent your code it'll be easier to catch missing blosing brackets like below :

<?php 
   include ("./inc/connect.inc.php");
   session_start();
   if (!isset($_SESSION["user_login"])){
    //Also putting some code here would be a good idea
   } else {
     header("location: home.php");
     exit;
   }
?>
Nirnae
  • 1,315
  • 11
  • 23
0

Change your with below code. else end is not mentioned and after this line header("location: home.php") give a semi-clone.

<?php 
include ("./inc/connect.inc.php");
session_start();
if (!isset($_SESSION["user_login"])){
}
else
{
header("location: home.php");
}
?>
Jakir Hossain
  • 2,457
  • 18
  • 23