Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1x1 pixel IP Logger
#1
I was only able to make this because of all the tutorials Master of the Universe has posted here ^__^
Be wary this only works if you have the PHP GD library installed on the server
My host had the GD library installed by default, yours might also, if not you can ask Master of the Universe on how to set that up xD


This is an invisible 1x1 pixel that you can embed into forums and other places to get a persons IP without them having to visit a link.
Save the script into a .php file, and embed that in [img][/img] tags
If the site doesnt allow embeding of php in [img] tags make a .jpg file and add this to your .htaccess file: Redirect 301 /picture.jpg /script.php

The log filename is in the first variable $filename, the log will by default be in the same directory as your script in sup.txt

PHP Code:
<?php
$filename 
"sup.txt";
$logstr "Connection from:".$_SERVER['REMOTE_ADDR']." at ".date("r",time())."\n";
$width 1;
$height 1;

if (
$handle fopen($filename'a')) {
           
fwrite($handle$logstr);
           
fclose($handle);
   }

$image imagecreate($width$height);
$background imagecolorallocatealpha($image,0,0,0,127);

header ("Content-type: image/png");
imagepng($image);
?>
[Image: sig.php]
Reply
#2
I don't understand...
How do you get "sup.txt"?
Reply
#3
(01-22-2010, 04:58 PM)Extasey Wrote: I don't understand...
How do you get "sup.txt"?

if ($handle = fopen($filename, 'a')) {

any write mode: 'a', 'a+', 'w', 'w+' 'x', and 'x+' also will try to create a file when you use those mods, the only mode that wont create a file if it doesnt exist is read.
[Image: sig.php]
Reply
#4
LOL, awesome...
But I didn't posted a tutorial about alpha handling yet... ;) Thanks for reminding me on that!
Also you should mention that it only works if the server has GD library installed...

Nice work, Nyx-

edit:
I've translated this for the Balkan users and noticed that you forgot to kill the used memory, imagedestory is missing... nothing big for a small image but still...
Reply
#5
(01-23-2010, 08:16 PM)Master of The Universe Wrote: LOL, awesome...
But I didn't posted a tutorial about alpha handling yet... ;) Thanks for reminding me on that!
Also you should mention that it only works if the server has GD library installed...

Nice work, Nyx-

edit:
I've translated this for the Balkan users and noticed that you forgot to kill the used memory, imagedestory is missing... nothing big for a small image but still...


ahh okay, i'll remember to do that though ^_^ and yea you didnt show me how to work with the alpha stuff, but it was pretty easy to find a reference too after everything from your other scripts and tutorials =)
[Image: sig.php]
Reply
#6
(01-24-2010, 03:48 PM)Nyx- Wrote: ahh okay, i'll remember to do that though ^_^ and yea you didnt show me how to work with the alpha stuff, but it was pretty easy to find a reference too after everything from your other scripts and tutorials =)

Big Grin
A easy function isn't it, there are more uses for it, but later ;)
Reply
#7
nice... thanks for that ;)
Reply
#8
hahahahaha
you can use mail() function to actual email ip addresses to your email.
getting emails is much easier than going on your ftp and download sup.txt
Reply
#9
(02-11-2010, 02:15 AM)ELY_M Wrote: hahahahaha
you can use mail() function to actual email ip addresses to your email.
getting emails is much easier than going on your ftp and download sup.txt

not really, and sending mail in PHP is easy, thats not what this tutorial is trying to demonstrate.
[Image: sig.php]
Reply
#10
nicee thanks for the share
[Image: OGForumsbanner.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My ip logger with email and html logging option ELY_M 7 3,059 12-13-2010, 10:41 PM
Last Post: Bursihido
  Complete User Logger h1r0n 11 2,679 10-14-2009, 03:02 AM
Last Post: h1r0n
  IP Logger brett7 8 1,561 10-10-2009, 07:01 AM
Last Post: brett7

Forum Jump:


Users browsing this thread: 1 Guest(s)