Jump to content

Need Help


Unholy Prayer

Recommended Posts

Ok, I'm making a CMS for my hosting company's customers to use as a default portal for their site.  I'm trying to make the code that switches the link if the user is not logged in or logged in.  For example, if the user is logged in, it will say "Logged in as: <user_name>".  If they are not logged in, a link to the "register.php" page will appear.  The error I am getting is this:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mtechdev/public_html/portal/styles/default/menuright.tpl on line 5

Line five of menuright.tpl is the following:
[code]
</tr><tr>
[/code]

This is the coding for the whole page:
[code]
<td align="right"><table align="right" width="160" cellspacing="0" cellpadding="0" border="0">
<tr>
<td height="17" class="menuhead">Members Area</td>
</tr><tr>
<td height="17" class="navlinkrow"><?php if (!empty($online['id'])){ echo "Logged In As: '.stripslashes($online['username']).'"}; else { echo "<a href='login.php'>Login</a>"; } ?></td>
</tr><tr>
<td height="17" class="navlinkrow"><a href="register.php">Register</td>
</tr><tr>
<td height="17" class="navlinkrow"><a href="#">Password Retrieval</a></td>
</tr><tr>
<td height="17" class="navlinkrow"><a href="register.php?act=why">Why Register?</a></td>
</tr><tr>
<td height="17" class="navlinkrow"><a href="register.php?act=faqs">Registration FAQ's</a></td>
</tr><tr>
<td height="17" class="menuhead">Weekly Poll</td>
</tr><tr>
<td height="202" class="navlinkrow" align="left">Do you like this template?<br><input type="radio" name="vote">I love it!<br><input type="radio" name="vote">It's alright.<br><input type="radio" name="vote">I hate it.<br><br><input type="submit" value="Vote Now!"><br><br><br><br><br><br><br></td>
</tr>
</table></td>[/code]

Can anyone help me?

Anyone know why it would do this?
Link to comment
https://forums.phpfreaks.com/topic/27304-need-help/
Share on other sites

take a look at....

[code]<?php if (!empty($online['id'])){ echo "Logged In As: '.stripslashes($online['username']).'"}; else { echo "<a href='login.php'>Login</a>"; } ?>
[/code]

couple of things.. just replace it with this

[code]<?php if(!empty($online['id'])){ echo "Logged In As: ".stripslashes($online['username']);} else { echo '<a href="login.php">Login</a>'; } ?>[/code]

first problem is with your quote you start off with "Logged in as: ' <<---why a single quote??  just remove the single quotes, and the double at the end. second problem, you have a semicolon  at the outside bracket of the if statement  "};"



Link to comment
https://forums.phpfreaks.com/topic/27304-need-help/#findComment-124854
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.