Log in

View Full Version : displaying remote IP address on a page


eclectica
2004-05-25, 13:13
You can find out your remote IP address from various sites. A way to do this on your own site would be to create and upload a .php file that contains this:
<?php
echo $_SERVER['REMOTE_ADDR'];
?>

example (http://www.p2pjihad.org/ip.php)

But php files only work on a Linux or Unix server. It wouldn't work in an html file or as code in your forum signature. To make it work with html you could have the IP address displayed as an image instead.

This site (http://www.allscoop.com/phpcode.php) explains how to create a graphical image of the IP address of users. First you create and webhost a php file on a Linux/Unix server with GD image tools enabled somewhere like this:
<?php
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,102,102,153);
$textcolor = imagecolorallocate($img_number,255,255,255);

imagefill($img_number,0,0,$backcolor);
$number = " Your IP is $_SERVER[REMOTE_ADDR]";

Imagestring($img_number,10,5,5,$number,$textcolor);

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>

example (http://www.p2pjihad.org/image.php)

Even though it is a php file it can be treated like an image on a forum using the [.img.] tags, or within an html document using the <img src> tags.
http://www.p2pjihad.org/image.php

eclectica
2004-05-26, 12:13
Check this out. The quality of the picture is not that good though.
<?php
$img_number = imagecreate(600,25);
$backcolor = imagecolorallocate($img_number,255,0,0);
$textcolor = imagecolorallocate($img_number,255,255,255);

imagefill($img_number,0,0,$backcolor);
$number = "Your IP address $_SERVER[REMOTE_ADDR] has been logged by the RIAA";

Imagestring($img_number,10,5,5,$number,$textcolor);

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>

example (http://www.p2pjihad.org/riaa.php)

eclectica
2004-06-10, 04:17
I discovered some more codes and put them into a php file. I don't know what I'm doing but I just fooled around with things until I got something working. I am a script kiddie.

<?php
echo $_SERVER['HTTP_REFERER'];
echo $_SERVER['REMOTE_ADDR'];
echo $_SERVER['REQUEST_URI'];
echo $_SERVER['HTTP_HOST'];
echo $_SERVER['HTTP_USER_AGENT'];
echo $_SERVER['REDIRECT_STATUS'];
?>

example (http://www.p2pjihad.org/echo.php)