Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP Image: How To Show A User Their IP In Your Signature.
#1
First of all, I found this on http://www.thesitewizard.com/ so credits go to them for that but I'm writing this out myself.

Requirements:
  • A Domain
  • Hosting For It
  • Patience
  • Spare 20 Minutes On Your Hands

Okay first of go to your public_html in your cPanel, make a new directory called "img".

Make a file called "index.php" (this then becomes the default page for the img directory)

Inside the index.php, enter this following code:

PHP Code:
<?php
$ip 
$_SERVER['REMOTE_ADDR'];
$my_img imagecreate25080 );
$background imagecolorallocate$my_img102102102 );
$text_colour imagecolorallocate$my_img255255);
$line_colour imagecolorallocate$my_img128255);
imagestring$my_img43025"Your IP Is: $ip",
  
$text_colour );
imagesetthickness $my_img);
imageline$my_img304522045$line_colour );

header"Content-type: image/png" );
imagepng$my_img );
imagecolordeallocate$line_color );
imagecolordeallocate$text_color );
imagecolordeallocate$background );
imagedestroy$my_img );
?>

Make Sure You Save It!

Okay, that should be done, now go to http://www.YourDomain.com/img and you should see your IP.

Go onto the forum of which you want this is your signature, go to the UserCP and click "Edit Signature".

In your signature enter this following BBCode:

Code:
[img]http://www.YourDomainHere.com/img/index.php[/img]

If you want to get the exact colours for the backgrounds of forums. so it looks just like the text then edit this:

PHP Code:
$background imagecolorallocate$my_img102102102 ); 

Change it to:

HackForums
PHP Code:
$background imagecolorallocate$my_img102102102 ); 

SupportForums
PHP Code:
$background imagecolorallocate$my_img878787 ); 
(Want any other forum codes just request them (post forum you want the code for) )



You're Done! Congratulations!

Now Go Freak Out Some People Big Grin
Reply
#2
This is a very nice tutorial.
I tried this and it works perfectly. Big Grin
Reply
#3
Interesting tutorial. I've always wondered how to do something like this. I'll be keeping these pieces of code as reference. Thanks.
Reply
#4
Yeah this is really nice tutorial and I will try this out later.
Reply
#5
How would you go about putting this into an image? Like if I were to make an avatar or a signature and want it to spit out the Ip? Any ideas?
[Image: komnewsig.png]
Reply
#6
Very useful. Thanks for sharing.
I probably won't use it but it's nice to know how to do it anyway.
Reply
#7
(09-14-2011, 03:10 AM)Kom Wrote: How would you go about putting this into an image? Like if I were to make an avatar or a signature and want it to spit out the Ip? Any ideas?

This code does create it into an image, if afterwards, once you've done this, go visit the link and you'll see the exact same of what's in my signature.
Reply
#8
I've posted quite few GD tutorials on here, lurk for them...
Anyway, this is nothing new or original, the one thread on here is original...
http://www.supportforums.net/showthread.php?tid=1664
Reply
#9
The HF background should be RGB: 51, 51, 51 instead of 102, 102, 102. Nice tutorial nonetheless, similar to my text image in php
[Image: 2.png]
Reply
#10
Nice to know. Very useful.
I might edit the script to keep logs in the future Devlish.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 943 07-27-2020, 11:26 PM
Last Post: tk-hassan
  PHP Video Tutorials (PHP For Beginners) Eleqtriq 4 3,671 10-10-2011, 01:00 PM
Last Post: Greyersting
  PHP Signature Rotator with Links Dutchcoffee 9 4,046 12-12-2010, 05:20 PM
Last Post: NathanE
  Random Image PHP Matt G 13 3,796 11-24-2010, 01:21 PM
Last Post: Sam
  User Management Script - User Cake Support 9 5,623 05-13-2010, 03:21 PM
Last Post: Julie

Forum Jump:


Users browsing this thread: 1 Guest(s)