Login Register


[PHP Image] Show IP filter_list
Author
Message
[PHP Image] Show IP #1
Welcome HC,
today i will show how to create a php image file that will show your ip! Example:
[Image: ip.php]
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 ~


[PHP Image] Show IP #2
Welcome HC,
today i will show how to create a php image file that will show your ip! Example:
[Image: ip.php]
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 ~


RE: [PHP Image] Show IP #3
Very cool, thanks for the tutorial. This will come in handy later!


RE: [PHP Image] Show IP #4
Very cool, thanks for the tutorial. This will come in handy later!


RE: [PHP Image] Show IP #5
(10-19-2012, 02:41 PM)bluedog.tar.gz Wrote: Very cool, thanks for the tutorial. This will come in handy later!
you are welcome mate! enjoy Biggrin


RE: [PHP Image] Show IP #6
(10-19-2012, 02:41 PM)bluedog.tar.gz Wrote: Very cool, thanks for the tutorial. This will come in handy later!
you are welcome mate! enjoy Biggrin


RE: [PHP Image] Show IP #7
Thanks works great just tried
I am N000TTTT what You think!!!!!!


RE: [PHP Image] Show IP #8
ya bro working fine showing ip ver fine


RE: [PHP Image] Show IP #9
great job my brother


RE: [PHP Image] Show IP #10
ImageJPEG can also work, but people tend not to use it due to the fact of the image quality, and what people don't realize is that's fixable.

ImageJPEG($Image, NULL, 100);

Change 100 to 1 and you'll see what I mean.
[Image: siggy.php?uid=66857]








Users browsing this thread: