dotti Posted May 30, 2007 Share Posted May 30, 2007 Okay i have a navigation script that pulls url's and name's out of a database. However there are some links i only want people who are logged in to see.. I have made the login script and only this is needed in the if statment " if($logged_in) " But what ever i try i doesnt seem to work ... here is navigation.php <table border="0" width="150" cellspacing="0" cellpadding="0"> <?php include ("config.php"); database_connect(); $query = "SELECT * from navigation WHERE status = 1 ORDER by id;"; $error = mysql_error(); if (!$result = mysql_query($query)) { print "error"; exit; } while($itm = mysql_fetch_object($result)){ $name = $itm->name; $link = $itm->link; $targ = $itm->target; if ($link=="---"){ print("<tr> <td bgcolor=0066ff> <img src=images/bullet1.bmp><strong> <u>$name</u></strong> </td> </tr> "); }else{ print("<tr> <td bgcolor=00ccff> <img src=images/bullet2.bmp> <a href=".$link." target=main><strong>$name</strong></a> </td> </tr> "); } } ?> </table> Link to comment https://forums.phpfreaks.com/topic/53486-nav-if-member-logged-in/ Share on other sites More sharing options...
eZe616 Posted May 30, 2007 Share Posted May 30, 2007 Shouldn't you be checking the logging availability through sessions? and if there's a session for logged in.. do something like if ( logged in ) { $query = "SELECT * FROM ... where id >1 and < 7 } else { $query = "SELECT * from ..." etc } run rest of script... Link to comment https://forums.phpfreaks.com/topic/53486-nav-if-member-logged-in/#findComment-264432 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.