aussiefly Posted February 20, 2008 Share Posted February 20, 2008 Hi everyone! This is probably a simple fix but because im a newb and still learning its beyond me a bit. I'm currently working on a script that involves members logging in and members areas etc. So i'm clearly using sessions to store user variables and data etc. Now from my main users homepage there is a link to go to a script to change their details like email address etc....lets call it settings.php So they are on members.php and then click a standard href html link to go to settings.php to update their user details. Problem is that when I try to access the session variables on the settings.php page....they are blank...ive tried echoing them out and seeing what comes up and they are empty objects etc...i dont get any errors but they are empty. So i did a bit of reading and found that the settings.php is considered to be a seperate application and therefore the session would be a new unique session and not be able to read the variables from the prior script...members.php So my question is...how do i forward my users to settings.php and get them to update their details with/without those session variables persisting. Is there a way to forward them to that page when they click a link so that it doesnt create a new session? I did try to use a HEADER redirect to send them there upon clicking the button but got the headers already sent error. I suspect there is an easy way to do this and its probably got to do with me using a straight html link to send them to settings.php so any ideas??? Quote Link to comment Share on other sites More sharing options...
rofl90 Posted February 20, 2008 Share Posted February 20, 2008 Use $_GET variables would be my way to go, a i mean just make like a 10,000 line one page website ..did yo session_end/close() can't remember what it is ?? Quote Link to comment Share on other sites More sharing options...
mainewoods Posted February 20, 2008 Share Posted February 20, 2008 are you saying that they are able to log in and move around the members area and stay logged in but then when you try go to settings.php you can't access the session variables? If that is the case, is settings.php in a different directory? Session variables can be set to work on only part of the directory tree.: session_set_cookie_params() http://www.php.net/manual/en/function.session-set-cookie-params.php use session_get_cookie_params() to get the current session cookie parameters http://www.php.net/manual/en/function.session-get-cookie-params.php the session variables should be accessable when you just click a regular link to go to another page, that's the point of session variables. Quote Link to comment Share on other sites More sharing options...
aussiefly Posted February 20, 2008 Author Share Posted February 20, 2008 yup when they are logged in on the members section and click a regular link to settings.php which is in the same dir...the session variables appear to be empty. It truly is quite weird....i even have the session start on the new page and everthing in place...but they just appear to not have any values entered Quote Link to comment Share on other sites More sharing options...
aussiefly Posted February 20, 2008 Author Share Posted February 20, 2008 ok i fixed it...appears it was a stupid error on my part....where you place the session start seems to make a difference. thanks for all the advice everyone 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.