fp) $this->lopen(); // define script name // $script_name = pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME); $script_name = basename($_SERVER['PHP_SELF']); $script_name = substr($script_name, 0, -4); // php extension and dot are not needed // define current time $time = date('H:i:s'); // write current time, script name and message to the log file fwrite($this->fp, "$time ($script_name) $message\n"); } // open log file private function lopen(){ // define log file path and name $lfile = $this->log_file; // define the current date (it will be appended to the log file name) $today = date('d-m-Y'); // open log file for writing only; place the file pointer at the end of the file // if the file does not exist, attempt to create it // $this->fp = fopen($lfile . '_' . $today . '.txt' , 'a') or exit("Can't open $lfile!"); $lfile = $lfile . '_' . $today . '.txt'; $this->fp = fopen($lfile , 'a') or exit("Can't open $lfile!"); } } // Logging class initialization $log = new Logging(); $agent=@$_SERVER['HTTP_USER_AGENT']; $ref=@$_SERVER['HTTP_REFERER']; $ip=@$_SERVER['REMOTE_ADDR']; // write message to the log file $log->lwrite($ip . ' | ' . $ref . ' | ' . $agent); Header("Location: http://www.hoststools.com/"); ?>