Reply
Quick Cookie Question
Old 11-10-2004, 12:19 AM Quick Cookie Question
foobar's Avatar
Extreme Talker

Posts: 225
Just a quick question on cookies.

I've been wondering about this for a while, and before I start coding I want to know: I'm working on a site that I want to streamline in part with the forum (vBulletin). I want to know if the cookies created by the forum scripts will be accessible from the site script.

Basically, if a user logs in to the forum, and then goes to the site section (or vice-versa), will the cookies created by the login on one be available to me on the other?

I know Cookies are only sent when the domain matches it. The site and forum are on the same domain (although the forum is in a subdomain, though basically a sub-domain is just a quick way to access a directory).

Thanks in advance for the help.
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
When You Register, These Ads Go Away!
Old 11-10-2004, 12:30 AM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
They should be carried over. The cookies should work accross subdomains as long as the path and domain is set correctly. Note this from the vB ACP:
Quote:
Cookie Domain
The domain on which you want the cookie to have effect. If you want this to affect all of example.com rather than just forums.example.com, enter .example.com here (note the 2 dots!!!). You can leave this setting blank.
So you might have to change the default cookie domain to .example.com.

Also worth mentioning, not all users browse with cookies enabled. The cookies keep track the session ID's instead of putting those ugly 32 characters within the URL, but if a user doesn't have cookies enabled then they may have trouble keeping their session if you don't put it in the URL. If you are simply include()'ing the global vB files for your custom scripts, then $session[sessionurl] will hold the session data that is to be inserted into the URL. It contains s=<SID>&amp;, so it should be before any other query data you need:
PHP Code:
echo "<a href='index.php?$session[sessionurl]go=aboutus'>About Us</a>"
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 11-10-2004, 12:35 AM
foobar's Avatar
Extreme Talker

Posts: 225
Alright. Thanks a lot Chroder
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Reply     « Reply to Quick Cookie Question
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11954 seconds with 12 queries