When I run my php code follow:
Code: Select all
function log_event($event_type,$event) {
$this->config = new inifile($_SERVER["DOCUMENT_ROOT"]."/config/default_config.ini");
$this->log_path = $this->config->read_var("MAIN","log_path");
if (!is_dir($this->log_path.date("Y"))) {
mkdir($this->log_path.date("Y"));
}
if (!is_dir($this->log_path.date("Y")."/".date("m"))) {
mkdir($this->log_path.date("Y")."/".date("m"));
}
$filename = $this->log_path.date("Y")."/".date("m")."/".date("d")."_applog.txt";
$somecontent = "[DEV::".$event_type."]|[".date("Y-m-d H:i:s")."]|[".$_SESSION['user_session']->user_id."]|[".$_SERVER['REQUEST_METHOD']."]|[".$_SERVER['REQUEST_URI']."]|[".$event."]\n";
if (!$handle = fopen($filename, 'a')) {
// print "Cannot open file ($filename)";
exit;
}Code: Select all
Fatal error: Using $this when not in object context in the first line of the function.