Jump to content

cookies between domains


drifter

Recommended Posts

I need to share information between two domains. (NOT SUBDOMAINS)These sites are idential, and on the same server - only thing that changes is the domain name (Stupid I know, Long story involving regulations and politics) - Anyway, I know you can not get a cookie to work between domains.

So Anyway I had the idea to store the data in a text file with an IP address as a name. Then have a cron clearing old files that have not been edited in last X minutes - then I can read this data from both sites as they switch back and forth with out even knowing they are switching.

Obviously the only major risk is the small chance someone is on dynamic IP and disconnects, and someone else connects on same IP and visits same site within X minutes - Obviously since this is a smaller site, the odds are way worse then winning the lottery, and this is not critical financial information or anything, just preferences.

Does this sound like a workable plan? Is there any other ideas for such a problem?
Link to comment
https://forums.phpfreaks.com/topic/29733-cookies-between-domains/
Share on other sites

Does sound like a good plan.  A way to get round the problem of them 'changing ip address' if its dynamic, would be to also store there session number as well as ip.  This wont change unless they exit and the reopen there browser.  As you say the chances are nothing!

Can i ask why your using a text file not a database?  Sounds like it could turn out to be quite a lot of work for cron!  Perhaps you could assign each user and id in a database, and then there session and ip numbers could just be updates using there id as a refrance?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.