diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-06 14:14:16 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-06 14:14:16 +0000 |
commit | 8213f5b2627a6b63db9f84b572918bd7e3254dff (patch) | |
tree | bdaa19d917ce2d0db1ba54ef884e22a69130846a /includes/watchdog.inc | |
parent | 048664f2786fce9bd049f39eea39a2a7fe2868f0 (diff) | |
download | brdo-8213f5b2627a6b63db9f84b572918bd7e3254dff.tar.gz brdo-8213f5b2627a6b63db9f84b572918bd7e3254dff.tar.bz2 |
A lot of small changes (search-n-replace) make a big commit:
- fixed update bug in book.module
- provide a log message when both adding and updating book pages
- all configurable variables are now accessed through "variable_get()":
- rewrote watchdog and submission throttle and removed watchdog.inc
- improved robustness of sections.inc
- imporved story.module
- updated ./database/database.sql
Diffstat (limited to 'includes/watchdog.inc')
-rw-r--r-- | includes/watchdog.inc | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/includes/watchdog.inc b/includes/watchdog.inc deleted file mode 100644 index 9b28f3904..000000000 --- a/includes/watchdog.inc +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -$watchdog = array("comment" => array("0", variable_get("max_comment_rate", 60)), - "node" => array("1", variable_get("max_node_rate", 900)), - "message" => array("3", "0"), - "warning" => array("4", "0"), - "error" => array("5", "0")); - -function watchdog($id, $message) { - global $user, $watchdog, $watchdog_history; - - // flood protection: - if ($watchdog[$id][1] && !user_access($user, "watchdog")) { - if ($log = db_fetch_object(db_query("SELECT * FROM watchdog WHERE hostname = '". getenv("REMOTE_ADDR") ."' AND level = '". $watchdog[$id][0] ."'"))) { - if (time() - $log->timestamp < $watchdog[$id][1]) { - watchdog("warning", "'". getenv("REMOTE_ADDR") ."' exceeded '$id' submission rate"); - header("Location: error.php?op=flood"); - exit(); - } - } - } - - // perform query to add new watchdog entry: - db_query("INSERT INTO watchdog (level, timestamp, user, message, location, hostname) VALUES ('". $watchdog[$id][0] ."', '". time() ."', '". check_input($user->id) ."', '". check_input(check_output($message)) ."', '". check_input(getenv("REQUEST_URI")) ."', '". check_input(getenv("REMOTE_ADDR")) ."')"); -} - -function watchdog_clean($history = 302400) { - $timestamp = time() - $history; - db_query("DELETE FROM watchdog WHERE timestamp < $timestamp"); -} - -?> |