How to treat the cable according to the level of access?

Asked

Viewed 31 times

-2

I have a login system and I have the access level variable and some information is restricted to certain employees. I wanted to know how to do according to this level appear only certain fields .

1 answer

2


A possible solution to your question is for example to create 2 headers, and give a echo in the header to be displayed by each user according to their level leaving one visible while the other not.

Example:

<?php

$cabecalhoUser = '<a>Texto 1</a> | <a>Texto 2</a> | <a>Texto 3</a>';
$cabecalhoAdm = $cabecalhoUser.' | <a>Área Administrativa</a>';


//Usuário = 1 & Administrador = 2
$Nivel = 1;

if($Nivel == 1)
    echo '<nav>'.$cabecalhoUser.'</nav>';
else
    echo '<nav>'.$cabecalhoAdm.'</nav>';

?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.