Jump to content

Recommended Posts

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

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...


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.