ChrisMartino Posted December 13, 2009 Share Posted December 13, 2009 Hey i wana make it so i can make a admin level on my register system , I'm kinda new to php to im not sure how, i wana do something like a 'if' statment so when they click the page if the admin level in there user row in the sql table it lets them on the page, So like how would i do that what format would i create the field in the sql like text, number, var, varchar etc i dont know what and how could i do a if statment for if there level 1?? Link to comment https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/ Share on other sites More sharing options...
canadabeeau Posted December 13, 2009 Share Posted December 13, 2009 PM me ur skype/msn and I can help you. And yeah if statement may be the way, like you an if statement along with PHP sessions Link to comment https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/#findComment-976378 Share on other sites More sharing options...
teamatomic Posted December 13, 2009 Share Posted December 13, 2009 At the very top of your page if($_SESSION['admin_level'] != '10') {header('Location: http://www.domain.com');} or you could send them to an error page header('Location: http://www.domain.com/error.php?error=admin_access') Link to comment https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/#findComment-976392 Share on other sites More sharing options...
ChrisMartino Posted December 14, 2009 Author Share Posted December 14, 2009 At the very top of your page if($_SESSION['admin_level'] != '10') {header('Location: http://www.domain.com');} or you could send them to an error page header('Location: http://www.domain.com/error.php?error=admin_access') What would the Field Type be in PHPmyAdmin ? i put int but it didn't work. Link to comment https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/#findComment-976671 Share on other sites More sharing options...
teamatomic Posted December 14, 2009 Share Posted December 14, 2009 What you would do is put a field in the user table with 1-10. Where 1 is a registered user and 10 is an admin, or something like that. SQL: access_level TINYINT(2) NOT NULL DEFAULT '1' HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/#findComment-976675 Share on other sites More sharing options...
ChrisMartino Posted December 14, 2009 Author Share Posted December 14, 2009 <?php include "main/base.php"; if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username'])) { ?> <h1>Member Area</h1> <p>Thanks for logging in! You are <b><?=$_SESSION['Username']?><b> and your email address is <b><?=$_SESSION['EmailAddress']?></b>.</p> <p>And your level is <b><?=$_SESSION['Level']?></b></p? <ul> <li><a href="logout.php">Logout.</a></li> </ul> <?php } ?> that dont work ? it doesn't display the level Link to comment https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/#findComment-976688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.