Show users IP in a graphic – PHP Script
Show IP Display visitor’s IP Address in a graphic with this simple php code.
(Please do not link to this image, it is for demonstration only.)
Your IP Address
![]()
create a new page, copy the text below and save it as image.php (or whatever you wish)
<?php $img_number = imagecreate(275,25); $backcolor = imagecolorallocate($img_number,102,102,153); $textcolor = imagecolorallocate($img_number,255,255,255);<span id="more-1257"></span> 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); ?>
All you’ll need to display on other pages is the code below.
<img src="http://yoursitehere.com/image.php" border="1" alt="" />
More From ashesh
- Removing a directory in php with rmdir()
- How to include a file in PHP
- Creating directories in php with mkdir()
ashesh Recommends
- How To Build A Blog – A Quick Setup Guide (WinsonYeung)
- How To Write A Sales Letter In Under 20 Minutes (WinsonYeung)
Categories: Php

