summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/.htaccess10
-rw-r--r--public/admin.php0
-rw-r--r--public/index.php47
-rw-r--r--public/view.php0
4 files changed, 57 insertions, 0 deletions
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..e46b2d9
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,10 @@
+RewriteEngine On
+
+RewriteCond %{REQUEST_URI} ^/$ [OR]
+RewriteCond %{REQUEST_URI} ^/index\.php$
+RewriteRule ^(.*)$ /index.php [L]
+
+RewriteCond %{QUERY_STRING} ^v=([a-zA-Z0-9\_\-\~\!\*]{8})$
+RewriteRule ^$ /view.php?v=%1 [L,QSA]
+
+RewriteRule ^admin\.php$ /admin.php [L]
diff --git a/public/admin.php b/public/admin.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/public/admin.php
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..f656154
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,47 @@
+<?php
+
+include '../config/config.php';
+
+if (
+ $_SERVER['REQUEST_METHOD'] == 'POST' &&
+ isset($_FILES['file'])
+) {
+ $f = $_FILES['file'];
+ $id = shell_exec($ID_CMD);
+ $targetf = $UPLOAD_DIR . $id;
+
+ if ($f['size' > $UPLOAD_MAX_SZ]) {
+ echo "File too large.";
+ } else {
+ if (move_uploaded_file($f['tmp_name'], $targetf)) {
+ $cmd = escapeshellcmd(
+ "$FILE_PROCESSING_CMD " .
+ escapeshellarg($targetf)
+ );
+
+ shell_exec($cmd);
+ echo "Uploaded.";
+ } else {
+ echo "Error uploading.";
+ }
+ }
+}
+
+?>
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>i2</title>
+</head>
+<body>
+ <h1>Upload File</h1>
+ <form action="index.php" method="post" enctype="multipart/form-data">
+ <label for="file">Choose file:</label>
+ <input type="file" id="file" name="file" required>
+ <button type="submit">Upload</button>
+ </form>
+</body>
+</html>
diff --git a/public/view.php b/public/view.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/public/view.php