I get "Parse error: syntax error, unexpected '}' in /whs2fs1_2us4_2/jcs5325aii/domains/jcs5325.aisites.com/public_html/auth.php on line 14"
I forgot to mention that I am using a separate php file called auth.php, in this file I have the script I posted. I am using the require function to call in the auth.php on any of the pages I want members only.
I am using the include() function on all pages for my header.html file, which contains the login, logout, and register links. As you can see in the code below I have all of the links displayed right now. I would like to modify the header.html file based on whether the user is logged in or not.
User logged in: Shows the logout link in the header.html only, and hides the register and login links
User not logged in: Shows the login and register links from the header.html, and hides the logout link
I think I will need another script similar to auth.php for the pages that can be accessed by anyone. So then I will require('auth.php') for private pages, which will only display the page if the user is logged in and then remove the register and login link on that page from the header.html file.
Now for public pages lets say I made a file called public.php that I will require() at the top. I want this file to also authorize the users login info, but unlike auth.php, I would like the user to still be able to view that page even if they aren't logged in. What I would need to add though is something to tell the page to remove the logout link from the header.html file and only display login and register to the public.
Here is my header.html file with all the links I want at the top:
<!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>JCSimmers Photography</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="stmenu.js"></script></head>
<body>
<div id="headerContainer">
<div id="header">
<div id="topNav"><span class="headerText">My Account </span><span class="divider">|</span><span class="headerText"> Shopping Cart</span> <span class="divider">|</span> <a href="login.php">Login</a> <span class="divider">|</span> <a href="register.php">Register </a><span class="divider">|</span> Logout </div>
</div>
</div>
Again, here is the auth.php file I require() on the private pages.
<?php
//Start session
session_start();
//Check whether the session variable
//SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_CUSTOMER_ID']) || (trim($_SESSION['SESS_CUSTOMER_ID'])=='')) {
header("location: login.php");
exit();
}
?>
And the content of the public.php file for public pages is what I need help with, if thats how it's done anyway. I just figured public and private pages would require a different script.