summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortejr <tejr@sqt.wtf>2018-12-05 18:25:12 +1300
committertejr <tejr@sqt.wtf>2018-12-05 18:25:12 +1300
commitd1434c22a7b359b5e8011f9671315f31fbb9c4a7 (patch)
tree4d2d6b6b14d5d0cd8be75cd169e9ecf3adb29cad
parentLowercase in the right place (diff)
downloadsoundboard-d1434c22a7b359b5e8011f9671315f31fbb9c4a7.tar.gz
soundboard-d1434c22a7b359b5e8011f9671315f31fbb9c4a7.zip
Delete web page
-rw-r--r--index.php88
1 files changed, 0 insertions, 88 deletions
diff --git a/index.php b/index.php
deleted file mode 100644
index 636a220..0000000
--- a/index.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-// uploaded
-if (isset($_FILES['new'])) {
-
- // figure and normalise
- $tp = $_FILES['new']['tmp_name'];
- $fn = basename($_FILES['new']['name']);
- $fn = strtolower($fn);
- $fn = preg_replace('/[^a-z0-9._-]/', '-', $fn);
- $fp = 'sounds/'.$fn;
-
- // check
- preg_match('|^[a-z0-9][^/]*\.mp3$|i', $fn)
- or die('Must be .mp3 file starting with number or letter');
- !file_exists($fp)
- or die('A file by that name already exists');
-
- // move
- move_uploaded_file($tp, $fp)
- or die('Upload failed, nag tyrmored');
-
- // redirect
- header('HTTP/1.1 303 See Other');
- header('Location: .');
- exit;
-}
-
-$files = glob('sounds/'.$l.'*.mp3');
-usort($files, function ($a, $b) {
- return filemtime($a) < filemtime($b);
-});
-$news = array_slice(array_map(function ($fn) {
- return basename($fn, '.mp3');
-}, $files), 0, 20);
-
-// escape
-function h($s) {
- return htmlspecialchars($s, ENT_QUOTES|ENT_HTML5, 'UTF-8');
-}
-
-?>
-<!DOCTYPE html>
-<html lang="en-NZ">
- <head>
- <title>#sqt Soundboard</title>
- <meta name="description" content="*:D">
- <meta charset="utf-8">
- <script src="script.js"></script>
- </head>
- <body>
- <h1>
- #sqt Soundboard
- </h1>
- <p>
- Click a button to play a sound.
- If I’ve written this right, everyone with the page open in Chrome or Firefox should hear it too!
- Hold down <kbd>Shift</kbd> when you click, if you want the sound to play only for you.
- </p>
- <p>
- <strong>Disclaimer:</strong>
- Please don’t assume any of these sounds reflect our actual opinions of anything at all, ever.
- Most of them are from a collection of <a href="https://www.google.co.nz/search?q=mirc+sounds">mIRC sounds</a> one of the administrators collected during his misspent youth.
- </p>
- <form action="" method="post" enctype="multipart/form-data">
- <input name="new" type="file">
- <input type="submit" value="Upload">
- MP3, &lt;2MB
- </form>
- <p style="font-size:0.8em;">
- <strong>Newest:</strong>
- <?=implode(', ', array_map(function ($fn) {
- return h($fn);
- }, $news))?>
- </p>
-<?php foreach (array_merge(range('a','z'), array('[0-9]')) as $l): ?>
-<?php $fns = glob('sounds/'.$l.'*.mp3'); ?>
-<?php if ($fns): ?>
- <section>
- <h2><?=h($l)?></h2>
-<?php foreach ($fns as $fn): ?>
- <button><?=h(basename($fn, '.mp3'))?></button>
-<?php endforeach; ?>
- </section>
-<?php endif; ?>
-<?php endforeach; ?>
- </body>
-</html>