Jump to content

have a Parse error: syntax error,


co.ador

Recommended Posts

Parse error: syntax error, unexpected $end in /home3/nyhungry/public_html/storeprueba/storeadmin/index.php on line 40

<?php session_start();
if (!isset($_SESSION["manager"])){ header("location:admin_login.php"); exit();

// Be sure to check that this manager SESSION value is in fact in the database
$managerID = preg_replace('#[^0-9]#i', '', $_SESSION["id"]); // filter everything but numbers and letters
$manager = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["manager"]); // filter everything but numbers and letters
$password = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["password"]); // filter everything but numbers and letters

// Run mySQL query to be sure that this person is an admin and that their password session var equals the database information
// Connect to the MySQL database  

include "../storescripts/connect_to_mysql.php"; 
$sql = mysql_query("SELECT * FROM admin WHERE id='$managerID' AND username='$manager' AND password='$password' LIMIT 1"); // query the person
// ------- MAKE SURE PERSON EXISTS IN DATABASE ---------
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0) { // evaluate the count
 echo "Your login session data is not on record in the database.";
     exit();
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Store Home Page</title>
<link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />
</head>
<body>
<div align="center" id="mainWrapper">
  <?php include_once("../template_header.php");?>
  <div id="pageContent">
    <div align="left" style="marging-left:24px">
      <h2>Hello Store manager, what would you like to do today?</h2>
      <p><a href="inventory_list.php">manage inventory</a></p>
      <p><a href="#">manage bla bla</a></p>
      <p> </p>
    </div>
  </div>
  <?php include_once("../template_footer.php");?>
</div>
</body>
</html>

 

I have a parse error in line 40, Don't see it. the error says it is an unexpected $ sign What would be the problem?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/231199-have-a-parse-error-syntax-error/
Share on other sites

If the code was better formatted for readability, you'd see a missing curly brace.

if( !isset($_SESSION["manager"]) ) {
     header("location:admin_login.php");
     exit();
     // <---- HERE

If the code was better formatted for readability, you'd see a missing curly brace.

if( !isset($_SESSION["manager"]) ) {
     header("location:admin_login.php");
     exit();
     // <---- HERE

 

 

I can see that clearly, I will format it better next time to avoid parse error.

 

Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.