TheJoshy PlusHost.org -> GOGOGO Jul 4, 2010 287 56 Apr 22, 2012 #1 I want to know a code to check if the user is logged in when they view a page, if not - redirect them to index? I could have the code on 1 page then php include it on to every page. Thanks. <3
I want to know a code to check if the user is logged in when they view a page, if not - redirect them to index? I could have the code on 1 page then php include it on to every page. Thanks. <3
Kaz BooYah Staff member Nov 16, 2010 3,064 1,025 Apr 22, 2012 #2 you could use something like this PHP: /** * Checks if the user is logged in */ if($_SESSION['user_id'] == NULL) { $_SESSION['login_error'] = "You need to login to view this page!"; die(header('Location: '.PATH.'/')); } Upvote 0 Downvote
you could use something like this PHP: /** * Checks if the user is logged in */ if($_SESSION['user_id'] == NULL) { $_SESSION['login_error'] = "You need to login to view this page!"; die(header('Location: '.PATH.'/')); }
Sledmore Chaturbate Livestreamer Staff member FindRetros Moderator Jul 24, 2010 5,199 3,934 Apr 22, 2012 #3 If you read through the files, this is already coded, in a switch case, just add the page name. Upvote 0 Downvote
HabboME Member Oct 14, 2011 84 20 Apr 22, 2012 #4 You can find the switch case in class.core.php around line 77. Just add: PHP: case "pagename"; Upvote 0 Downvote
TheJoshy PlusHost.org -> GOGOGO Jul 4, 2010 287 56 Apr 22, 2012 Thread starter #5 HabboME said: You can find the switch case in class.core.php around line 77. Just add: PHP: case "pagename"; Click to expand... It worked! Thanks so much man, helps heaps! Saves loads of trouble<3 Upvote 0 Downvote
HabboME said: You can find the switch case in class.core.php around line 77. Just add: PHP: case "pagename"; Click to expand... It worked! Thanks so much man, helps heaps! Saves loads of trouble<3