Results 1 to 6 of 6

Thread: unexpected $END error...

  1. #1
    Join Date
    Jul 2011
    Location
    Lockport, Illinois
    Posts
    35
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Default unexpected $END error...

    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:

    Code:
    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 Code:
    <!-- <?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
    Last edited by griffinwebnet; 09-30-2011 at 09:16 PM. Reason: Thread Resolved. drrr. lol

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by griffinwebnet View Post
    PHP Code:
    <!-- <?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 Code:
    <!-- <?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 Code:
    <?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>

  3. The Following User Says Thank You to traq For This Useful Post:

    griffinwebnet (09-30-2011)

  4. #3
    Join Date
    Jul 2011
    Location
    Lockport, Illinois
    Posts
    35
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Default

    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

  5. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    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].

  6. The Following User Says Thank You to traq For This Useful Post:

    griffinwebnet (10-01-2011)

  7. #5
    Join Date
    Jul 2011
    Location
    Lockport, Illinois
    Posts
    35
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by traq View Post
    <!--
    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

  8. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •