![]() |
|
Tutorial PHP IP Log by Image - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: PHP (https://sinister.ly/Forum-PHP) +--- Thread: Tutorial PHP IP Log by Image (/Thread-Tutorial-PHP-IP-Log-by-Image) Pages:
1
2
|
PHP IP Log by Image - Sapientia - 06-24-2013 I made this because BlueScreen's did not work. For this all you will need to do is create one file, a php file with any name. For example, mine is: whatsup.php. Then paste this code in it: Code: <?php
$width = 340;
$height = 30;
$text = "Whats up Sinister.ly?";
$fontsize = 5;
$img = imagecreate($width, $height);
// Transparent background
$black = imagecolorallocate($img, 0, 0, 0);
imagecolortransparent($img, $black);
// Red text
$red = imagecolorallocate($img, 255, 0, 0);
imagestring($img, $fontsize, 0, 0, $text, $red);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
<?php
$log = 'logs.html';
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
$http = $_SERVER['HTTP_USER_AGENT'];
$page = $_SERVER['REQUEST_URI'];
$refer = $_SERVER['HTTP_REFERER'];
$date_time = date("l j F Y g:ia", time() - date("Z")) ;
$fp = fopen("logs.html", "a");
fputs($fp, $date_time ."<br />". "IP: " .$ip. "<br />" ."Page: ".$page."<br>".$http."<br />"."-----------------------<br />");
flock($fp, 3);
fclose($fp);
?>What this does is it will create a image on the PHP file looking like this: ![]() You can now use your file like this for forums: Code: [img]http://www.yoursite.com/yourfile.php[/img]Or for HTML Code: <img src='http://www.yoursite.com/yourfile.php' alt='Whats up!'>RE: PHP IP Log by Image - Darkmuseisbae - 06-24-2013 Nice share...wonder why his didnt work.. RE: PHP IP Log by Image - myballs123 - 06-24-2013 Yay! A user that may have a brain in his head. Anyway if you want a site to do this for you just go here. http://arehost.net:9090/photo_share/ Once you upload the imagd you want just add '&log' at the end of the image url (password required) ). Anyway nice post. RE: PHP IP Log by Image - Sapientia - 06-24-2013 (06-24-2013, 08:22 PM)JustCallMeJoe Wrote: Nice share...wonder why his didnt work.. There are a ton of reasons his did not work. RE: PHP IP Log by Image - Darkmuseisbae - 06-24-2013 I didn't try his, so now I probably won't RE: PHP IP Log by Image - i0xIllusi0n - 06-24-2013 Or you could just display an image in PHP and make the headers PNG, then have a logger.php write to SQL/text file without echoing anything so it doesn't break the image. RE: PHP IP Log by Image - Sapientia - 06-24-2013 It does the same exact thing. RE: PHP IP Log by Image - myballs123 - 06-24-2013 I know this is a little off topic but I found it funny. RE: PHP IP Log by Image - Sapientia - 06-24-2013 Hahahaha. Yeah. Got a lot of IP's from that. RE: PHP IP Log by Image - myballs123 - 06-24-2013 (06-24-2013, 09:23 PM)Wisdom Wrote: Hahahaha. Yeah. Got a lot of IP's from that. I wouldn't really say so, you have a total of 9 different ip addresses. I don't really call that a lot. Good for you anyway! |