#!/usr/local/bin/php // Change this to the fil you want to write to $HOME = "/home/member/p/p"; $logdir = "$HOME/public_html/logs/"; $username = "p"; // Because of Redbrick webserver setup //$ip = strtok($HTTP_X_FORWARDED_FOR, ","); $ip = strtok($REMOTE_ADDR, ","); // Creat logfile based on date (e.g. 2001-08.wwwlog ) $logfile = $logdir . date("Y-m") . ".wwwlog"; //Get remote variables $date = date("F j, Y, g:i a"); $user=""; if(isset($ip)) { $user=exec("/local/bin/bsdw -hn | grep " . escapeshellcmd($ip) . " | awk '{print \"\",$1}'"); } // Don't log if it's the person's own script if ($user != $username) { // Log stuff into a file $fp = fopen( $logfile,"a+"); fwrite ( $fp, $ip, 50); fwrite ( $fp, " -", 5); fwrite ( $fp, $user, 20); fwrite ( $fp, " - ", 5); fwrite ( $fp, $date, 50); fwrite ( $fp, " - ", 5); fwrite ( $fp, $DOCUMENT_URI, 50); fwrite ( $fp, " - ", 5); fwrite ( $fp, $HTTP_ACCEPT_LANGUAGE, 500); fwrite ( $fp, " - ", 5); fwrite ( $fp, $HTTP_REFERER, 500); fwrite ( $fp, " - ", 5); fwrite ( $fp, $HTTP_USER_AGENT, 500); fwrite ( $fp, "\n", 5); fclose( $fp ); } ?>
Redbrick Birthday Bash |