Page 1 of 2

Cant figure out syntax error

Posted: Wed Sep 16, 2009 2:51 pm
by dklbwf
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hello PHP family,

this is my first post and hope you all can help with my issue which i think may be a easy fix in cde somewhere...basically i am getting a error:

Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\webmaster\_header.php on line 182

Here is the code

Code: Select all

<?php
require("admin.php"); 
 
?>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=<?=$header_encoding?>">
<title> Webmaster Area :: Powered by Ateom.com / Datetopia.com </title>
<link rel="stylesheet" href="style.css">
<script language="JScript" src="../info.js"></script>
</head>
<body bgcolor=#4A5868 class=bodytext link=0 vlink=0 alink=0 text=0>
<table width="100%" bgcolor="#CCCCCC" border="0" bordercolor="ffffff" align="center" cellpadding="4" cellspacing="1">
<tr valign="middle" bgcolor="#7798CE">
  <td align="center"><font color="#333333" size="3" face="Arial, Helvetica, sans-serif"><strong><font color="#000000"><a href="index.php"><img src="images/mablogo.gif" width="142" height="52" border="0" align="absmiddle"></a> </font></strong> &nbsp;&nbsp;&nbsp;&nbsp;</font> </td>
  <td><font color="#333333" size="3" face="Arial, Helvetica, sans-serif"><b><font color="#CCCCCC" size="2"><?php echo l1("Webmaster Area")." : $admin_login"; ?></font></b></font></td>
  <td width="150" align="center">  <table border="0" cellspacing="0" cellpadding="2">
<tr>
<?php
$q=substr($_SERVER['SCRIPT_FILE'],1);
$qs=preg_replace("/&?lg=[0-9]$/i","",$_SERVER['QUERY_STRING']);
 
if ($qs) $q.="?$qs&lg=";
else  $q.="?lg=";
    
$r=qs("* from lang");
if (!e($r)) while ($l=f($r)) echo "<TD align='center' bgcolor=".($local_language==$l[id]?"#BDD0F2":"")."><a href='${q}${l[id]}'><img info='$l[name]' alt='$l[name]' border=0 src='../templates/_default/flags/$l[name].gif'></a></TD>";
?><br>
  </tr>
</table><?=$lang_info?></td>
</tr>
<tr valign="top" bgcolor="#CCCCCC">
    <td height="3" colspan=3></td>
</tr>
  <tr valign="top">
    <td width="200" colspan="1" bgcolor="#E8E9F7" id="main_menu_td"><div align="center"><strong><?=l1("Main Menu")?></strong>       </div>
      <div align="center">
        <br>
        <img src="images/left-big.gif" width="19" height="19" align="absmiddle" onClick="main_menu.style.display='none';main_menu_td.style.width='40';" info="< <?=l1("Hide")?>"> <img src="images/right-big.gif" width="19" height="19" align="absmiddle" onClick="main_menu.style.display='block';main_menu_td.style.width='200';" info="<?=l1("Show")?> >">      </div>
        <br>
 
      <div id="main_menu">
        <table width="200" border="0" cellpadding="1" cellspacing="1">
                  <tr>
            <td align="center" bgcolor="#A2AFBF" onMouseOver="style.backgroundColor='ffffff';" onMouseOut="style.backgroundColor='#A2AFBF';"><a info='<?=l1("News")?>' href="index.php"><B> 
            <?=l1("News")?></B></a></td>
          </tr>
    </table>
<?
$color=#333333;
 
$ztime=time();
if (!$menu_category) $menu_category="Administrators";
 
$rca[0]=qs("* from syscategories where name='$menu_category' and (type=1 or type=3) order by name asc");
 
$rca[1]=qs("* from syscategories where name<>'$menu_category' and (type=1 or type=3) order by name asc");
 
 
if (e($rca[0])&&e($rca[1]))
{
echo l1("MySQL database not installed properly.");
include("_footer.php");
exit;
}
 
$menu_targeted=0;
if (!e($rca[0]))  $menu_targeted=1;
 
for ($ic=0;$ic<=1;$ic++)
{
$menu_colorhead="#7798CE";
$menu_coloritem="#C8D7EE";
 
if ($ic==0) 
{
$menu_colorhead="#88BB33";
$menu_coloritem="#CCDD99";
}
 
//$dscode="style=\"display:none;\"";
if ($menu_targeted&&$ic) $dscode="style=\"display:none;\"";
 
$rc=$rca[$ic];
while ($c=f($rc)) if ($mab_modid[$c[mod]])
{
    ?>
    <table width="200" border="0" cellpadding="1" cellspacing="1">
          <tr>
            <td align="center" bgcolor="<?=$menu_colorhead?>"><img align="absmiddle" info="< <?=l1("Hide")?>" onClick="menu_<?=$c[id]?>.style.display='none';" src="images/minus.png">
 
               <a href="#" onClick="if (menu_<?=$c[id]?>.style.display=='none') menu_<?=$c[id]?>.style.display='block'; else menu_<?=$c[id]?>.style.display='none';"><font color=#FFFFFF><strong> <?=l1($c[name])?> </strong></font></a> <img align="absmiddle" info="<?=l1("Show")?> >" onClick="menu_<?=$c[id]?>.style.display='block';" src="images/plus.png">            </td>
          </tr>
        </table>
    <div id="menu_<?=$c[id]?>" <?=$dscode?>>
    <table width="200" border="0" cellpadding="1" cellspacing="1">
    <?
        $r=qs("* from sysmenus where cid='$c[id]' order by topic asc ");
        while ($m=f($r)) if ($mab_modid[$m[mod]])
        {
        ?>
          <tr>
            <td onMouseOver="style.backgroundColor='ffffff';" onMouseOut="style.backgroundColor='<?=$menu_coloritem?>';" bgcolor="<?=$menu_coloritem?>"><a info='<?=l1($m[topic])?>' href="<?=$m[link]?>"><B><img src="images/arrow2.gif" border="0" align="absmiddle"> 
            <?=l1($m[topic])?></B></a></td>
          </tr>
          <?
        }
 
        if ($c[type]==3)
        {
        ?>
         <tr>
            <td bgcolor="<?=$menu_coloritem?>" onMouseOver="style.backgroundColor='ffffff';" onMouseOut="style.backgroundColor='<?=$menu_coloritem?>';"><a href="edit_settings.php?stype=<?=$c[id]?>&t=<?=l1($c[name])?>"><img src="images/arrow.gif" border="0" align="absmiddle"><B> <?=l1("Settings")?></B></a> </td>
          </tr>
          <?
        }
        ?>
          <tr>
            <td bgcolor="#E8E9F7">&nbsp;</td>
          </tr>
    </table></div>
        <?
    }
}
 
$rc=qs("* from syscategories where (type=2 or type=3) order by id asc");
if ((!e($rc)) && $mab_mod["Settings"])
{ ?>
        <table width="200" border="0" cellpadding="1" cellspacing="1">
          <tr>
            <td align="center" bgcolor="#76B3CF"><img align="absmiddle" src="images/minus.png" onClick="menu_set.style.display='none';" info="< <?=l1("Hide")?>"><a href="#" onClick="if (menu_set.style.display=='none') menu_set.style.display='block'; else menu_set.style.display='none';">
              <b>
              <font color="#FFFFFF">
              <?=l1("Settings")?>
              </font></b>              </a><img align="absmiddle" src="images/plus.png" onClick="menu_set.style.display='block';" info="<?=l1("Show")?> >"></td>
          </tr>
        </table>
 
          <div id="menu_set" <?=$dscode?>>
        <table width="200" border="0" cellpadding="1" cellspacing="1">
          <tr>
  <? 
 
if (!e($rc)) while ($c=f($rc)) if ($mab_modid[$c[mod]])
{
    ?>
          <tr>
            <td bgcolor="#C8D7EE" onMouseOver="style.backgroundColor='ffffff';" onMouseOut="style.backgroundColor='#C8D7EE';"><a href="edit_settings.php?stype=<?=$c[id]?>&t=<?=l1($c[name])?>"><img src="images/arrow.gif" border="0" align="absmiddle"><B> <?=l1($c[name])?></B></a> </td>
          </tr>
    <?
}
?>
        </table>
        </div>
<?
}
?>
            <div align="center">
        <br>
        <img src="images/left-big.gif" width="19" height="19" align="absmiddle" onClick="main_menu.style.display='none';main_menu_td.style.width='40';" info="< <?=l1("Hide")?>"> <img src="images/right-big.gif" width="19" height="19" align="absmiddle" onClick="main_menu.style.display='block';main_menu_td.style.width='200';" info="<?=l1("Show")?> >">      </div>
      </div>  </td>
    <td colspan=2 background="images/bk_dot.gif" bgcolor="f7f7f7">
<?
if ($tpl_offline)
{
?>
===CUT FROM HERE===
 <br></td>
  </tr>
<tr valign="top" bgcolor="DDDDDD">
    <td colspan=3>
<a href=index.php?logout=1>[ 
<?=(l1("logout"))?> 
]</a> <a href=index.php>[  
<?=(l1("news"))?> 
]</a> </td>
  </tr>
</table>
</body>
</html>
<?php
}
 
?>
Not sure if i need to take something out at end or what...thanks for any help n advance


pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:15 pm
by pickle
The error message in this case is pretty self-explanatory. Go to line 182 & see that there's a curly bracket. Remove it & see what happens.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:26 pm
by califdon
While you're at it, lose those <?= tags! They are deprecated and may cause you ongoing trouble. See http://en.wikibooks.org/wiki/Complete_P ... _from_HTML.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:27 pm
by jackpf
califdon wrote:While you're at it, lose those <?= tags! They are deprecated and may cause you ongoing trouble. See http://en.wikibooks.org/wiki/Complete_P ... _from_HTML.
Where does it say short tags are deprecated? (on php.net i mean) 8O

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:29 pm
by superdezign
Deprecated? I don't think they are. But all servers don't have short tags turned on, so it's better to not use them. At least, that's as far as I know.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:33 pm
by jackpf
I didn't think they were.

I only use them in templates...which I think is much more practical than using full tags.

I think there was some debate as to declare them deprecated or not because of their conflict with <?xml....>...but I don't think they went through with it in the end.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:39 pm
by Mirge
jackpf wrote:I didn't think they were.

I only use them in templates...which I think is much more practical than using full tags.

I think there was some debate as to declare them deprecated or not because of their conflict with <?xml....>...but I don't think they went through with it in the end.
Man I hope they aren't... I use short tags all the time lol. Well, for spitting out values.. ie: Amount: <?=number_format($amount,2);?>

But my main client right now is still using PHP4...... so I'm not terribly worried about it. Working with PHP4 gets old though... I like classes, but the lack of "real" OOP in PHP4 is annoying at times.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:40 pm
by jackpf
I've never used php4 in my life...

Tell them to upgrade. Seriously, it takes what...2 minutes??

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:41 pm
by requinix
I'm pretty sure that short_tags is off when it "should" be on...

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:43 pm
by dklbwf
yeah i went to the php.ini and enabled the php short tags...i am using a php software program that has a bunch of php scripts and one of there rules was that that short tags needed to be enabled due to there code having alot of
<?, <?= <?php

I took the line out at line 82 and that created a whole different issue:
Warning: require(admin.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\webmaster\_header.php on line 2

Fatal error: require() [function.require]: Failed opening required 'admin.php' (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\webmaster\_header.php on line 2

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:47 pm
by Mirge
jackpf wrote:I've never used php4 in my life...

Tell them to upgrade. Seriously, it takes what...2 minutes??
Would require re-writing the majority of his older software. My client is (was) a PHP developer... they don't want to have the code re-written. They did upgrade to PHP 5 a while back and it broke almost everything that was written before I came on board. Just not worth it to them right now... hopefully they'll let me do it in the future.

I started developing with PHP3 though lol.

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:47 pm
by jackpf
Does the file "admin.php" exist in the same dir?

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 3:51 pm
by dklbwf
no admin.php is in a whole different directory outside of this php file, i actually just did a search over the whole software folder and there is no admin.php anywhere??????? have a administrators.php, admin_login.php, and admin_catgeorgies.php???

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 4:08 pm
by dklbwf
wow....i just figured it out i think, i took everything out at line 182 and changed that admin.php to admin_login.php since i couldnt find admin.php....site has come up now

Re: Cant figure out syntax error

Posted: Wed Sep 16, 2009 5:16 pm
by jackpf
Nice one