Support Forums

Full Version: 1x1 pixel IP Logger
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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);
?>
I don't understand...
How do you get "sup.txt"?
(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.
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...
(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 =)
(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 ;)
nice... thanks for that ;)
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
(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.
nicee thanks for the share
Pages: 1 2 3