[PHP Image] Show IP 10-19-2012, 02:38 PM
#1
Welcome HC,
today i will show how to create a php image file that will show your ip! Example:
![[Image: ip.php]](http://ezix.ciki.me/ip.php)
So here it goes!
•Requirements:
Webhost
• Open notepad and paste the following code:
• Save it as .php format
• Upload the file to your webhosting site
• If you saved the file as example.php then your link should be
www.yourwebhost.com/example.php
• Done! Open it and it will show your ip in img format!
Note: This can be used in everywhere.
And you can change the color of background according to what you like in this case it is darkgrey. How to edit the color? here is the answer: Edit the following part of the code
$background = imagecolorallocate( $my_img, 35, 35, 35 );
The numbers indicate the color RGB format!
You can do the same for texts as well!
Enjoy ~
today i will show how to create a php image file that will show your ip! Example:
So here it goes!
•Requirements:
Webhost
• Open notepad and paste the following code:
PHP Code:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$my_img = imagecreate( 250, 18 );
$background = imagecolorallocate( $my_img, 35, 35, 35 );
$text_colour = imagecolorallocate( $my_img, 255, 255, 0 );
$line_colour = imagecolorallocate( $my_img, 128, 255, 0 );
imagestring( $my_img, 4, 5, 1, "Your IP Is: $ip",
$text_colour );
imagesetthickness ( $my_img, 7 );
header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $line_color );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?>• Save it as .php format
• Upload the file to your webhosting site
• If you saved the file as example.php then your link should be
www.yourwebhost.com/example.php
• Done! Open it and it will show your ip in img format!
Note: This can be used in everywhere.
And you can change the color of background according to what you like in this case it is darkgrey. How to edit the color? here is the answer: Edit the following part of the code
$background = imagecolorallocate( $my_img, 35, 35, 35 );
The numbers indicate the color RGB format!
You can do the same for texts as well!
Enjoy ~
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)