steviez Posted April 17, 2008 Share Posted April 17, 2008 Hi, I am trying to use a session login script but everytime i login and try to go to my.domain.com/index.php it redirects me to the login page as if the session was not set... but if i go to www.mydomains.com/index,php it works fine as it should. Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/ Share on other sites More sharing options...
pocobueno1388 Posted April 17, 2008 Share Posted April 17, 2008 Are you calling session_start() at the top of ALL your pages? Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519511 Share on other sites More sharing options...
steviez Posted April 17, 2008 Author Share Posted April 17, 2008 yes, like i say.. if i access the page via www. it works but if i access it via a sub url it wont. Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519594 Share on other sites More sharing options...
mofm Posted April 17, 2008 Share Posted April 17, 2008 i dont think ther is anything wrong wioth the code but if u post it i can tell you ... maybe its somethinging to do with the server ? Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519603 Share on other sites More sharing options...
steviez Posted April 17, 2008 Author Share Posted April 17, 2008 the code works the same on 2 different servers. I think it is a sub domain thing? Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519605 Share on other sites More sharing options...
mofm Posted April 17, 2008 Share Posted April 17, 2008 ur asking us to help you on somthing that we havnt sen i.e help me my code dont work the page comes up black whats wrong ..... show us swher ur code is going worng and you may get a fix thanks mofm Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519733 Share on other sites More sharing options...
steviez Posted April 17, 2008 Author Share Posted April 17, 2008 All fixed now, i had to add this line of code to the top of my script so it worked accross the whole of my site: <?php ini_set("session.cookie_domain", ".mydomain.com"); ?> Thanks Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519831 Share on other sites More sharing options...
revraz Posted April 17, 2008 Share Posted April 17, 2008 Sounds like you had some absolute paths in your code for redirects instead of relative. Link to comment https://forums.phpfreaks.com/topic/101569-solved-help-with-sessions/#findComment-519899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.