General PHP Variables Across Mutiple Pages
Posted: Tue Feb 01, 2011 3:21 pm
Hello!
I have one of those questions that generally is best left to the experts who have been developing PHP code over the past few years. There is really no way to get a quick answer myself because without the proper experience (<1 year of experience myself), I would have to spend hours to find an answer out myself.
My question is:
On any given website, i.e. http://www.example.com, a website which has many pages i.e. example.com/page1.php, example/com/page2.php, etc... How long does PHP store new user variables for any given user login?
What I mean is that, when I store a variable $variable on one of the pages as a user for example.com/page1.php, does PHP have a way of holding on to that variable for say, the next user to come in and use it?
My questions relate to $_POST data, $_SESSION data, and $_SERVER and $_GLOBAL variables, specifically.
I am trying to figure out the most efficient way, as in the fastest (but not necessarily the most secure), the most secure (security wise), and what works just IN GENERAL for passing variables between different pages and storing them for later use.
$_SESSION variables tend to time out at a different rate for any given shared web host server configuration (GoDaddy, InMotionHosting, BlueHost, HostGator...etc...)
$_POST variables seem to just work "behind the scenes" for any given "instance" of calling
$_SERVER variables are also temporary?
$_GLOBAL variables I have really no idea about permanent prevalence throughout?
Obviously MySQL is an option here, but are there alternatives?
I have done my best to search this for general use but with little progress.
Any clarification in a general sense for 'any' of these questions are greatly appreciated!!
-Thanks,
Keith
I have one of those questions that generally is best left to the experts who have been developing PHP code over the past few years. There is really no way to get a quick answer myself because without the proper experience (<1 year of experience myself), I would have to spend hours to find an answer out myself.
My question is:
On any given website, i.e. http://www.example.com, a website which has many pages i.e. example.com/page1.php, example/com/page2.php, etc... How long does PHP store new user variables for any given user login?
What I mean is that, when I store a variable $variable on one of the pages as a user for example.com/page1.php, does PHP have a way of holding on to that variable for say, the next user to come in and use it?
My questions relate to $_POST data, $_SESSION data, and $_SERVER and $_GLOBAL variables, specifically.
I am trying to figure out the most efficient way, as in the fastest (but not necessarily the most secure), the most secure (security wise), and what works just IN GENERAL for passing variables between different pages and storing them for later use.
$_SESSION variables tend to time out at a different rate for any given shared web host server configuration (GoDaddy, InMotionHosting, BlueHost, HostGator...etc...)
$_POST variables seem to just work "behind the scenes" for any given "instance" of calling
$_SERVER variables are also temporary?
$_GLOBAL variables I have really no idea about permanent prevalence throughout?
Obviously MySQL is an option here, but are there alternatives?
I have done my best to search this for general use but with little progress.
Any clarification in a general sense for 'any' of these questions are greatly appreciated!!
-Thanks,
Keith