Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?php
- //ASSIGN VARIABLES TO USER INFO
- $time = date("M j G:i:s Y");
- $ip = getenv('REMOTE_ADDR');
- $userAgent = getenv('HTTP_USER_AGENT');
- $referrer = getenv('HTTP_REFERER');
- $query = getenv('QUERY_STRING');
- //COMBINE VARS INTO OUR LOG ENTRY
- $msg = "IP: " . $ip . " TIME: " . $time . " REFERRER: " . $referrer . " SEARCHSTRING: " . $query . " USERAGENT: " . $userAgent;
- //CALL OUR LOG FUNCTION
- writeToLogFile($msg);
- function writeToLogFile($msg)
- {
- $logfile = "log.txt";
- $saveLocation=$logfile;
- if (!$handle = @fopen($saveLocation, "a"))
- {
- exit;
- }
- else
- {
- if(@fwrite($handle,"$msg\r\n")===FALSE)
- {
- exit;
- }
- @fclose($handle);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement