breeze351
asked on
$_SERVER variable arrays
If $_SERVER vars are an array, what would the code look like to access each var such as 'REQUEST_TIME'?
To get a specific item
$_SERVER['REQUEST_TIME']
ASKER
Yes
But since there are multiple users logged in, how do I itterate through all the $_SERVER['REQUEST_TIME'] vars. REQUEST_TIME is just an example, it's really not what I'm looking for. I'm going to set a server var called REMOTE_USER. That is what I'm going to looking for to stop someone from logging twice.
But since there are multiple users logged in, how do I itterate through all the $_SERVER['REQUEST_TIME'] vars. REQUEST_TIME is just an example, it's really not what I'm looking for. I'm going to set a server var called REMOTE_USER. That is what I'm going to looking for to stop someone from logging twice.
how do I itterate through all the $_SERVER['REQUEST_TIME'] vars.I'm not sure that you can. All the $_SERVER values are set when the page request is received. Note that these really are SERVER values that are passed to PHP in an array. There isn't a collection of them that you can 'iterate' thru. They are not saved somewhere.
Here's my simple PHP page to display the SERVER values on the current server. Each server can have a different set of values. Though many are common, they are not all universal.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHP Server Variables</title>
</head>
<body><h1>PHP Server Variables</h1>
<?php
//reset($_SERVER);
foreach($_SERVER as $key => $value) {
echo "<b>$key :</b> $value<br />\n";
}
print_r ($_POST);
?>
</body>
</html>
ASKER
I'm looking for a var that I can set across the entire web site. Something like when user a user logins I can save the login regardless of the machine and then go back and look at the data I collected.
If this is impossible, I think I'm going to have to create a table to do it.
If this is impossible, I think I'm going to have to create a table to do it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it. Pain in the butt butt I can do it.
Sidebar note: You can see all of the $_SERVER variables with this:
<?php var_dump($_SERVER);
Open in new window