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
Share on other sites

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.