NationGamer Posted November 7, 2010 Posted November 7, 2010 i am currently making an outter header for my game and have hit a stop in it that i can figure out with 1 page i want to use in game and outgame so the part i use is if($_SESSION['loggedin']==1) { include "globals.php"; } elseif($_SESSION['loggedin']==0) { include "main_globals.php"; } i am putting this at the top of the page i want to work in game and out game but it only seems to work with ingame ive tried doing this loads dif ways like just putting else and tried it removing the else so it just the if statement could someone please help me with this please Quote
Dominion Posted November 7, 2010 Posted November 7, 2010 May i ask why you need an if() at all? if the page is outside the game include the layout for it. if it's inside include the layout for in game. Quote
NationGamer Posted November 7, 2010 Author Posted November 7, 2010 how else would i do this without the IF statement as i have made an outside globals called main_globals.php and that includes the outside styles as i was saying i need to check if user is loggedin or out so the page shows the correct style for the page so if loggedin ==0 then outside style and loggedin==1 inside style of the game the only way i would know of doing this is the way ive done it checking to see if the loggedin session is there as some pages i want to use inside and outside the game e.g forums , tos, contact so i need to find a way for it to check if they loggedin then pull the style from inside or outside the game Quote
Dominion Posted November 7, 2010 Posted November 7, 2010 outside file - include "main_globals.php"; inside file - include "globals.php"; really don't see the point in an if() anyway try isset session_start(); if(isset($_SESSION['loggedin'])) { include "globals.php"; } else { include "main_globals.php"; } Quote
NationGamer Posted November 7, 2010 Author Posted November 7, 2010 still doing the same as before it is only showing 1 style when loggedin it shows the page but when i logout it dont show the out header it just redirects back to the loggin page like it is only showing the inside globals Quote
Dominion Posted November 7, 2010 Posted November 7, 2010 still doing the same as before it is only showing 1 style when loggedin it shows the page but when i logout it dont show the out header it just redirects back to the loggin page like it is only showing the inside globals It's been some time since i picked v2 up and looked at it. anyway... Did you create the 2nd globals file using the 1st one as a template? if so look for anything in it that checks if there logged in e.g. if ($_SESSION['loggedin'] { header("Location: login.php"); } i think thats what v2 has in it anyway Quote
NationGamer Posted November 7, 2010 Author Posted November 7, 2010 yes i did but i removed that check when i first created it Quote
Jordan Palmer Posted November 7, 2010 Posted November 7, 2010 What are you actually trying to do? Please don't forget the header is only INSIDE game... Quote
NationGamer Posted November 7, 2010 Author Posted November 7, 2010 firstly im trying to make 1 page work within the inside and outside of the game and header ive made for outside the game aswell as inside as all the outside all take the same style so made sense to make a new header for that Quote
Dominion Posted November 8, 2010 Posted November 8, 2010 What are you actually trying to do? Please don't forget the header is only INSIDE game... I don't think it's so much a header as a layout that fits in with the loggedin look. So he would have the same css (color coding) etc. @ NationGamer - did you make sure there is nothing in the outside "header" that checks if they are loggedin. Quote
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.