burge124 Posted February 26, 2008 Share Posted February 26, 2008 hi, ive got a standard login page named checklogin.php with user id called UserName. id like to echo on all of the pages that they visit whilst logged in their username (similar to this pages top left hand corner "Hello "UserName"". Do i need to use this function or is this just to check that the user is registered? <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> do i need to use an include function from the checklogin.php page? thanks Quote Link to comment Share on other sites More sharing options...
jesushax Posted February 26, 2008 Share Posted February 26, 2008 in your login code add $_SESSION["UserName"] = "the username info, mysql you need to run a query then dispaly the result eg" $RS["userName"] then on everypage have your session_start(); then to call the session either put it in a variable and write the variable or straight up use the session eg echo $_SESSION["UserName"] or in a variable $user = $_SESSION["UserName"] echo $user simple that code you are quotign above is to check it the user is regsitered yes Quote Link to comment 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.