slj90 Posted January 18, 2010 Share Posted January 18, 2010 Hi guys, I'm getting an error directed at the last line of code on my page, '</html>' Parse error: syntax error, unexpected $end in /loggedon.php on line 108 Any ideas what this could be? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php session_start(); // Check if we have an authenticated user if (!isset($_SESSION["authenticatedUser"])) //if not re-direct to login page { $_SESSION["message"] = "Please Login"; header("Location: login.php"); } else { //If authenticated then display page conetents ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>DRINKS2NITE</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="wrapper"> <div id="logo"> <h1><DRINKS2NITE</h1> <p><em> 24 HOUR ALCOHOL DELIVERY</em></p></div> <hr /> <div id="header"> <div id="menu"> <ul> <li><a href="#" class="first">SHOP</a></li> <li class="current_page_item"><a href="#">CHECKOUT</a></li> <li><a href="#">YOUR DETAILS</a></li> <li><a href="#">LOG OUT</a></li> <li></li> <li></li> </ul> </div> <div id="search"> <form method="get" action=""> <fieldset> <input type="text" name="s" id="search-text" size="15" /> <input type="submit" id="search-submit" value="GO" /> </fieldset> </form> </div> </div> <div id="page"> <div id="page-bgtop"> <div id="content"> <div class="post"> <div class="entry"> <cener> <p><center> <br /> </p> <table width="200" border="0" cellspacing="5" cellpadding="5"> <tr> <td><img src="./images/beer.PNG" alt="Beer" /><br /> Beer</td> <td><img src="./images/spirits.PNG" alt="Spirits" /><br /> Spirits</td> <td><img src="./images/wine.PNG" alt="Wine" /><br /> Wine</td> </tr> <tr> <td><img src="./images/champ.PNG" alt="Champagne" /><br /> Champagne</td> <td><img src="./images/mix.PNG" alt="Mixers" /><br /> Mixers</td> <td><img src="./images/extras.PNG" alt="Extras" /><br /> Spirits</td> </tr> </table> <p><br /> <br /> <br /> </p> </div> </div> <div class="post"> <div class="entry"> </div> </div> </div> <div id="sidebar"> <ul> <li> <h2>YOUR CART</h2> <p><?php echo $_SESSION["authenticatedUser"] ?></p> </li> </ul> </div> <div style="clear: both;"> </div> </div> </div> <div id="footer"> <p>21281</p> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/ Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 From what I can see, <?php echo $_SESSION["authenticatedUser"] ?> You're missing a semi-colon, as it parses all in one 'precedure' it is required, try to add it and see if it works.. EDIT: else { //If authenticated then display page conetents You're never ending your else tag! Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/#findComment-997071 Share on other sites More sharing options...
Buddski Posted January 18, 2010 Share Posted January 18, 2010 You are not closing your else statement you need to add <?php } ?> AFTER your </html> tag Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/#findComment-997072 Share on other sites More sharing options...
slj90 Posted January 18, 2010 Author Share Posted January 18, 2010 Thanks for the reply.. Where am I missing the semi-colon? And how do I sort my else tag out? Thank you for being patient with me Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/#findComment-997076 Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 Thanks for the reply.. Where am I missing the semi-colon? And how do I sort my else tag out? Thank you for being patient with me You open an ELSE tag to display the html, but never end it. Just place what Buddski provided at the end of your script, The semicolon should go after the php code I quoted, before the ending tag. As well, session_start() is placed incorrectly, you should keep it at top BEFORE you output any html. Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/#findComment-997078 Share on other sites More sharing options...
slj90 Posted January 18, 2010 Author Share Posted January 18, 2010 I have done what you said and it is now working fine. Thank you very much for your fast responses, I don't know what I would do with out them! Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/#findComment-997079 Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 I have done what you said and it is now working fine. Thank you very much for your fast responses, I don't know what I would do with out them! No problem. just nothing else to do at midnight. Quote Link to comment https://forums.phpfreaks.com/topic/188856-strange-error-on-line/#findComment-997080 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.