diff options
author | Dries Buytaert <dries@buytaert.net> | 2000-09-04 16:17:39 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2000-09-04 16:17:39 +0000 |
commit | 17d8330e44fdd03429605d3131bd36c10fddf991 (patch) | |
tree | 9dc052c75a42fe840aa6a7c59bee6f1ad44a381f | |
parent | a4e7655cd29b2f66d9e7ba4002421ac3f8e4ad98 (diff) | |
download | brdo-17d8330e44fdd03429605d3131bd36c10fddf991.tar.gz brdo-17d8330e44fdd03429605d3131bd36c10fddf991.tar.bz2 |
* A new file which add a log-service to drop.org.
-rw-r--r-- | log.inc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/log.inc b/log.inc new file mode 100644 index 000000000..2883a8d84 --- /dev/null +++ b/log.inc @@ -0,0 +1,17 @@ +<? + + +function watchdog($level, $message) { + global $user; + + ### Perform query to add new log entry: + db_query("INSERT INTO logs (level, timestamp, user, message, hostname) VALUES ($level, '". time() ."', '". addslashes($user->id) ."', '". addslashes($message) ."', '". getenv("REMOTE_ADDR") ."')"); + + ### Periodically remove old log entries: + if (time() % 20 == 0) { + $timestamp = time() - 1209600; // 2 weeks + db_query("DELETE FROM logs WHERE timestamp < $timestamp"); + } +} + +?> |