Asheeown Posted January 22, 2007 Share Posted January 22, 2007 This is the function i'm currently using:[code]<?phpfunction Login($Variables,$FormValues) { if($FormValues[Name] || $FormValues[Password]) { echo "Logged in"; $_SESSION['Name'] = $FormValues[Name]; $_SESSION['LoggedIn'] = "1"; $_SESSION['UserGroup'] = "2"; echo $_SESSION['LoggedIn']; } else { echo " <form id=\"form1\" name=\"form1\" method=\"post\" action=\"$PHP_SELF?Area=Login\"> <p>Your Name </p> <p><label><input name=\"FormValues[Name]\" type=\"text\" id=\"Name\" /></label></p> <p>Password</p> <p><label><input name=\"FormValues[Password]\" type=\"password\" id=\"Password\" /></label></p> <p><label><input type=\"submit\" name=\"Submit\" value=\"Submit\" /></label></p> </form> "; } // End of if($FormValues)} // End of Function Login($Variables,$FormValues);?>[/code]Now...this is just a test before I add in calling to the database to actually verify the user...but their is one problem when you log in or enter your info into the form and post it, it reloads the page correctly and says Logged In[b]1[/b] now the 1 proves that the session LoggedIn registered but when I hit home I have one thing that tells me if i'm logged in or not and i'm not and all the sessions are cleared...any idea why? Quote Link to comment https://forums.phpfreaks.com/topic/35266-sessions-dieing-after-function/ Share on other sites More sharing options...
redbullmarky Posted January 22, 2007 Share Posted January 22, 2007 have you double checked that you've got a 'session_start()' in the script in question? Quote Link to comment https://forums.phpfreaks.com/topic/35266-sessions-dieing-after-function/#findComment-166596 Share on other sites More sharing options...
Asheeown Posted January 22, 2007 Author Share Posted January 22, 2007 [code] session_start(); header("Cache-control: private"); [/code]Is in Config.php which i have included on the pageI even tried setting the sessions outside the function manually and they stay set Quote Link to comment https://forums.phpfreaks.com/topic/35266-sessions-dieing-after-function/#findComment-166599 Share on other sites More sharing options...
Asheeown Posted January 22, 2007 Author Share Posted January 22, 2007 Does this have anything to do with the function? Quote Link to comment https://forums.phpfreaks.com/topic/35266-sessions-dieing-after-function/#findComment-166624 Share on other sites More sharing options...
Asheeown Posted January 22, 2007 Author Share Posted January 22, 2007 This is a server problem I have figured out but i'm not sure in what config file would this be under? php, apache? Quote Link to comment https://forums.phpfreaks.com/topic/35266-sessions-dieing-after-function/#findComment-166725 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.