-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclass.log.php
33 lines (28 loc) · 1.08 KB
/
class.log.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
class log {
private $iID = NULL;
private $strTekst = NULL;
private $arData = array();
public function log($strTekst, $arData = array()) {
$this->strTekst = $strTekst;
$this->arData = $arData;
$this->data("datum", str_date('m-d-Y h:i:s', time()));
$this->data("domein", settings("domain", "name"));
$this->save();
}
public function data($strItem, $strValue = NULL) {
if (!is_null($strValue)) $this->arData[$strItem] = $strValue;
return $this->arData[$strItem];
}
public function save() {
$oDB = new database();
if (is_null($this->iID)) {
$oDB->sql("insert into tblLog (user, datum, info, data) values ('" . me() . "', '" . owaesTime() . "', '" . $oDB->escape($this->strTekst) . "', '" . $oDB->escape(json_encode($this->arData)) . "'); ");
$oDB->execute();
$this->iID = $oDB->lastInsertID();
} else {
$oDB->sql("update tblLog set info = '" . $oDB->escape($this->strTekst) . "', data = '" . $oDB->escape(json_encode($this->arData)) . "' where id = " . $this->iID . "; ");
$oDB->execute();
}
}
}