Ben Sinclair wrote: >I want to retain some data across my sites, which have different domain names. >I can't use cookies because they rely on the domain name, and I'd rather not >pass the information on every link Any suggestions? > I've been thinking about this recently and here's what I came up with:
Have a domain or subdomain dedicated souly to user sessions, for example: session.yourdomain.com Whenever a user visits a page on ANY of your domains (currentdomain.com in this example), check if they have a cookie set. If they don't: 1. Create a session for that user with a unique session ID 2. Send them a page which includes a single pixel gif image looking like this: <img src="http://session.yourdomain.com/pixel.php?s=zs9s0a8fs6fudisdfsf8dfdfsfs&domain=currentdomain.com" width=1 height=1> ( Remember - session.yourdomain.com has access to ALL cookies set for session.yourdomain.com ) 3. session.yourdomain.com CHECKS to see if this user has a cookie set. If they DO then they are already known to session.yourdomain.com - session.yourdomain.com records the fact that this user is logged on to currentdomain.com as zs9s0a8fs6fudisdfsf8dfdfsfs in a shared database. 4. If session.yourdomain.com does NOT find a cookie then it means this is a new user who is not "known" to the system yet. session.yourdomain.com creates a cookie recording the user, and notes that the user is also logged in to currentdomain.com with whatever session ID was set over there. This is all pretty complicated but the end result is that the session.yourdomain.com domain knows about every user, and a shared database (accessible by all of your domains) maintains a record of each unique user (as according to the session.yourdomain.com cookie) and what their session is for each of the different domains. Final note: http://session.yourdomain.com/pixel.php needs to actually send a pixel to the client browser - this can be done with the following code in the zend code library: http://www.zend.com/codex.php?id=193&single=1 Cheers, Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php