![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hello, I'm having trouble to setup one session that will work for subdomains and the main domain... I've read a lot about using various ways like init_set() or set.cookie_domain or using .htaccess and some others I can't remember... Everyone posting examples on the net are people who are having trouble with this session subdomain thing and I've tried some solutions but they don't seem to work. Please suggest something without having to access php.ini... and the same problem goes for cookies... but I guess if I can figure out sessions then cookies will be ok.. thanks Simon | |||
|
| Advertisements |
| | #2 | ||
| ..oO(Kentor) >I'm having trouble to setup one session that will work for subdomains >and the main domain... I've read a lot about using various ways like >init_set() or set.cookie_domain or using .htaccess and some others I >can't remember... Everyone posting examples on the net are people who >are having trouble with this session subdomain thing and I've tried >some solutions but they don't seem to work. What have you tried so far? According to the manual it should be quite easy. Setting the cookie domain to something like example.com instead of www.example.com should make it available for the entire domain including subdomains, so you can access the session from there as well as from the main domain. Micha | |||
|
| | #3 | ||
| On 11 May, 04:55, Kentor <ken...@gmail.com> wrote: > Hello, > > I'm having trouble to setup one session that will work for subdomains > and the main domain... I've read a lot about using various ways like > init_set() or set.cookie_domain or using .htaccess and some others I > can't remember... Everyone posting examples on the net are people who > are having trouble with this session subdomain thing and I've tried > some solutions but they don't seem to work. Please suggest something > without having to access php.ini... and the same problem goes for > cookies... but I guess if I can figure out sessions then cookies will > be ok.. thanks > > Simon $expiry = time()+900; $path = '/'; $domain = server.com session_start(); setcookie(session_name(),session_id(), $expiry, $path,$domain); this way you are in control of what domain is used for the cookie which in turn is used to send the session identifier, if you use the more restrictive subdomain (as michael said) then the session id cannot be accessed from the other sub domains on your server, unless you take steps to write your own session-data-pass-along code, but the above is easier huh! | |||
|
| | #4 | ||
| On 11 May, 04:55, Kentor <ken...@gmail.com> wrote: > Hello, > > I'm having trouble to setup one session that will work for subdomains > and the main domain... I've read a lot about using various ways like > init_set() or set.cookie_domain or using .htaccess and some others I > can't remember... Everyone posting examples on the net are people who > are having trouble with this session subdomain thing and I've tried > some solutions but they don't seem to work. Please suggest something > without having to access php.ini... and the same problem goes for > cookies... but I guess if I can figure out sessions then cookies will > be ok.. thanks > > Simon sorry for typo $domain = 'server.com'; | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: sessions, subdomains |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| Featured Websites | ||||
|