summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blob/database_schema2
-rw-r--r--blob/nginx_rewrite_rules11
-rw-r--r--www/404.php20
-rw-r--r--www/select_function.php3
4 files changed, 29 insertions, 7 deletions
diff --git a/blob/database_schema b/blob/database_schema
index ec4a649..01a8442 100644
--- a/blob/database_schema
+++ b/blob/database_schema
@@ -2,6 +2,6 @@
CREATE TABLE IF NOT EXISTS user (id INTEGER PRIMARY KEY, name TEXT UIQUE, salt TEXT, password TEXT, email TEXT UNIQUE, invites INTEGER, senpai INTEGER, key TEXT, status INTEGER, register TEXT);
-CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, parent INTEGER, owner INTEGER, name TEXT, folder TEXT, mime TEXT, size INTEGER, share TEXT, extra TEXT, FOREIGN KEY(owner) REFERENCES user(id));
+CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, parent INTEGER, owner INTEGER, name TEXT, folder TEXT, mime TEXT, size INTEGER, share TEXT, hash TEXT, FOREIGN KEY(owner) REFERENCES user(id));
CREATE TABLE IF NOT EXISTS log (id INTEGER PRIMARY KEY, user INTEGER, login TEXT, FOREIGN KEY(user) REFERENCES user(id));
diff --git a/blob/nginx_rewrite_rules b/blob/nginx_rewrite_rules
index 0b925f3..aded2ed 100644
--- a/blob/nginx_rewrite_rules
+++ b/blob/nginx_rewrite_rules
@@ -1,7 +1,10 @@
-location /robots.txt {} #stop rewriting the robots.txt
+error_page 401 403 404 /httperror.php?e=40x;
+error_page 500 502 504 /httperror.php?e=50x;
-location /favicon.ico {}
-location /static {}
+location /robots.txt {} #stop rewriting the robots.txt
+
+location /favicon.ico {}
+location /static {}
#location ~* ^/.+[^/].+\.css {}
#location ~* ^/.+[^/].+\.png {}
@@ -27,7 +30,7 @@ location ~* ^/?user(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {
rewrite ^/?user(\?[0-9a-zA-Z]*(=[0-9a-zA-Z]*)?)? /index.php?task=user&arguments=$1 last;
}
-location ~* \.php(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {} #empty block to catch all
+#location ~* \.php(\?[0-9a-zA-Z]+(=[0-9a-zA-Z]*)?)?$ {} #empty block to catch all
location / {
rewrite ^/([0-9a-zA-Z-_]+)/(.*) /index.php?name=$1&folder=$2 last;
diff --git a/www/404.php b/www/404.php
index ab926bf..290f09a 100644
--- a/www/404.php
+++ b/www/404.php
@@ -1,7 +1,25 @@
+<?
+/*
+ GET Parameter, die von nginx übergeben werden:
+
+ $_GET["e"] = 404 Fehler
+ 403 Fehler
+ 401 Fehler
+ 500 Fehler
+ 502 Fehler
+ 504 Fehler
+
+ Variablen, die der Funktion übergeben werden:
+
+ $wrong_folder: enthält den ersten Ordner, der nicht in der Datenbank gespeichert ist, also zB. "Bildr"
+*/
+?>
+
+
<?php include("static/header.html");?>
<link rel="stylesheet" type="text/css" href="static/404.css">
<div id="Error-Page-content">
<h1 id="Error-Page-head" >404</h1>
- <h2 id="Error-Page-description" >Wow! I didn&#39t see that coming...Well, I&#39m sorry...</h2>
+ <h2 id="Error-Page-description" >Wow! I didn&#39;t see that coming...Well, I&#39;m sorry...</h2>
</div>
<?php include("static/footer.html");?>
diff --git a/www/select_function.php b/www/select_function.php
index 6e4bc66..0421b58 100644
--- a/www/select_function.php
+++ b/www/select_function.php
@@ -41,7 +41,8 @@ function select($db){
}
$prim_id = $parentdir_db->fetchArray(SQLITE3_NUM);
if($parentdir != $prim_id[1]){
- failure("This folder doesn't exist. Folder: " . $folder_array_unsafe[$i]);
+ $wrong_folder = $folder_array_unsafe[$i];
+ failure("This folder doesn't exist. Folder: " . $wrong_folder);
}
$parentdir = $prim_id[0];