Init
This commit is contained in:
141
index.php
Executable file
141
index.php
Executable file
@@ -0,0 +1,141 @@
|
||||
<?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">
|
||||
<link rel="stylesheet" href="/common/XP.css">
|
||||
<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>
|
||||
<style>
|
||||
body {
|
||||
height: 100vh;
|
||||
background: url('img/sand.bmp');
|
||||
}
|
||||
.center {
|
||||
margin: auto;
|
||||
}
|
||||
input::file-selector-button {
|
||||
font-family: "Pixelated MS Sans Serif",Arial;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-size: 11px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #003c74;
|
||||
background: linear-gradient(180deg,#fff,#ecebe5 86%,#d8d0c4);
|
||||
box-shadow: none;
|
||||
border-radius: 3px;
|
||||
|
||||
min-width: 75px;
|
||||
min-height: 23px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
input::file-selector-button:hover {
|
||||
box-shadow: inset -1px 1px #fff0cf,inset 1px 2px #fdd889,inset -2px 2px #fbc761,inset 2px -2px #e5a01a;
|
||||
}
|
||||
input::file-selector-button:active {
|
||||
box-shadow: none;
|
||||
background: linear-gradient(180deg,#cdcac3,#e3e3db 8%,#e5e5de 94%,#f2f2f1);
|
||||
}
|
||||
input::file-selector-button:focus {
|
||||
outline: 1px dotted #000;
|
||||
outline-offset: -4px;
|
||||
box-shadow: inset -1px 1px #cee7ff,inset 1px 2px #98b8ea,inset -2px 2px #bcd4f6,inset 1px -1px #89ade4,inset 2px -2px #89ade4;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="window center" style="width: 800px">
|
||||
<div class="title-bar">
|
||||
<div class="title-bar-text">Trygves filopplasting!</div>
|
||||
<div class="title-bar-controls">
|
||||
<button aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window-body">
|
||||
<form action="upload.php" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<input type="checkbox" id="privat">
|
||||
<label for="privat">Privat opplasting</label><br>
|
||||
<input type="file" name="file">
|
||||
<button type="submit">Last opp </button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if(isset($_SESSION['fileupload-response'])) {
|
||||
$errorMSG = '
|
||||
<div class="window" style="width: 300px">
|
||||
<div class="title-bar">
|
||||
<div class="title-bar-text">' .$_SESSION['filename'] . '</div>
|
||||
<div class="title-bar-controls">
|
||||
<button aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window-body">
|
||||
Hmmmm... Her var det visst noe som gikk galt.
|
||||
<button>Ok</button>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$bannedMSG = '
|
||||
<div class="window" style="width: 300px">
|
||||
<div class="title-bar">
|
||||
<div class="title-bar-text">' . $_SESSION['filename'] . '</div>
|
||||
<div class="title-bar-controls">
|
||||
<button aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window-body">
|
||||
Denne filtypen er forbudt!
|
||||
<button>Ok</button>
|
||||
</div>
|
||||
</div>';
|
||||
if($_SESSION['fileupload-response'] == "success") {
|
||||
|
||||
$successMSG = '
|
||||
<div class="window" style="width: 300px">
|
||||
<div class="title-bar">
|
||||
<div class="title-bar-text">' . $_SESSION['filename'] . '</div>
|
||||
<div class="title-bar-controls">
|
||||
<button aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window-body">
|
||||
'
|
||||
. $_SESSION['linkData'] .
|
||||
'
|
||||
<button type="button" class="btn btn-primary" onclick="copyToClipboard(\'' . $_SESSION['link'] . '\')">Kopier lenke</button>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
echo($successMSG);
|
||||
}
|
||||
elseif ($_SESSION['fileupload-response'] == "failed") {
|
||||
echo($errorMSG);
|
||||
}
|
||||
elseif ($_SESSION['fileupload-response'] == "banned") {
|
||||
echo($bannedMSG);
|
||||
}
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user