TinyPortal

Development => Block Codes => Topic started by: evilopinions on January 04, 2006, 06:13:35 AM

Title: Ip adress block !
Post by: evilopinions on January 04, 2006, 06:13:35 AM
I feel this is silly but may look hi-tech to newbies on your forum !

Show them their ip adress.

Box heading : Your IP adress.(logged)

$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
 
echo $hostname;
Title: Re: Ip adress block !
Post by: Ray on January 04, 2006, 06:54:54 AM
Cool I love toys -- works good-- thank you ;D
Title: Re: Ip adress block !
Post by: gerrymo on January 04, 2006, 12:37:46 PM
Wouldnt work for me in a side block (Much too wide). What I did was make a file "image.php" with the code below in it.

<?php
$img_number 
imagecreate(150,25);
$backcolor imagecolorallocate($img_number,102,102,153);
$textcolor imagecolorallocate($img_number,255,255,255);
imagefill($img_number,0,0,$backcolor);
$number "$_SERVER[REMOTE_ADDR]";
Imagestring($img_number,10,5,5,$number,$textcolor);

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



And upload to my server. Then put the code below into a java/html block:

<img src="http://yoursite/image.php" border="1">


And, hey presto, the user's IP Addy.
Title: Re: Ip adress block !
Post by: houston on January 05, 2006, 03:56:23 AM
Thanks for the code.  O0
Title: Re: Ip adress block !
Post by: Cool Surfer on August 12, 2006, 01:26:08 PM
Thanks cool codes. :)
Title: Re: Ip adress block !
Post by: shadrach on August 13, 2006, 06:24:45 PM
rofl, too bad its isp and not IP data
Title: Re: Ip adress block !
Post by: Azraeliitti on August 15, 2006, 08:43:40 PM
Here's the PHP code for showing the actual IP-address:

echo $_SERVER["REMOTE_ADDR"];
Title: Re: Ip adress block !
Post by: gerrymo on August 15, 2006, 10:58:11 PM
The one I posted in http://www.tinyportal.net/smf/index.php?topic=1910.msg15394#msg15394 can actuall be used in any site page.
Title: Re: Ip adress block !
Post by: Gargoyle on August 16, 2006, 04:11:27 AM
Quote from: gerrymo on January 04, 2006, 12:37:46 PM
Wouldnt work for me in a side block (Much too wide). What I did was make a file "image.php" with the code below in it.

<?php
$img_number 
imagecreate(150,25);
$backcolor imagecolorallocate($img_number,102,102,153);
$textcolor imagecolorallocate($img_number,255,255,255);
imagefill($img_number,0,0,$backcolor);
$number "$_SERVER[REMOTE_ADDR]";
Imagestring($img_number,10,5,5,$number,$textcolor);

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



And upload to my server. Then put the code below into a java/html block:

<img src="http://yoursite/image.php" border="1">


And, hey presto, the user's IP Addy.

Now how would you add to that code so it would say something like....

Your Ip address:
255,255,255,200 <--- the actual IP address of course. ;D

Thanks for the code... It works in signatures too.. ;D
Title: Re: Ip adress block !
Post by: gerrymo on August 16, 2006, 09:51:04 AM
Easy enough. Just use html above it. Something like:


<p align="center">Your IP address:
<p align="center"><img src="http://yoursite/image.php" border="1">
</p>
Title: Re: Ip adress block !
Post by: rctxtreme on August 20, 2006, 09:29:39 AM
How do I change the font?
Title: Re: Ip adress block !
Post by: Gargoyle on August 20, 2006, 04:52:53 PM
Quote from: gerrymo on August 16, 2006, 09:51:04 AM
Easy enough. Just use html above it. Something like:


<p align="center">Your IP address:
<p align="center"><img src="http://yoursite/image.php" border="1">
</p>


I was hoping for a way to add it to the image... Is that possible ?
Title: Re: Ip adress block !
Post by: evilicy on October 20, 2006, 09:59:56 PM
Quote from: Azraeliitti on August 15, 2006, 08:43:40 PM
Here's the PHP code for showing the actual IP-address:

echo $_SERVER["REMOTE_ADDR"];

Cool simple and easy ;p
Title: Re: Ip adress block !
Post by: tamasir on November 06, 2006, 11:11:20 PM
You to open html box to the left are to the right .
You copy code.
<center><a href="http://www.wieistmeineip.de/cometo/?en"><img src="http://www.wieistmeineip.de/ip-address/" border="0" width="125" height="125" alt="IP" /></a></center>
I to see the your Ip_Adress.

tamasir~
Title: Re: Ip adress block !
Post by: akulion on November 07, 2006, 12:03:12 AM
nice one tamasir :up:

great job
Title: Re: Ip adress block !
Post by: tamasir on November 07, 2006, 11:05:33 AM
Quote from: Aku on November 07, 2006, 12:03:12 AM
nice one tamasir :up:

great job
Aku!   I Thank . ;)
Thanks: to Crip.  :up:
I to see image, Crip  by site. In the future I to create code.
:laugh: :laugh:
tamasir~
Title: Re: Ip adress block !
Post by: Crip on November 07, 2006, 12:20:48 PM
lol.. :D
Title: Re: Ip adress block !
Post by: tamasir on November 07, 2006, 06:25:07 PM
Quote from: crip on November 07, 2006, 12:20:48 PM
lol.. :D
Crip Thank your so very much! :up: :D
tamasir~
Title: Re: Ip adress block !
Post by: tamasir on November 08, 2006, 11:41:49 PM
Quote from: tamasir on November 06, 2006, 11:11:20 PM
You to open html box to the left are to the right .
You copy code.
<center><a href="http://www.wieistmeineip.de/cometo/?en"><img src="http://www.wieistmeineip.de/ip-address/" border="0" width="125" height="125" alt="IP" /></a></center>
I to see the your Ip_Adress.

tamasir~
RebelRose
In  html bloc you copy code. ;)
The code to construct  image .
tamasir~



Title: Re: Ip adress block !
Post by: rebelrose on November 08, 2006, 11:45:42 PM
Thanks I got it now
Title: Re: Ip adress block !
Post by: tomtom9800 on August 07, 2007, 02:39:46 AM
Well I copied the exact code block of the code, and it seems that is does not work, all the block shows to me is the code.  I have the most recent .9.8 portal and 1.1.3 SMF.  What am I doing wrong......Also did is as a scriptbox, did I do that right?
Title: Re: Ip adress block !
Post by: FERNSIDEâ„¢ on December 12, 2007, 06:43:52 AM
Depends on which code you used mate :)

If you used this one:
<center><a href="http://www.wieistmeineip.de/cometo/?en"><img src="http://www.wieistmeineip.de/ip-address/" border="0" width="125" height="125" alt="IP" /></a></center>

That goes into an html block..

The other codes are for a php block :)

Good luck

Title: Re: Ip adress block !
Post by: Zetan on December 12, 2007, 09:55:16 AM
Quote from: FERNSIDEâ,,¢ on December 12, 2007, 06:43:52 AM

A little tip, is when selecting a new block, choose a php or something. Add the code, and before you save it, change it to an html block..


Can you explain, why and how this is a useful tip?
Title: Re: Ip adress block !
Post by: FERNSIDEâ„¢ on December 13, 2007, 08:49:13 AM
Ooops, got it mixed up..

Was actually refering to when I have to edit it after.
I cannot do it while the block is in html, as the image is there instead.

My baad..   Deleted.