- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
hi guys i’m new to css-tricks forum. I have a problem in php its some what advanced. I want my session to be accessible by all my sub domain. That is if a user login to http://www.example.com then the user should also be logged in sub.example.com . I used session_set_cookie_params(time() + 3600, ‘/’,’.domain.com’,false,false) it works fine in http://www.example.com and example.com but not in m.example.com . Can anyone help of out?
The only thing I can think of is if you use $_SESSION to store the data it should keep the person logged in across the main and sub domains.
@karlpcrowley you mean to change php configuration. I tried it but after changing it the session is not even stored . So only i tried to do it via script
@blackhawkso no it only works in the domain or sub domain where we store the session.
Thanks for the replies.
@karlpcrowley i tried to set it before but it failed . Now i use something like this
session_set_cookie_params(time() + 3600,'/','.example.com');
session_start();
I tried to use example.com instead of .example.com but now i can’t even login.
Sorry just posted a link but then found out that it don’t work in PHP so ignore me lol
I’ve just found this link for a tutorial on a way to get cookies to work cross domains