fife Posted July 19, 2008 Share Posted July 19, 2008 can anyone show me some code that makes users with level ones log on to level1.php and users who use same login ut with level 2 end up on level2.php instead? Quote Link to comment https://forums.phpfreaks.com/topic/115643-login-redirections/ Share on other sites More sharing options...
DeanWhitehouse Posted July 19, 2008 Share Posted July 19, 2008 set a session that contains there level, then check this session and redirect depending on there level. Quote Link to comment https://forums.phpfreaks.com/topic/115643-login-redirections/#findComment-594478 Share on other sites More sharing options...
fife Posted July 19, 2008 Author Share Posted July 19, 2008 sorry i am a complete noob. i understand what you mean but i could never create that code for myself yet. has anyone got an example? Quote Link to comment https://forums.phpfreaks.com/topic/115643-login-redirections/#findComment-594482 Share on other sites More sharing options...
swissbeets Posted July 20, 2008 Share Posted July 20, 2008 check the persons level initially then, store it in a session, then when you want to check or redirect, just check the session and do so depending on what is stored here is a simple one for my logged in or not session_start(); function logged_in() { return isset($_SESSION['user_id']); } function confirm_logged_in() { if (!logged_in()) { redirect_to("login.php"); } } then i check if they are logged in by confirm_logged_in() but you could make a function that will always get the level by something like $level= ($_SESSION['level']); then use $level to redirect or whatnot is fife a nickname? Quote Link to comment https://forums.phpfreaks.com/topic/115643-login-redirections/#findComment-594490 Share on other sites More sharing options...
MasterACE14 Posted July 20, 2008 Share Posted July 20, 2008 <?php if(isset($_SESSION['loggedin'])) { header("Location: member.php"); } else { header("Location: index.php"); } ?> Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/115643-login-redirections/#findComment-594491 Share on other sites More sharing options...
MasterACE14 Posted July 20, 2008 Share Posted July 20, 2008 function confirm_logged_in() { if (!logged_in()) { header("Location: login.php"); // changed to header } } Quote Link to comment https://forums.phpfreaks.com/topic/115643-login-redirections/#findComment-594495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.