Dark Bit Factory &  Gravity

Dark Bit Factory & Gravity

  • September 03, 2010 *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Pages: [1]   Go Down

Author Topic: [JavaScript / PHP / MySQL] Client machine name  (Read 418 times)

0 Members and 1 Guest are viewing this topic.

combatking0

  • Something something something Dark Side!
  • Senior Member
  • ******
  • Karma: 71
  • Offline Offline
  • Posts: 2554
  • Retroman!
    • View Profile
    • WWW
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.
Logged
Coming soon to a screen near you - Retroman, and the Creature from the 3rd Dimension!
Until then, please visit the Pie Movie Database, the Fractigami or the Game Builders' Club pages.

Shockwave

  • good/evil
  • ADMIN
  • Senior Member
  • ********
  • Karma: 357
  • Offline Offline
  • Posts: 15098
  • evil/good
    • View Profile
    • WWW
Re: [JavaScript / PHP / MySQL] Client machine name
« Reply #1 on: January 14, 2010 »
I'll see if I can incorporate it somewhere on the portal :)
Logged
Shockwave ^ Codigos....  Error: Keyboard not attached.... Press F1 to continue.

combatking0

  • Something something something Dark Side!
  • Senior Member
  • ******
  • Karma: 71
  • Offline Offline
  • Posts: 2554
  • Retroman!
    • View Profile
    • WWW
Re: [JavaScript / PHP / MySQL] Client machine name
« Reply #2 on: January 19, 2010 »
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.
Logged
Coming soon to a screen near you - Retroman, and the Creature from the 3rd Dimension!
Until then, please visit the Pie Movie Database, the Fractigami or the Game Builders' Club pages.

Pages: [1]   Go Up
 

 

B l a c k R a i n V.2 by C r i p

Page created in 0.098 seconds with 19 queries.