$username Posted October 7, 2007 Share Posted October 7, 2007 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 More sharing options...
Rithiur Posted October 7, 2007 Share Posted October 7, 2007 Maybe you just need to use this: if ($secv != 120) { Or, if you want anyone with that "level" or higher to access it, you could use (so that anyone below 120 would be killed off) if ($secv < 120) { Link to comment https://forums.phpfreaks.com/topic/72211-solved-user-rights-for-viewing-pages/#findComment-364121 Share on other sites More sharing options...
$username Posted October 7, 2007 Author Share Posted October 7, 2007 Thanks that helps. Brett Link to comment https://forums.phpfreaks.com/topic/72211-solved-user-rights-for-viewing-pages/#findComment-364122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.