473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Cross-Domain Cookies

Hi I am trying to set up cross domain cookies on a server I have running
that currently has 2 domains running on it (on different IPs). Basically I
have a forums site (using UBB threads) and I want to users to be able to use
the forum login and password from the main site and then if they go to the
forum site they are already logged in to that as well.

I have tried followed this article:
http://www.phpbuilder.com/columns/ch...28.php3?page=3

What I have done is:
1. Put the following code at the top of the .php file where I create the
cookie (on the forum site) and in the .php file where my login code is on
the main site:

/////////////////////////////////////////////////////////
Support cross-domain cookies... */

// If the GET variable has been set, and it differs from the cookie
// variable, then use the get variable (and update the cookie)
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS;
if (isset($sessionid) && isset($HTTP_GET_VARS['sessionid']) &&
($HTTP_COOKIE_VARS['sessionid'] != $HTTP_GET_VARS['sessionid'])) {
SetCookie('sessionid', $HTTP_GET_VARS['sessionid'], 0, '/', '');
$HTTP_COOKIE_VARS['sessionid'] = $HTTP_GET_VARS['sessionid'];
$sessionid = $HTTP_GET_VARS['sessionid'];
}
//////////////////////////////////////////////////////////

2. Set up the
domains['domain1'] = "http://<site domain>/-$sessionid-";
$domains['domain2'] = http://<forums domain>/-$sessionid-;
code in an file that is "required" by all the php scripts

3. Done the apache server stuff

However when I do something like
echo $domains['domain2'];
in the file where my login code is (on the main site) the output is:
http://<forums domain>/--
(there is no sessionid in the URL)
Could someone either tell me where I am going wrong or point me to another
article that maybe explains what I need to do a bit better. I am pretty
certian my problem is to do with teh $sessionid in step 1 above, I never set
it to equal anything so the code in the if statement never gets carried out.
I also just want to make sure that cross domain cookies can be used in this
situation

Anyway, any help would be much appriciated
Angus
Jul 17 '05 #1
1 8426
"Angus SC2" <a@b.com> wrote in message news:2q************@uni-berlin.de...
Hi I am trying to set up cross domain cookies on a server I have running
that currently has 2 domains running on it (on different IPs). Basically
I have a forums site (using UBB threads) and I want to users to be able to
use the forum login and password from the main site and then if they go to
the forum site they are already logged in to that as well.

I have tried followed this article:
http://www.phpbuilder.com/columns/ch...28.php3?page=3


Oops, that's the 3rd page I've posted, here is the proper URL:
http://www.phpbuilder.com/columns/ch...28.php3?page=1

Thanks
Angus
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
3
by: rollasoc | last post by:
Hi, Doing a bit of system testing on a Windows 98 laptop. (.Net 1.1 app). Did a bit of testing. Loaded a previously saved file. A gray box appeared with the text and buttons all white...
4
by: David Peach | last post by:
Hello, hope somebody here can help me... I have a query that lists defects recorded in a user defined date range. That query is then used as the source for a Cross Tab query that cross-tabs count...
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
7
by: Scott M. | last post by:
How can I disable the cross-site scripting check for one particular page of a site?
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
3
by: jlamanna | last post by:
I was wondering if there was a utility that could tell you when your C# application is making cross-apartment COM calls. I have a fairly large application that makes extensive use of a 3rd party...
1
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I...
6
by: Robert Bravery | last post by:
Hi all, Can some one show me how to achieve a cross product of arrays. So that if I had two arrays (could be any number) with three elements in each (once again could be any number) I would get:...
7
by: Charles | last post by:
I'd like to develop a simple cross-platform application in C++. I'd like it to run in Windows, OS X, PC-BSD and Linux. From my research, it seems I should use Qt or Gtk as a graphical library. Do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.