Results 1 to 7 of 7

Thread: Parse error: syntax error, unexpected $end in

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Parse error: syntax error, unexpected $end in

    Hi all .could any tell me how to fix this error:


    VB Code:
    1. Parse error: syntax error, unexpected $end in /home2/method/public_html/musicboxv2/admin/news.php on line 85

    Thanks
    PHP Code:
    <?

    include_once("../sources/session.php");  
    ?>
    <html>
    <title>Admin : Authorisation</title>
    <meta HTTP-EQUIV="Pragma"  CONTENT="no-cache">
                      <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
                      <meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 May 1996 04:57:00 GMT"> 
     <link rel="stylesheet" type="text/css" media="all" href="../template/css/admintheme.css"/> 
    </head>
    <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> 

                <?php
                    
    /* Display information for logged in users */
                    
    if ($session->logged_in)
                    {
                        
    $uname $session->userinfo['username']; 
                        
    ?> 
                         
     <?php 
     
     
    if($session->isAdmin()){ 
          print(
    "<link rel='stylesheet' type='text/css' media='all' href='../template/css/admintheme.css' />");
    echo 
    "    <table width=\"100%\" align=\"center\" class='tdrow2'>";
    echo 
    "    <tr>";
    echo 
    "        <td>"
            
       print(
    "<div id='logomain'><div id='logotopmain'><div style='font-weight:bold;font-size:12px;color:#000;padding-top:14px;padding-left:4px'>Musicbox Version 2.3</div></div></div><table width='100%' cellspacing='6' id='submenu'><tr><td align='left'><a href='../documentation/index.html' target=_blank>First time here ? Read the documentation</a></td><td align='right'><a href='news.php'>Admin Home</a></td></tr></table>");
    print(
    "<div class='tableborder'><div class='maintitle'>Latest Announcements</div>");
    print(
    "<center>Welcome Administrator, Current Musicbox <img src='version/checknewversion2.3.gif' alt='Free Lifetime updates' border='0'><center><br>");
      
       
       echo 
    "        </td>";
    echo 
    "        <td>";  
    echo 
    "        </td>";
    echo 
    "    </tr>";
    echo 
    "    </table>";

    /*
    }

    echo "    <table width=\"100%\" align=\"center\" class='tdrow1'>";
    echo "    <tr>";
    echo "        <td>";
    print("<iframe  src='http://www.nolink.com/news/index.php' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' style='overflow:visible; width:100%; height=100% display:none'></iframe> <br><br>");
       echo "        </td>";
    echo "        <td>";  
    echo "        </td>";
    echo "    </tr>";
    echo "    </table>";
    */
       
    ?>
                                      
                        <?php
                    
    }
                    else
                    {
                        
    ?>
                        <form action="../aprocess.php" method="POST" target="_top">
                         <h1>Login Please !</h1>
                            <table align="center" border="0" cellspacing="0" cellpadding="3">
    <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
    <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
    <tr><td colspan="2" align="left"><input type="checkbox" name="remember" checked>
    <font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="hidden" name="sublogin" value="1">
    <input type="submit" value="Login"></td></tr>
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="../forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> 
    <tr><td colspan="2" align="left"><br>Not registered? <a href="../register.php">Sign-Up!</a></td></tr>
    </table>
    </form> 
                        <?
                    }
                [B]?> ===> error here[/B]
    Last edited by tony007; May 10th, 2006 at 12:13 AM.

  2. #2
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: Parse error: syntax error, unexpected $end in

    You're missing a ; or } somewhere.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: Parse error: syntax error, unexpected $end in

    Quote Originally Posted by OMITT3D
    You're missing a ; or } somewhere.
    I check for } every where it was ok. Still can not make this work!!

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Parse error: syntax error, unexpected $end in

    Your code is horrifying. I have no idea where the error is but I have some tips for you to make it easy to find these things. Parse errors are really very simple to fix if you keep your code neat and tidy.

    • PHP is an embedded scripting language. It is inserted, within <?php ... ?> blocks, into documents of other types, in order to control the output of those documents. You should not use echo() or print() to output the document, the document is everything outside the <?php ... ?> blocks.
    • Use consistent, minimal whitespace and indenting. I find one blank line between logic sections and 2 spaces of indent works fine. Huge amounts of whitespace is just unnecessary and makes it very difficult to analyse the code.
    • PHP provides an alternate syntax for control constructs, that is especially helpful for surrounding blocks of HTML code.

      Instead of this:
      PHP Code:
      <?php
        
      if (a)
        {
      ?>
        <p>A</p>
      <?php
        
      }
      ?>
      You can instead use this:
      PHP Code:
      <?php if (A): ?>
        <p>A</p>
      <?php endif; ?>


    I suggest you apply those basic formatting guidelines to your code and you will find it very easy to fix syntax errors. Additionally, if you have not already I suggest picking up a code editor such as Notepad++ or JEdit, which highlights matching brackets and braces to make it very easy to spot missing symbols.

    Also, please use the [php]...[/php] tags when posting PHP code.

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Parse error: syntax error, unexpected $end in

    Quote Originally Posted by tony007
    Hi all .could any tell me how to fix this error:


    VB Code:
    1. Parse error: syntax error, unexpected $end in /home2/method/public_html/musicboxv2/admin/news.php on line 85

    Thanks
    PHP Code:
    <?

    include_once("../sources/session.php");  
    ?>
    <html>
    <title>Admin : Authorisation</title>
    <meta HTTP-EQUIV="Pragma"  CONTENT="no-cache">
                      <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
                      <meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 May 1996 04:57:00 GMT"> 
     <link rel="stylesheet" type="text/css" media="all" href="../template/css/admintheme.css"/> 
    </head>
    <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> 

                <?php
                    
    /* Display information for logged in users */
                    
    if ($session->logged_in)
                    {
                        
    $uname $session->userinfo['username']; 
                        
    ?> 
                         
     <?php 
     
     
    if($session->isAdmin()){ 
          print(
    "<link rel='stylesheet' type='text/css' media='all' href='../template/css/admintheme.css' />");
    echo 
    "    <table width=\"100%\" align=\"center\" class='tdrow2'>";
    echo 
    "    <tr>";
    echo 
    "        <td>"
            
       print(
    "<div id='logomain'><div id='logotopmain'><div style='font-weight:bold;font-size:12px;color:#000;padding-top:14px;padding-left:4px'>Musicbox Version 2.3</div></div></div><table width='100%' cellspacing='6' id='submenu'><tr><td align='left'><a href='../documentation/index.html' target=_blank>First time here ? Read the documentation</a></td><td align='right'><a href='news.php'>Admin Home</a></td></tr></table>");
    print(
    "<div class='tableborder'><div class='maintitle'>Latest Announcements</div>");
    print(
    "<center>Welcome Administrator, Current Musicbox <img src='version/checknewversion2.3.gif' alt='Free Lifetime updates' border='0'><center><br>");
      
       
       echo 
    "        </td>";
    echo 
    "        <td>";  
    echo 
    "        </td>";
    echo 
    "    </tr>";
    echo 
    "    </table>";

    /*
    }

    echo "    <table width=\"100%\" align=\"center\" class='tdrow1'>";
    echo "    <tr>";
    echo "        <td>";
    print("<iframe  src='http://www.nolink.com/news/index.php' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' style='overflow:visible; width:100%; height=100% display:none'></iframe> <br><br>");
       echo "        </td>";
    echo "        <td>";  
    echo "        </td>";
    echo "    </tr>";
    echo "    </table>";
    */
       
    ?>
                                      
                        <?php
                    
    }
                    else
                    {
                        
    ?>
                        <form action="../aprocess.php" method="POST" target="_top">
                         <h1>Login Please !</h1>
                            <table align="center" border="0" cellspacing="0" cellpadding="3">
    <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
    <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
    <tr><td colspan="2" align="left"><input type="checkbox" name="remember" checked>
    <font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="hidden" name="sublogin" value="1">
    <input type="submit" value="Login"></td></tr>
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="../forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> 
    <tr><td colspan="2" align="left"><br>Not registered? <a href="../register.php">Sign-Up!</a></td></tr>
    </table>
    </form> 
                        <?
                    }
                [B]?> ===> error here[/B]
    Your code is a mess. How can you expect us to search through it for an error? - I remember mentioning to you on several occasions how to do it properly.
    Last edited by visualAd; May 10th, 2006 at 01:32 AM.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: Parse error: syntax error, unexpected $end in

    visualAd i did not write the code it is from another php application and they do a bad coding and no support at all !! i keep checking the brackets and ; and can not fix it!

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Parse error: syntax error, unexpected $end in

    Start fixing the formatting then. You will most likely spot the error while you do this.

Posting Permissions

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



Click Here to Expand Forum to Full Width