Agar foydalanuvchi ma'mur bo'lmasa Menyu ko'rinishini ko'rinmasin

How to make some menu tab option is invisible if user is not Admin, eg: if ['user_level']>=5

 CBS
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      
      
2

6 javoblar

You can do with 2 methods:

1) Siz shunga o'xshash sinfni berishingiz kerak:

<?php
if ($user_level>=5) {
    $hide = "hidden";
} else {
    $hide = "";
}
?>

CBS
</div>
<div id="navbar" class="navbar-collapse collapse">
  



1
qo'shib qo'ydi

You can do with 2 methods:

1) Siz shunga o'xshash sinfni berishingiz kerak:

<?php
if ($user_level>=5) {
    $hide = "hidden";
} else {
    $hide = "";
}
?>

CBS
</div>
<div id="navbar" class="navbar-collapse collapse">
  



1
qo'shib qo'ydi

Server tomoni php-da sizga tegishli elementni shartli ravishda echib olishingiz mumkin.

Agar Siz avtorizatsiyalashgan foydalanuvchi deb hisoblasa, $ userAuth var, masalan:

CBS
</div>
<div id="navbar" class="navbar-collapse collapse">
  
  
1
qo'shib qo'ydi

Server tomoni php-da sizga tegishli elementni shartli ravishda echib olishingiz mumkin.

Agar Siz avtorizatsiyalashgan foydalanuvchi deb hisoblasa, $ userAuth var, masalan:

CBS
</div>
<div id="navbar" class="navbar-collapse collapse">
  
  
1
qo'shib qo'ydi

Don't duplicate code - it is first rule. So better is to wrote: (i persume that ['user_level'] is some value in array(); - here I call this array $user:

CBS
<div id="navbar" class="navbar-collapse collapse">
    


0
qo'shib qo'ydi

Don't duplicate code - it is first rule. So better is to wrote: (i persume that ['user_level'] is some value in array(); - here I call this array $user:

CBS
<div id="navbar" class="navbar-collapse collapse">
    


0
qo'shib qo'ydi
PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin