Jump to content

[SOLVED] User Rights for viewing pages.


$username

Recommended Posts

Hello Everyone,

    I am working on a project and I would like to have only people that have the privilege to view the page.

 

So what I did is added a UsrRights field to my database. And if a user has the permissions level of 120 they can view the page.

 

I have made it an include to the pages that I want restricted.

 

How can I make an if statement so if the rights are not equal to 120 that they get a error message?

 

What do I add to the statement to continue to the page?

 

include 'dbopen.php';
include 'dbconnect.php';


$username = $_COOKIE["user"];

$sql88 = "SELECT UsrRights FROM admin WHERE username = '$username'"; 
$query88 = mysql_query($sql88);
$row88 = $query88;

$formVars = array();
$formVars["UsrRights"]=$row88["UsrRights"];
//$secv = $formVars["UsrRights"]=$row88["UsrRights"];
echo $formVars["UsrRights"];

$secv = $formVars["UsrRights"];

if ( !isset($secv) != 120 )
{
echo "You do not have access to this page."
    
}else{
     
}

 

Thank you,

Brett

Link to comment
https://forums.phpfreaks.com/topic/72211-solved-user-rights-for-viewing-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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