Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* PHP logging script by antonvrg Feel free to modify this or use it however you want.
- * to use this put the file (yes this one) in a directory where it is accessible (eg. www or public_html).
- * put <?php include('stats.php'); ?> in all pages to log visitors. (change stats.php to the file name).
- * you should only need to edit $logfile.
- * enjoy!
- */
- //get info
- $logfile = '../main.log';
- $ip = $_SERVER['REMOTE_ADDR'];
- $url = $_SERVER['REQUEST_URI'];
- $server = $_SERVER['SERVER_NAME'];
- $port = $_SERVER['SERVER_PORT'];
- $time = date('l jS \of F Y h:i:s A');
- $data = "$ip $server$url :$port $time \n";
- $handle = fopen($logfile, 'a');
- //writes to the file
- fwrite($handle, $data);
- fclose($handle);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment