diff options
| author | root | 2014-03-28 21:54:15 +0100 |
|---|---|---|
| committer | root | 2014-03-28 21:54:15 +0100 |
| commit | ea8083d7162a099a8a2e1a7976ecd1e5278a5558 (patch) | |
| tree | 561e33a87c053f591ebc55894b13ab34cd36586d | |
| parent | 6419201108e177b9547fda1fe9141989cf9db806 (diff) | |
| download | files.iamfabulous.de-ea8083d7162a099a8a2e1a7976ecd1e5278a5558.tar.gz | |
Added new database layout.
| -rwxr-xr-x | blob/database_schema | 2 | ||||
| -rwxr-xr-x | www/functions/func_login.php | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/blob/database_schema b/blob/database_schema index eef9aec..c994910 100755 --- a/blob/database_schema +++ b/blob/database_schema @@ -6,4 +6,6 @@ CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, parent INTEGER, owner CREATE TABLE IF NOT EXISTS log (id INTEGER PRIMARY KEY, user INTEGER, login TEXT, FOREIGN KEY(user) REFERENCES user(id)); +CREATE TABLE IF NOT EXISTS banned_user (id INTEGER PRIMARY KEY, ip TEXT, session_id TEXT, time INTEGER); + CREATE TRIGGER IF NOT EXISTS delete_files AFTER DELETE ON user FOR EACH ROW BEGIN DELETE FROM files WHERE owner=OLD.id; END; diff --git a/www/functions/func_login.php b/www/functions/func_login.php index 0f9f3e6..121849c 100755 --- a/www/functions/func_login.php +++ b/www/functions/func_login.php @@ -62,10 +62,10 @@ function brutforce_protection($db){ if($db->exec(" BEGIN TRANSACTION; - INSERT INTO banned_user (id, ip, session_id, time) VALUES (NULL, '".SQLite3::escapeString($remote_ip)."', '".SQLite3::escapeString($session_id)."', ".$time."; + INSERT INTO banned_user (id, ip, session_id, time) VALUES (NULL, '".SQLite3::escapeString($remote_ip)."', '".SQLite3::escapeString($session_id)."', ".$time."); COMMIT; ")){ - echo "You are banned. ;_;": + echo "You are banned. ;_;"; } exit; } @@ -76,7 +76,7 @@ function check_if_banned($db){ $remote_ip = $_SERVER["REMOTE_ADDR"]; $session_id = session_id(); $check_db = $db->query("SELECT time FROM banned_user WHERE ip='".SQLite3::escapeString($remote_ip)."' OR session_id='".SQLite3::escapeString($session_id)."';"); - $check_ar = $check_db->fetchArray(SQLITE3_NUM) + $check_ar = $check_db->fetchArray(SQLITE3_NUM); $accepted_time = $_SERVER["REQUEST_TIME"] - 21600; // == 6h |
