Created
December 27, 2016 06:16
-
-
Save zelon88/efa98c5a343a0126b043f161b7d2f4cf to your computer and use it in GitHub Desktop.
Log client IP on <img> interaction w/PHP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$Time = date("F j, Y, g:i a"); | |
$LogFile = '/path/to/logfile.txt'; | |
$ClientIP = $_SERVER['REMOTE_ADDR']; | |
$txt = ('Image accessed by '.$ClientIP.' on '.$Time.'.'); | |
$MAKELogFile = file_put_contents($LogFile, $txt.PHP_EOL , FILE_APPEND); | |
echo('<img src="img.jpg">'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment