Log in

View Full Version : Resolved unexpected $END error...



griffinwebnet
09-30-2011, 03:15 AM
Hii all. i am recycling a script i wrote a while back and never used, however when i run the scriipt, i get this error:



Parse error: syntax error, unexpected $end in /var/www/cgclient/usr/usr.php on line 76


here is my code. im sure its probly something stupid, lol. but i just cant find it.



<!-- <?php
session_start();
if(!session_is_registered(myusername)){
header("location:/repository/login/main_login.php");
?> -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../sys_css/style.css" />
<title>CG Administration</title>

<script type="text/javascript" src="../sys_js/jquery142.min.js"></script>
<script type="text/javascript" src="../sys_js/ddaccordion.js"></script>
<script type="text/javascript">
ddaccordion.init({
headerclass: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["suffix", "<img src='./sys_img/plus.bullet.png' class='statusicon' />", "<img src='./sys_img/minus.bullet.png' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
</script>

</head>
<body>
<div id="container">
<div id="logo"></div>
<div id="div-bar"></div>
<div id="side-pan">
<div class="glossymenu">
<a class="menuitem" href="/index.php">Dash Board</a>
<a class="menuitem submenuheader" href="#" >Tasks</a>
<div class="submenu">
<ul>
<li><a href="./index.php">View Ticket Purchase Count</a></li>
<li><a href="/ak/cli/sel-cli_view.php">View Planning Progress</a></li>
</ul>
</div>
<a class="menuitem submenuheader" href="#">Submissions</a>
<div class="submenu">
<ul>
<li><a href="/ak/tix/index.php">View Song Request List</a></li>
<li><a href="/ak/tix/new-tix.php">View Suggestion List</a></li>

</ul>
</div>
<a class="menuitem submenuheader" href="#" style="border-bottom-width: 0">Software Repository</a>
<div class="submenu">
<ul>
<li><a href="/ak/tix/index.php">Change Password</a></li>
<li><a href="/ak/tix/new-tix.php">Log Out</a></li>

</ul>
</div>
</div>
</div>
<div id="main-pan">
<div style="padding-left: 20px; padding-right: 20px; padding-top: 10px;">

</div>
</div>
</div>
</body>
</html>


-Thanks, JL

traq
09-30-2011, 03:37 AM
<!-- <?php
session_start();
if(!session_is_registered(myusername)){
header("location:/repository/login/main_login.php");
?> -->
<html>
<!-- all your html markup, blah blah blah -->
</html>

You never closed your if block. PHP got to the end of the file, and never found it, so you get the parse error.

I would suspect you intended to close it like this, since there's no point in outputting html if you're sending the user to another page:

<!-- <?php
session_start();
if(!session_is_registered(myusername)){
header("location:/repository/login/main_login.php");
} // <--right there
?> -->
<html>
<!-- all your html markup, blah blah blah -->
</html>
HOWEVER,
you're still going to have problems because of your <!--comment--> at the very beginning. That <!-- is output, and it will prevent your header from being sent. To use header() (and various other functions), you need to make sure that nothing has been output to the browser beforehand:

<?php
session_start();
if(!session_is_registered(myusername)){
header("location:/repository/login/main_login.php");
?>
<!--
I moved your comment down here, with the rest of your markup,
but really I don't understand why you have it anyway.
I would recommend just deleting it entirely.
-->
<html>
<!-- all your html markup, blah blah blah -->
</html>

griffinwebnet
09-30-2011, 03:03 PM
Thank You that fixed the problem. I knew it would be something small. i just stared at it for long enough that i kept overlooking it. :P Thanks Foe your help.

-JL

traq
09-30-2011, 03:58 PM
No problem. If that answers your question, please mark your thread "resolved":
On your original post (post #1), click [edit], then click [go advanced]. In the "thread prefix" box, select "Resolved". Click [save changes].

griffinwebnet
10-01-2011, 05:03 AM
<!--
I moved your comment down here, with the rest of your markup,
but really I don't understand why you have it anyway.
I would recommend just deleting it entirely.
-->
[/PHP]

I had it because i was getting that error , so i tried to render as an html document to see if something was wrong there. there was no functional use. lol. i just forgot to remove the comments before i put it here. :P

-JL

traq
10-01-2011, 05:32 AM
ah. :)