> -----Original Message-----
> From: Martin [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 18, 2004 10:26 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Weird question - environment data from windows
>
> When you've stopped laughing - is it at all possible to pass Windows
> environment data from a Windows workstation to an PHP application
> running on a Linux server?
You might be able to use Javascript to get some information off of the
client browser and maybe populate some form elements or something, but I
don't know of any way to automatically send environment information to
your linux server. I know Javascript has functions built into it for
getting screen height and width and such. Probably other things as
well.
On the server itself you can use the $_ENV superglobal to get it's
environment information (see the listing in phpinfo()), but getting it
from the browser is a little trickier.
Some things can be obtained in other ways. For example, a
hack/workaround for getting a user's login name on a Windows network
(with a Windows server) is to put this into your code:
$ipaddress = $_SERVER["REMOTE_ADDR"];
$nbtstat = "nbtstat -A ". $ipaddress;
exec ($nbtstat,$result);
foreach ($result as $row) {
if (strpos($row,"<03>")) $username = strtok($row," ");
}
Basically this uses the IP address of the client, does an "nbtstat" on
it and parses all the entries containing "<03>" to get the username.
This works ok.. Unless the person is logged into more than one machine
at a time, then you usually get the machine name instead. Not great,
but if it's your only way of snagging a username, then so be it.
Maybe if you tell us what environment information you're trying to pass
to the server, someone has a workaround like this specifically for that
variable. If it's for just some userset variable, then I'm really not
sure how you'd do that. If you do find a way, please share! Could be
useful to lots of people.
Good luck!
-TG
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php