From 0591f08bbfb99b3ac0d48f2312bf89856d3bd1f9 Mon Sep 17 00:00:00 2001 From: James Dillon Date: Mon, 5 Oct 2015 18:18:37 +0100 Subject: [PATCH] Adding error page If a user tries to upload without a file selected, the user is redirected to an error page instead of "You fucked up". --- api.php | 6 ++- error.php | 18 ++++++++ ....e1ac13855adfa478d8926be2da304459.rtpl.php | 12 ++++++ ....e1ac13855adfa478d8926be2da304459.rtpl.php | 20 +++++++++ ....e1ac13855adfa478d8926be2da304459.rtpl.php | 41 +++++++++++++++++++ ....e1ac13855adfa478d8926be2da304459.rtpl.php | 29 +++++++++++++ rain/template/error.html | 12 ++++++ 7 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 error.php create mode 100644 rain/cache/error.e1ac13855adfa478d8926be2da304459.rtpl.php create mode 100644 rain/cache/footer.e1ac13855adfa478d8926be2da304459.rtpl.php create mode 100644 rain/cache/header.e1ac13855adfa478d8926be2da304459.rtpl.php create mode 100644 rain/cache/upload.e1ac13855adfa478d8926be2da304459.rtpl.php create mode 100644 rain/template/error.html diff --git a/api.php b/api.php index ad5fc5d..89151ba 100644 --- a/api.php +++ b/api.php @@ -5,9 +5,11 @@ if(isset($_GET['d'])) { include_once('includes/core.php'); switch ($_GET['d']) { case 'upload': - //If no file is being posted, exit + //If no file is being posted, show the error page and exit. if(empty($_FILES['file']['name'])){ - exit('You fucked up, nothing to do.');} + include('error.php'); + exit(0); + } //Set the name value to the original filename $name = $_FILES['file']['name']; $arg = 'custom_original'; diff --git a/error.php b/error.php new file mode 100644 index 0000000..fd23956 --- /dev/null +++ b/error.php @@ -0,0 +1,18 @@ +assign("title", $title); +$tpl->draw("header"); +$tpl->draw("error"); + + +$tpl->draw("footer"); +?> \ No newline at end of file diff --git a/rain/cache/error.e1ac13855adfa478d8926be2da304459.rtpl.php b/rain/cache/error.e1ac13855adfa478d8926be2da304459.rtpl.php new file mode 100644 index 0000000..c7beb37 --- /dev/null +++ b/rain/cache/error.e1ac13855adfa478d8926be2da304459.rtpl.php @@ -0,0 +1,12 @@ +
+
+
+
+
+

Error!

+

Ooops! It seems something has went wrong! Make sure you've selected a file for upload :^)

+
+
+
+
+
\ No newline at end of file diff --git a/rain/cache/footer.e1ac13855adfa478d8926be2da304459.rtpl.php b/rain/cache/footer.e1ac13855adfa478d8926be2da304459.rtpl.php new file mode 100644 index 0000000..8fbe7ec --- /dev/null +++ b/rain/cache/footer.e1ac13855adfa478d8926be2da304459.rtpl.php @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/rain/cache/header.e1ac13855adfa478d8926be2da304459.rtpl.php b/rain/cache/header.e1ac13855adfa478d8926be2da304459.rtpl.php new file mode 100644 index 0000000..6b22197 --- /dev/null +++ b/rain/cache/header.e1ac13855adfa478d8926be2da304459.rtpl.php @@ -0,0 +1,41 @@ + + + + + + + + Uguu.se · <?php echo $title;?> + + + + + + + + + + + + diff --git a/rain/cache/upload.e1ac13855adfa478d8926be2da304459.rtpl.php b/rain/cache/upload.e1ac13855adfa478d8926be2da304459.rtpl.php new file mode 100644 index 0000000..a9ed4d2 --- /dev/null +++ b/rain/cache/upload.e1ac13855adfa478d8926be2da304459.rtpl.php @@ -0,0 +1,29 @@ +
+
+ +
+ +
+ File + +
+
+ +

+ + +

+ +
+
+ + +
+
+ + +
+ + diff --git a/rain/template/error.html b/rain/template/error.html new file mode 100644 index 0000000..4593592 --- /dev/null +++ b/rain/template/error.html @@ -0,0 +1,12 @@ +
+
+
+
+
+

Error!

+

Ooops! It seems something has went wrong! Make sure you've selected a file for upload :^)

+
+
+
+
+
\ No newline at end of file