Cross domain PHP Sessions

后端 未结 4 2220
感动是毒
感动是毒 2020-11-27 22:11

I am building a site which allows a user to point a CNAME record at my site to run their \"profiles\", this allows your OWN domain name to load your profile on my site.

4条回答
  •  生来不讨喜
    2020-11-27 22:28

    not sure I understand your problem. Is it something like another domain calling something like www.userprofiles.com/profile.php?userid=1 and displaying the results? In this case profile.php will generate a new session id whenever it gets called. You need to set different ids for every external domain using your site and change profile.php to something like:

    if( isset($_REQUEST['sid']) ) session_id($_REQUEST['sid']);

    session_start();

    and call the script like this www.userprofiles.com/profile.php?userid=1&sid=somesessionid1234

提交回复
热议问题