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>



Django Admin Ominigraffle Stencil|(0)

Colleague Alex Lee has created a nice stencil for omingraffle with the Django Admin UI components, perfect for wireframing customised admin screens. For more details and to download the stencil see Alex’s Blog csensedesign.co.uk

Scrolling issue in Leopard cured with PRAM reset|(0)

Having got a shiny new MacBook Pro to work on at my new workplace I’ve had a couple of strange problems with Leopard. The main issue was that when scrolling the graphics was suffering what appeared to be a strange redraw problem when scrolling. After googling I found this post:“Distorted graphics in Leopard when scrolling”.

Fortunately for me: resetting the PRAM has worked and the flickering issue has gone for now.

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by 1&1 This page was baked in 0.707s.