Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 09-23-2005, 20:00   #1 (permalink)
Daniel Ruscoe
Civilians

 
Default Sessions over subdomains

Can it be done?

I have a site written in PHP with a members section that uses sessions.
Fairly ordinary stuff, but the sessions always end up being cleared when
I move between subdomains on the site.

Some Googling threw up some vague references to cookies, but nothing
really conclusive.

Has anybody successfully got around this little problem?

Ta,

Dan
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 09-23-2005, 20:00   #2 (permalink)
Charles Sweeney
Civilians

 
Default Re: Sessions over subdomains

Daniel Ruscoe wrote

> Can it be done?
>
> I have a site written in PHP with a members section that uses

sessions.
> Fairly ordinary stuff, but the sessions always end up being cleared

when
> I move between subdomains on the site.
>
> Some Googling threw up some vague references to cookies, but nothing
> really conclusive.
>
> Has anybody successfully got around this little problem?


I had a similar problem that drove me totally bonkers, until I spent a
long time using trial and error, Googling to no avail, then eventually
sussed it!

This might not work for you, but in my case the solution was to start
the session at the top level, i.e:

http://mysite.com

NOT a subdomain like:

http://www.mysite.com

If I started it at the top, then it would work lower down. However, the
converse is not true. When I initiated the session here:

http://www.mysite.com

The values were not available here:

http://mysite.com

Can you start your sessions in http://mysite.com/anypage.php?

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-23-2005, 20:00   #3 (permalink)
Brian Wakem
Civilians

 
Default Re: Sessions over subdomains

Daniel Ruscoe wrote:

> Can it be done?
>
> I have a site written in PHP with a members section that uses sessions.
> Fairly ordinary stuff, but the sessions always end up being cleared when
> I move between subdomains on the site.
>
> Some Googling threw up some vague references to cookies, but nothing
> really conclusive.
>
> Has anybody successfully got around this little problem?
>
> Ta,
>
> Dan



You have to set the domain attribute of the cookie correctly.

A domain mysite.com would match hostnames subdomain.mysite.com as well as
www.mysite.com


--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-23-2005, 20:00   #4 (permalink)
Daniel Ruscoe
Civilians

 
Default Re: Sessions over subdomains

In article <Xns96DAE40399405mecharlessweeneycom@130.133.1.4 >, Charles
Sweeney says...
> Daniel Ruscoe wrote
>
> > Can it be done?
> >
> > I have a site written in PHP with a members section that uses

> sessions.
> > Fairly ordinary stuff, but the sessions always end up being cleared

> when
> > I move between subdomains on the site.


> I had a similar problem that drove me totally bonkers, until I spent a
> long time using trial and error, Googling to no avail, then eventually
> sussed it!
>
> This might not work for you, but in my case the solution was to start
> the session at the top level, i.e:
>
> http://mysite.com
>
> NOT a subdomain like:
>
> http://www.mysite.com
>
> If I started it at the top, then it would work lower down.


That looks like a brilliant idea, but it didn't work for me

Thanks anyway, Charles. I appreciate it!

Dan
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-23-2005, 20:00   #5 (permalink)
Charles Sweeney
Civilians

 
Default Re: Sessions over subdomains

Daniel Ruscoe wrote

> In article <Xns96DAE40399405mecharlessweeneycom@130.133.1.4 >, Charles
> Sweeney says...
>> Daniel Ruscoe wrote
>>
>> > Can it be done?
>> >
>> > I have a site written in PHP with a members section that uses

>> sessions.
>> > Fairly ordinary stuff, but the sessions always end up being cleared

>> when
>> > I move between subdomains on the site.

>
>> I had a similar problem that drove me totally bonkers, until I spent

a
>> long time using trial and error, Googling to no avail, then

eventually
>> sussed it!
>>
>> This might not work for you, but in my case the solution was to start
>> the session at the top level, i.e:
>>
>> http://mysite.com
>>
>> NOT a subdomain like:
>>
>> http://www.mysite.com
>>
>> If I started it at the top, then it would work lower down.

>
> That looks like a brilliant idea, but it didn't work for me
>
> Thanks anyway, Charles. I appreciate it!


No problem. I figured it might not suit you, but hopefully give you
some pointers.

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Multiple sessions in powerpoint Troy @ TLC Creative Microsoft Applications 2 07-29-2005 20:00
Web log analyzer?? counts unique JSESSIONID as sessions ? chsmith@speakeasy.net Web Design 4 07-22-2005 16:00
Making Access multithread IE6 sessions. =?Utf-8?B?UGhpbGlidXN0ZXI=?= Web Design 0 11-18-2004 13:00
Subdomains, the truth and all that ..... William Tasso Web Design 35 06-15-2004 12:47


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 22:17.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.90842 seconds with 19 queries