Jump to content

sharing session data with subdomains


phpsycho

Recommended Posts

I have it set up to share sessions with all of the subdomains I have.

The structure of my site is..

mainwebsite.com  => include.mainwebsite.com => js/bar.js => ajax/onlinefriends.php => mysqlconnect/session_start.php => output: user is offline.

 

so every page I have pulls session_start from include.mainwebsite.com. the mainwebsite.com sees that there is an opened session, but when it comes to include.mainwebsite.com it just doesn't see any opened sessions when reading the onlinefriends.php

 

I have in apache sites enabled the header option to allow the js to run across my domains.

 

any idea why the other files can find the session but onlinefriends.php just keeps creating new blank sessions?

Link to comment
https://forums.phpfreaks.com/topic/243957-sharing-session-data-with-subdomains/
Share on other sites

Without a specific example of what you are doing in your code, I am guessing that you are using a URL in an include statement.

 

That DOES NOT include the php code/data into the current script. It only includes any output from that file, the same as if you browsed to that file.

 

You need to include php code/data using a file system path/filename.

nah I am using include() with the location to the file not a url. include('/var/www/include.website.com/connection.php');

 

in the onlinefriends.php it includes session start and a mysql connection and just a simple if users session userid is not set then echo failure and exit;

 

It should be set.. it shows that its set in other files. there is two files in the same directory that both show that the session userid is not set. all other files are fine.

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.