Page 1 of 1

How to get host name, Operating system User.....

Posted: Thu May 10, 2007 6:36 am
by pcoder
Hi,
How to get the User host, Operating System User host name using PHP.
And how to give unique session id for each login of user.
Thanks

Posted: Thu May 10, 2007 6:42 am
by hawleyjr
The majority of this question can be answered by the $_SERVER variable;

Code: Select all

echo '<HR><PRE>'; print_r($_SERVER); echo '</PRE>';

Posted: Thu May 10, 2007 6:42 am
by dhrosti
http://uk2.php.net/manual/en/reserved.v ... les.server explains the $_SERVER superglobal, where you can find user info.

As far as i'm aware, a unique session id is autmatically generated for you, accessed through the 'SID' constant.

Posted: Thu May 10, 2007 7:14 am
by pcoder
Is it possible to get the host name of client computer?

Posted: Thu May 10, 2007 7:36 am
by dhrosti

Code: Select all

// Host name. This might need setting up though, the details are in the link i gave you.
$_SERVER['REMOTE_HOST'];

// IP address of client.
$_SERVER['REMOTE_ADDR']; 

//Or...
$hostName = gethostbyaddr($_SERVER['REMOTE_ADDR']);