• Welcome to Dark Bit Factory & Gravity.
 

[JavaScript / PHP / MySQL] Client machine name

Started by combatking0, January 14, 2010

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

combatking0

I've been writing a fault & equipment database at work, and I discovered a PHP function which effectively runs an NSLookup based on the client's IP address.

The returned hostname is then checked in the database to find out which room the user is posting from, allowing the user to report a fault in their room with a single click, rather than looking for their room from a big drop-down box.

I'll put some sample code up on Tuesday when I get back into work.

The PHP command is:
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);

No good for internet, but great for intranet scripting.
You are our 9001st visitor.
Challenge Trophies Won:

Shockwave

I'll see if I can incorporate it somewhere on the portal :)
Shockwave ^ Codigos
Challenge Trophies Won:

combatking0

Work won't let me paste the source code on the internets for security purposes, but there really isn't much else to it than I have already posted - it's what you do with the returned data that counts.
You are our 9001st visitor.
Challenge Trophies Won: