vampke Posted September 1, 2008 Share Posted September 1, 2008 Hi, I have written a script that uses sessions. Everything seems to work just fine here on my local PC (wamp server). Now I have uploaded everything to my webserver (shared hosting) things are not working as expected. I can't figure out why. After loging in a session is created: if($auth_check==1){ $_SESSION['auth']=true; $_SESSION['timeout']=time()+3600; $member=mysql_fetch_array($member_result); $_SESSION['id']=$member['id']; $_SESSION['username']=$member['username']; } The script then redirects to index.php which the session values if(($_SESSION['auth'] && $_SESSION['timeout']>time())) This seems to be working, but if i reload the page or go to another page, the session-id is not passed on, while the username is. I can't figure out why! Anyone any ideas where I should start to look? Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted September 1, 2008 Share Posted September 1, 2008 Is session support enabled in your php configuration? Is you session save path correct? Quote Link to comment Share on other sites More sharing options...
waynew Posted September 1, 2008 Share Posted September 1, 2008 Are you sure: session_start(); Is at the top of every page? Quote Link to comment Share on other sites More sharing options...
vampke Posted September 1, 2008 Author Share Posted September 1, 2008 php should be installed properly, i can't see any important differences between local pc and server config with phpinfo() session_start is at the top of all the pages, as I said: it works locally and the username is passed on at the server, just not the id Quote Link to comment Share on other sites More sharing options...
blinky001 Posted September 1, 2008 Share Posted September 1, 2008 I'm not an expert on session issues, but have you tried renaming the id variable to say user_id as your shared hosting may have a 'helpful' custom extension that uses / reserves the $_SESSION['id'] variable. Worth a go? Quote Link to comment Share on other sites More sharing options...
vampke Posted September 2, 2008 Author Share Posted September 2, 2008 blinky, you are way too modest! this seemed to do it. Thanks ever so much!! 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.