gnetuk Posted March 11, 2014 Share Posted March 11, 2014 Hello all good day. I am working on my new project atm, and it requires that registerd users will have rank status, 0 , 1 , 2 , 3 , 4 4=SUPER ADMIN ok i need so that anyone less than rank 3 can use the registration form. I cant provode my code as my www is on local host and im away from that pc atm. so in a nut shell SELECT rank from users where name = SESSION_['user'] IF rank = < 3 die (you dont have privlage) Hope you guys can help g- Link to comment https://forums.phpfreaks.com/topic/286888-display-page-based-on-rank-status/ Share on other sites More sharing options...
Ch0cu3r Posted March 11, 2014 Share Posted March 11, 2014 so in a nut shell SELECT rank from users where name = SESSION_['user'] IF rank = < 3 die (you dont have privlage) The psuedo code your posted would be the correct logic, which converted into PHP code would look somthing like <?php session_start(); // resume session $mysqli = new mysqli('localhost', 'user', 'pass', 'database'); // connect to mysql db $stmt = $mysqli->prepare('SELECT rank from users where name = ?'); // the query $stml->bind_param('s', $_SESSION['user']); // pass the user stored in session to the query $stmt->execute(); // execute query $stmt->bind_result($user_rank); // store the value of the rank column returned from the query iuto $user_rank variable $stmt->close(); // check the users rank if($user_rank < 3) die('Sorry you do not have the correct privilages to view this page'); // kill page, display error // display reset of page. Link to comment https://forums.phpfreaks.com/topic/286888-display-page-based-on-rank-status/#findComment-1472184 Share on other sites More sharing options...
gnetuk Posted March 12, 2014 Author Share Posted March 12, 2014 Thanks so much for that, I will try when i get home not sure if there is a thankyou button on here but thanks again, all the best ch0cu3r g- Link to comment https://forums.phpfreaks.com/topic/286888-display-page-based-on-rank-status/#findComment-1472308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.