trygve.me/filopplasting/index.php

103 lines
2.8 KiB
PHP
Raw Permalink Normal View History

2021-03-16 20:48:33 +00:00
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="no">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta charset="UTF-8">
<meta name="theme-color" content="#263238"/>
<link rel="icon" type="image/png" href="/dist/favicon.png">
2021-03-17 12:46:32 +00:00
<link rel="stylesheet" href="/css/main.css">
2021-03-16 20:48:33 +00:00
<style media="screen">
#upload_button
{
display: inline-block;
}
#upload_button input[type=file] {
display:none;
}
</style>
<script>
const copyToClipboard = str => {
const el = document.createElement('textarea');
el.value = str;
el.setAttribute('readonly', '');
el.style.position = 'absolute';
el.style.left = '-9999px';
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
};
</script>
</head>
<body class="theme-auto">
<?php include "../common/header.html"; ?>
<body>
<div class="cont">
2021-03-20 23:27:51 +00:00
<h1 class="center-txt">Filopplasting</h1>
<p class="center-txt">
2021-03-16 20:48:33 +00:00
Her kan du laste opp filer for å dele med andre. Filene kan være maks 5GB.<br /> Serveren ligger i Kristiansand og har 500/500 internet <br />
All opplasting skjer eget ansvar.
</p>
2021-04-13 19:28:13 +00:00
<div class="center-txt">
<a href="http://trygve.me/filopplasting/filer/">Se alle filer</a>
2021-03-16 20:48:33 +00:00
</div>
<hr class="my-4">
2021-04-13 19:28:13 +00:00
<div class="center-txt">
2021-03-16 20:48:33 +00:00
<form action="upload.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="123" />
<input type="file" name="file" class="" >
2021-03-20 23:27:51 +00:00
<button type="submit" class="btn btn-primary">Last opp </button>
2021-03-16 20:48:33 +00:00
</div>
</form>
</div>
2021-03-20 23:27:51 +00:00
<?php
$errorMSG = '
<div class="alert alert-warning" role="alert">
Hmmmm 🤔 Her var det visst noe som gikk galt.
</div>';
$bannedMSG = '
<div class="alert alert-warning" role="alert">
Denne filtypen er ikke tillatt.
</div>';
if(isset($_SESSION['fileupload-response'])) {
if($_SESSION['fileupload-response'] == "success") {
$successMSG = '
<div class="alert alert-primary center" role="alert">
'
. $_SESSION['linkData'] .
'
<button type="button" class="btn btn-primary" onclick="copyToClipboard(\'' . $_SESSION['link'] . '\')">Kopier lenke</button>
</div>
';
echo($successMSG);
}
elseif ($_SESSION['fileupload-response'] == "failed") {
echo($errorMSG);
}
elseif ($_SESSION['fileupload-response'] == "banned") {
echo($bannedMSG);
}
session_destroy();
}
?>
2021-03-16 20:48:33 +00:00
</ul>
</div>
</body>
</html>