I have a domain. Let's call it www.example.com for this question. Thanks to the wonders of how I have things setup and/or Wordpress, if I were to type in example.com it would redirect me to www.example.com and Wordpress would do its thing. I also have a subdomain called members.example.com in which I have built a rather elaborate system using CodeIgniter into the folder /members off of public_html.
In a perfect world, what I would like to do is be able to put some php code into Wordpress that would allow someone reading the "www" side of things to be able to determine if they are also currently logged in on the "members" side of things. I know the CodeIgniter session persists so that whenever I jump on to the members side, I'm still logged in. My first thought was to put together a quick page in CI that did this:
public function isLogged()
{
$x = "off";
if ($this->session->userdata('memberKey') != 0) {
$x = "on";
}
echo $x;
}
Then, whenever I would run the link members.example.com/login/isLogged , I would always get either "off" or "on" to determine if I was in or not. The memberKey would be either 0 for not logged in, or a number based on someone's corresponding key in the database. My hope was that I would be able to run something like THIS from the www side (within Wordpress)
$homepage = file_get_contents('http://members.example.com/login/isLogged');
...and I would be able to act on whether the person was logged in or not. Well, obviously the flaw here is that when I call the above function, I'm always going to get "off" as my result because I'm making that call from the server, and not from the client in question that needs this information.
What would be the most elegant solution to being able to read this information? Is there a way to read cookies cross platform?