Hello, I'm currently making a user system with a navigation which requries different ranks, such as news (rank 3) events (rank 4)
but the prob is you could just be a events manager and not need news so > is out of the question.
So the ranking system in the database look like this
3|4|5 == admin
3 = news
3|4 = news and events and so on..
Code:
Btw these are snipets of coding added together.
I've never used in_array before, and I'm not 100% sure how to use it...
Many thanks, James.
but the prob is you could just be a events manager and not need news so > is out of the question.
So the ranking system in the database look like this
3|4|5 == admin
3 = news
3|4 = news and events and so on..
Code:
PHP:
<?
// _base.php
function allowrank($rank,$catrank)
{
$tmp = explode('|', $rank);
if(in_array($catrank,$tmp))
{
return true;
}
else
{
return false;
}
}
// navigation.php
$sql = mysql_query("SELECT * FROM navigation WHERE main='1' ORDER by catid");
while($row = mysql_fetch_assoc($sql)){ $i++;
$sql2 = mysql_query("SELECT * FROM navigation WHERE main='0' AND catid='".$row['catid']."'");
if(allowrank($rank,$row['minrank']))
{
$rank = 0;
}
else
{
$ranks = $rank;
}
if($ranks != $rank)
{
?>
<div class="<?php echo $row['div']; ?>" onclick="SwitchMenu('sub<?php echo $i; ?>')"></div>
<span class="submenu" id="sub<?php echo $i; ?>">
<?php while($row = mysql_fetch_assoc($sql2)){
if($_GET['page'] == $row['link']){ ?>
<b><a href="./?page=<?php echo $row['link']; ?>"><?php echo $row['catname']; ?></a></b><?php echo space(1); ?>
<? }else{ ?>
<a href="./?page=<?php echo $row['link']; ?>"><?php echo $row['catname']; ?></a><?php echo space(1); ?>
<? }} ?>
</span>
<? }} ?>
I've never used in_array before, and I'm not 100% sure how to use it...
Many thanks, James.