Hi Guys,
I'm trying to do something a little tricky and trying to find the quickest code to do it.
I have 2 PHP pages con-currently running on the one Web Page...
Both these pages share the same sessionID as they are from the same Browser page.
What I basically want is to beable to change the value of a session variable in one page, and beable to pick up that change in the other page.
I have used MySQL / Flat files to pass information between these two pages and have even thought of using Sockets, but scaleability is an issue with that and MySQL is slower than a straight pass to a Session variable.
Basically one PHP Script is constantly running in a While loop and never ends, it checks the session of any updated variables which in my code, is changed from the other page.
I do have this working right now, but its a bit messy.
In order for the never-ending script to see any changes made to the Session, you basically have to Refresh the Session to receive the changes.
So basically my code now is:
while(true)
{
session_start();
if(isset($_SESSION['MYVAR']))
{
//Do Something
break;
}
session_destroy();
sleep(1);
}
This works fine but Im wondering whether there is a better way? Session_Start will only allow you to call it once, unless its destroyed first, so I really need a session_refresh(); if it existed...anyone have any ideas?
Thanks heaps.
Mark