issue in code after moving to includes
Posted: Fri Aug 01, 2003 11:39 pm
i'm having a problem with the includes file. i did a slight change with adding a cookie to track if you're logged (specifically, but i'm thinking of checking username and pw and then if they match something have you noted as logged in)
i tried changng the cookie back to no avail. can anyone tell me why the previous one worked and the one from the function doesn't?
previous one (part of the begining of most pages, was near the top once the html started)the one from the includes (it's own function)
i tried changng the cookie back to no avail. can anyone tell me why the previous one worked and the one from the function doesn't?
previous one (part of the begining of most pages, was near the top once the html started)
Code: Select all
<?
<!-- nav bar-->
<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" text="#c8c8c8" width="750">
<tr>
<td><?php
if(isset($_COOKIE['un'])){ echo '<a href="logout.php">Log Out!</a>'; } # you're logged in
else{ echo '<a href="login.php">Log In!</a>'; } # you're not logged in
?></td>
<td><a href="faq.php?seek=all">F.A.Q. & T.O.S.</a></td>
<td><a href="new.php?gen=all">New Users</a></td>
<td><a href="top.php?gen=all">Top Users</a></td>
</tr>
<tr>
<td valign="top"><?php
if(isset($_COOKIE['un'])){ echo '<a href="control.php">Control Panel</a>'; } # you're logged in
else{ echo '<a href="signup.php">Sign Up!</a>'; } # you're not logged in
?></td>
<td valign="top"><a href="forums.php">Forums</a></td>
<td valign="top"><form name="qsearch" action="profile.php"><input type="text" maxlength="15" size="15" name="un"></td>
<td valign="top"><input type="submit" value="Find User!"></form></td>
</tr>
</table>
<!-- /nav bar -->
?>Code: Select all
<?php
function nav(){ # inserts navigation bar
ECHO <<<END
<!-- nav bar-->
<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" text="#c8c8c8" width="750">
<tr>
<td>
END
if($_COOKIE['login']){ echo '<a href="logout.php" target="_top">Log Out!</a>'; } # you're logged in
else{ echo '<a href="login.php" target="_top">Log In!</a>'; } # you're not logged in
ECHO <<<END
</td>
<td><a href="faq.php?seek=all" target="_top">F.A.Q. & T.O.S.</a></td>
<td><a href="new.php?gen=all" target="_top">New Users</a></td>
<td><a href="top.php?gen=all" target="_top">Top Users</a></td>
</tr>
<tr>
<td valign="top">
END
if($_COOKIE['login']){ echo '<a href="control.php" target="_top">Control Panel</a>'; } # you're logged in
else{ echo '<a href="signup.php" target="_top">Sign Up!</a>'; } # you're not logged in
ECHO <<<END
</td>
<td valign="top"><a href="forums.php" target="_top">Forums</a></td>
<td valign="top"><form name="qsearch" action="profile.php" target="_top"><input type="text" maxlength="15" size="15" name="un"></td>
<td valign="top"><input type="submit" value="Find User!"></form></td>
</tr>
</table>
<!-- /nav bar -->
END
}
?>