/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//a better way... class MyLogger { private $ipAddr; public function MyLogger(){ } public function logDebug($sMsg){ $this->writeLog("DEBUG", $sMsg); } public function logError($sMsg){ $this->writeLog("ERROR", $sMsg); } public function logInfo($sMsg){ $this->writeLog("INFO", $sMsg); } private function writeLog($sSevirity, $sMsg){ } private function getClientIP(){ if (!$this->$ipAddr) { if ($_SERVER['HTTP_X_FORWARDED_FOR']) { $this->$ipAddr=$_SERVER['HTTP_X_FORWARDED_FOR']; } else if ($_SERVER['HTTP_CLIENT_IP']) { $this->$ipAddr=$_SERVER['HTTP_CLIENT_IP']; } else $this->$ipAddr= $_SERVER['REMOTE_ADDR']; } return $this->$ipAddr; } }
Comments
