REMOTE_ADDRとgetenv()関数がポイント
source <?php $IP = getenv("REMOTE_ADDR"); print "あなたのIPアドレスは<font color='red'>" . $IP . "</font>です"; ?>