Muffinresearch Labs by Stuart Colville

PHP tip of the week: Getting IP addresses | Comments (2)

Posted in Code on 2nd December 2004, 1:07 pm by Stuart

Extracting the gateway IP address is straightforward:

$ip = $_SERVER['REMOTE_ADDR'];

To obtain the hostname of the gateway IP address just do the following:

$hostname = GetHostByName($_SERVER['REMOTE_ADDR']);

To get the local IP address of your user can sometimes be useful too. Here’s how:

$localip = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];

Post Tools

Comments: Add yours

1. On March 28th, 2005 at 4:57 pm Q... said:

I wanted to cite some of your posts in my forum. Couldn’t find your perma-links

2. On March 29th, 2005 at 8:27 am Stuart Colville said:

Hi, I’m as we speak working on the first draft of Joornal which will be a re-written blogging script to replace this one. There’s no question that permalinks will become a feature of this. Watch this space.







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Ubuntu: Turn off changing workspace with mouse wheel|(0)

I found the changing with the workspace with the mouse wheel really annoying. To disable it go to System => Preferences => CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck “Viewport Switcher” which is under the “Desktop” heading.

Ubuntu: Mounting a TrueCrypt volume at startup or from the CLI|(0)

All you need is a mount point e.g: mkdir /media/ and then use the following: truecrypt /path/to/truecrypt/diskimage /media/. This is handy when you want to mount a truecrypt image at start-up or just do it quickly from a shell. It’s far more direct than using the GUI.

Photos on Flickr

© Copyright 2004-09 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.756s.