5
1
Fork 0
mirror of https://github.com/Anvilcraft/jensmemes synced 2024-09-25 02:38:51 +02:00
This commit is contained in:
Timo Ley 2020-06-26 21:11:18 +02:00
parent 3abbd0e7fe
commit 89fdfe5930
17 changed files with 681 additions and 95 deletions

17
website/button.js Normal file
View file

@ -0,0 +1,17 @@
const realFileBtn = document.getElementById("real-file");
const customBtn = document.getElementById("custom-button");
const customTxt = document.getElementById("custom-text");
customBtn.addEventListener("click", function() {
realFileBtn.click();
});
realFileBtn.addEventListener("change", function() {
if (realFileBtn.value) {
customTxt.innerHTML = realFileBtn.value.match(
/[\/\\]([\w\d\s\.\-\(\)]+)$/
)[1];
} else {
customTxt.innerHTML = "No file chosen, yet.";
}
});

7
website/clientIP.php Normal file
View file

@ -0,0 +1,7 @@
<?php
$clientIP = $_SERVER['REMOTE_ADDR'];
$sql = "UPDATE token SET latest-ip='$clientIP' WHERE token='$tokenpost' OR token='$tokencookie'";
$result = mysqli_query($con,$sql);
?>

View file

@ -1,5 +1,5 @@
<?php <?php
$con = mysqli_connect("localhost","root","PASSWORT","jensmeme"); $con = mysqli_connect("localhost","jensmemes","aCSw24pHYOjYSzeV","jensmemes");
// Check connection // Check connection
if (mysqli_connect_errno()) if (mysqli_connect_errno())

BIN
website/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View file

@ -2,115 +2,155 @@
<html> <html>
<head> <head>
<title>JensMemes v2</title> <title>JensMemes v2</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <meta charset="utf-8" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-lightbox/0.7.0/bootstrap-lightbox.css"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" /> <link id="theme" rel="stylesheet" href="themes/dark.css" />
<link rel="stylesheet" href="style.css"> <script defer src="script.js"></script>
<script defer src="button.js"></script>
</head> </head>
<body class=""> <body class="">
<div class="col-lg m-auto"> <div class="modal" id="modal">
<div class="modal-header">
<div class="title">Informationen</div>
<div class="col-lg-12"> <button data-close-button class="close-button">&times;</button>
<center>Eine zentrale Seite für alle Jens Memes!</center><br>
<div class="form-control m-auto bg-dark text-light" style="max-width:100%">
<form method='post' action='' enctype='multipart/form-data'>
<input type="file" name="file[]" id="file" multiple>
<?php
$tokencookie = $_COOKIE['token'];
if(empty($tokencookie)){
echo '
<input type="text" name="token" id="token" placeholder="Token">';
} else{
echo '<b style="color:red;">Authentifiziert.</b>';
}
?>
<input type='submit' name='submit' value='Upload'>
</form>
</div> </div>
<br> <div class="modal-body">
<br> Das Token für das Login kannst du im Discord von Jens bzw. in Anvilcraft -Discord über den Befehl !register erhalten. Es wird nach der Eingabe für 30 Tage im Browser gespeichert - dannach muss es neu eingegeben werden. Durch den Logout-Button rechts kann mann es löschen.<br><b>Made by</b>
<ul>
<?php <li><a href="https://www.a-hoefler.eu/sites/social-media/">ITbyHF</a> - Website</li>
//UPLOAD <li><a href="http://tilera.xyz/">tilera</a> - Hosting</li>
if(isset($_POST['submit'])){ <li><a href="https://twitter.com/LordMZTE">LordMZTE</a> - Theme 2 und Theme Switch</li>
include('uploadOK.php'); <li><a href="https://jonasled.de/">jonasled</a> - Discord Bot</li>
$home_dir = "images/".md5($tokencookie)."/"; <li><a href="https://www.twitch.tv/knautschzon3">Knautschzon3</a> - Website</li>
if($home_dir=="images//"){ </ul>
$home_dir = "images/".md5($_POST['token'])."/"; </div>
} </div>
mkdir($home_dir); <div id="overlay"></div>
<div class="col-lg m-auto">
$resultMaxUpl=mysqli_query($con, "select * from token WHERE token='$tokencookie' OR token='$tokenpost'")or die('Error In Session'); <form action="#" method="post" enctype="multipart/form-data">
$rowMaxUpl=mysqli_fetch_array($resultMaxUpl); <input type='submit' name='logout' class="btn-logout" value=''>
$MaxUpl = $rowMaxUpl['uploadsLast24H']; </form>
$MaxUpl++; <?php
$sqlMaxUpl = "UPDATE token SET token='$MaxUpl' WHERE token='$tokencookie' OR token='$tokenpost'"; if (isset($_POST['logout'])) {
mysqli_query($con, $sqlMaxUpl); setcookie("token", "", time() - 3600);
header('Location: ./');
if($uploadOK){
if($MaxUpl<=20){
$countfiles = count($_FILES['file']['name']);
for($i=0;$i<$countfiles;$i++){
$filename = $_FILES['file']['name'][$i];
move_uploaded_file($_FILES['file']['tmp_name'][$i],$home_dir.$filename);
}
if(empty($_COOKIE['token'])){
$setCookie = $_POST['token'];
setcookie("token",$setCookie,time()+(3600*720));
echo "Cookie mit Inhalt gesetzt: ".$setCookie;
}else{
echo "Cookie auf neustem Stand.";
}
} else{
echo "Maximales Upload Limit für heute erreicht. Bitte warten...";
} }
} else{ ?>
echo "Unautorized!";
} <div class="col-lg-12">
} <h2>
<center></center>
</h2>
<div class="bar-main">
<button data-modal-target="#modal" class="btn-modal"></button>
<div id="themediv">
<p>Theme:</p>
<select name="Themes" id="themeswitcher">
<option value="dark">Llama</option>
<option value="light">LordMZTE</option>
<option value="old">Old</option>
<option value="retro">Retro</option>
</select>
</div>
<script src="switcher.js"></script>
<?php
$tokencookie = $_COOKIE['token'];
if (!empty($tokencookie)) {
echo '<b style="color:red;">Authentifiziert</b>';
} ?>
<form method='post' action='#' enctype='multipart/form-data'>
<input type="file" id="real-file" hidden="hidden" name="file[]" multiple="" />
<button type="button" id="custom-button">Browse...</button>
<span id="custom-text">_</span>
<?php
if (empty($tokencookie)) {
echo '
<input type="text" name="token" id="token" placeholder="Token">';
} else {
}
?>
<center><input type='submit' name='submit' id="btn-close-CSS" value=''></center>
</form>
</div>
<br>
<br>
<?php
//UPLOAD
if (isset($_POST['submit'])) {
include('uploadOK.php');
$home_dir = "images/" . md5($tokencookie) . "/";
if ($home_dir == "images//") {
$home_dir = "images/" . md5($_POST['token']) . "/";
}
mkdir($home_dir);
$resultMaxUpl = mysqli_query($con, "select * from token WHERE token='$tokencookie' OR token='$tokenpost'") or die('Error In Session');
$rowMaxUpl = mysqli_fetch_array($resultMaxUpl);
$MaxUpl = $rowMaxUpl['uploadsLast24H'];
$MaxUpl++;
$sqlMaxUpl = "UPDATE token SET uploadsLast24H='$MaxUpl' WHERE token='$tokencookie' OR token='$tokenpost'";
mysqli_query($con, $sqlMaxUpl);
if ($uploadOK) {
if ($MaxUpl <= 20) {
$countfiles = count($_FILES['file']['name']);
for ($i = 0; $i < $countfiles; $i++) {
$filename = $_FILES['file']['name'][$i];
move_uploaded_file($_FILES['file']['tmp_name'][$i], $home_dir . $filename);
}
if (empty($_COOKIE['token'])) {
$setCookie = $_POST['token'];
setcookie("token", $setCookie, time() + (3600 * 720));
echo "Cookie mit Inhalt gesetzt: " . $setCookie;
} else {
}
} else echo "Heutiges Upload-Limit erreicht!";
} else {
echo "Unautorized!";
}
}
//BILDER ANZEIGEN //BILDER ANZEIGEN
$files = glob("images/*/*"); $files = glob("images/*/*");
for ($i=0; $i<count($files); $i++) for ($i = 0; $i < count($files); $i++) {
{ $image = $files[$i];
$image = $files[$i]; $supported_file = array(
$supported_file = array( 'gif',
'gif', 'jpg',
'jpg', 'jpeg',
'jpeg', 'png'
'png' );
);
$ext = strtolower(pathinfo($image, PATHINFO_EXTENSION)); $ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
if (in_array($ext, $supported_file)) { if (in_array($ext, $supported_file)) {
echo "<div class='kasten'>"; echo "<div class='kasten'>";
echo " echo "
<a href='$image'><img class='Bilder_' src='$image' /></a>\n <a href='$image'><img class='Bilder_' src='$image' /></a>\n
"; ";
echo "</div>"; echo "</div>";
} elseif ($ext == "mp4") { } elseif ($ext == "mp4") {
// echo basename($image); // echo basename($image);
echo "<div class='kasten'>"; echo "<div class='kasten'>";
echo '<a href="'.$image.'"><video src=' . $image . ' controls class="Videos_" ></video></a>'; echo '<a href="' . $image . '"><video src=' . $image . ' controls class="Videos_" ></video></a>';
echo "</div>"; echo "</div>";
} } else {
else { continue;
continue; }
} }
} ?>
?> </div>
</div>
</body> </body>
</html> </html>

36
website/script.js Normal file
View file

@ -0,0 +1,36 @@
const openModalButtons = document.querySelectorAll('[data-modal-target]')
const closeModalButtons = document.querySelectorAll('[data-close-button]')
const overlay = document.getElementById('overlay')
openModalButtons.forEach(button => {
button.addEventListener('click', () => {
const modal = document.querySelector(button.dataset.modalTarget)
openModal(modal)
})
})
overlay.addEventListener('click', () => {
const modals = document.querySelectorAll('.modal.active')
modals.forEach(modal => {
closeModal(modal)
})
})
closeModalButtons.forEach(button => {
button.addEventListener('click', () => {
const modal = button.closest('.modal')
closeModal(modal)
})
})
function openModal(modal) {
if (modal == null) return
modal.classList.add('active')
overlay.classList.add('active')
}
function closeModal(modal) {
if (modal == null) return
modal.classList.remove('active')
overlay.classList.remove('active')
}

44
website/switcher.js Normal file
View file

@ -0,0 +1,44 @@
let select = document.getElementById("themeswitcher");
let theme = document.getElementById("theme");
if (checkCookie("theme")) {
setTheme(getCookie("theme"));
select.value = getCookie("theme");
}
select.addEventListener("change", e => {
let selTheme = select.options[select.selectedIndex].value;
setTheme(selTheme);
setCookie("theme", selTheme, 60);
});
function setTheme(themeName) {
theme.href = "themes/" + themeName + ".css";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function checkCookie(cookieName) {
return getCookie(cookieName) != "";
}

BIN
website/themes/bg-img.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
website/themes/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

196
website/themes/dark.css Normal file
View file

@ -0,0 +1,196 @@
body{
color: #fff;
background: url(bg-img.jpg)no-repeat center center fixed;
background-size: cover;
font-family: 'Arial';
letter-spacing: 0.2px;
margin-top: 0px;
}
.Bilder_ {
padding: 10px;
max-width: 300px;
max-height:150px;
vertical-align: bottom;
display: block;
margin-top:auto;
margin-bottom:auto;
margin-left:auto;
margin-right:auto;
vertical-align: middle;
border: 0 none;
max-width: 200px;
}
#themediv {
float: left;
}
.Videos_ {
padding: 10px;
max-width: 200px;
max-height:150px;
margin-top:auto;
margin-bottom:auto;
margin-left:auto;
margin-right:auto;
display: block;
}
.kasten{
background: rgba(0,0,0,0.6);
margin-left: 10px;
margin-bottom: 10px;
border: 5px solid grey;
float:left;
width: 250px;
height: 200px;
min-height: 10em;
border: 4px solid #88f;
}
.bar-main{
background: rgba(0,0,0,0.6);
text-align: center;
}
#btn-close-CSS {
background: url(head.png)no-repeat;
display: flex;
justify-content: space-around;
background-size: contain;
background-position: center;
color:white;
background-color: lightgray;
border:noe;
height:50px;
width: 50px;
}
.img-fixed-info{
position: fixed;
width: 40px;
}
input[type=text] {
background-color: rgba(0, 0, 0, 0.4);
color: white;
}
.btn-logout{
background: url(logout.png)no-repeat;
background-size: contain;
background-position: center;
color:white;
background-color: transparent;
border:none;
float: right;
margin-top: 5px;
padding: 15px;
}
#custom-button {
padding: 5px;
color: white;
background-color: #009578;
border: 1px solid #000;
border-radius: 5px;
}
#custom-button:hover {
background-color: #32353b;
}
#custom-text {
margin-left: 10px;
color: #aaa;
}
*, *::after, *::before {
box-sizing: border-box;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
transition: 200ms ease-in-out;
border: 1px solid black;
border-radius: 10px;
z-index: 10;
background-color:#36393f;
width: 500px;
max-width: 80%;
}
.modal.active {
transform: translate(-50%, -50%) scale(1);
}
.modal-header {
padding: 10px 15px;
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 1px solid black;
}
.modal-header .title {
font-size: 1.25rem;
font-weight: bold;
}
.modal-header .close-button {
cursor: pointer;
border: none;
outline: none;
background: none;
font-size: 1.25rem;
font-weight: bold;
}
.close-button{
position: absolute;
right: 0px;
width: 30px;
font-size: 20px;
}
.modal-body {
padding: 10px 15px;
}
#overlay {
position: fixed;
opacity: 0;
transition: 200ms ease-in-out;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color:rgba(50,53,59,0.9);
pointer-events: none;
}
#overlay.active {
opacity: 1;
pointer-events: all;
}
.btn-modal{
background: url(info.png)no-repeat;
background-size: contain;
background-position: center;
color:white;
background-color: transparent;
border:none;
height:40px;
width: 50px;
padding: 15px;
float: left;
}
a{
color: white;
text-decoration: none;
}
a:hover{
font-weight: bold;
color:green;
}

BIN
website/themes/head.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
website/themes/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

208
website/themes/light.css Normal file
View file

@ -0,0 +1,208 @@
:root {
--rainbow: #ff0000, #ff7f00, #ffff00, #00ff00, #00ffff, #0000ff, #8b00ff;
}
body {
color: #fff;
background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
url(bg.png);
background-repeat: repeat;
background-size: 100px;
font-family: "Arial";
letter-spacing: 0.2px;
margin-top: 0px;
}
.Bilder_ {
object-fit: contain;
padding: 10px;
height: 100%;
display: block;
margin-top: auto;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
max-width: 100%;
}
.Videos_ {
object-fit: contain;
padding: 10px;
height: 100%;
display: block;
margin-top: auto;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
max-width: 100%;
}
.kasten {
background: #000000;
align-self: stretch;
margin-left: 10px;
margin-bottom: 10px;
border: 5px solid grey;
float: left;
height: 300px;
min-height: 10em;
border: 5px solid #cc0000;
}
.bar-main {
border: 5px solid #000000;
background: linear-gradient(to right, var(--rainbow));
text-align: center;
}
#btn-close-CSS {
background: url(upload.png) no-repeat;
display: flex;
justify-content: space-around;
background-size: contain;
background-position: center;
color: white;
background-color: lightgray;
border: noe;
height: 50px;
width: 50px;
}
.img-fixed-info {
position: fixed;
width: 40px;
}
input[type="text"] {
background-color: rgba(0, 0, 0, 0.4);
color: white;
}
.btn-logout {
background: url(logout.png) no-repeat;
background-size: contain;
background-position: center;
color: white;
background-color: transparent;
border: none;
float: left;
height: 50px;
width: 50px;
margin: 10px;
}
#custom-button {
padding: 5px;
color: white;
background-color: #009578;
border: 1px solid #000;
border-radius: 5px;
}
#custom-button:hover {
background-color: #32353b;
}
#custom-text {
margin-left: 10px;
color: #aaa;
}
*,
*::after,
*::before {
box-sizing: border-box;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
transition: 200ms ease-in-out;
border: 5px solid #cc0000;
z-index: 10;
background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
url(bg.png);
background-repeat: repeat;
background-size: 100px;
width: 500px;
max-width: 80%;
}
.modal.active {
transform: translate(-50%, -50%) scale(1);
}
.modal-header {
padding: 10px 15px;
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 1px solid black;
}
.modal-header .title {
font-size: 1.25rem;
font-weight: bold;
}
.modal-header .close-button {
cursor: pointer;
border: none;
outline: none;
background: none;
font-size: 1.25rem;
font-weight: bold;
}
#themediv {
float: left;
}
.close-button {
position: absolute;
right: 0px;
width: 30px;
font-size: 20px;
}
.modal-body {
padding: 10px 15px;
}
#overlay {
position: fixed;
opacity: 0;
transition: 200ms ease-in-out;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(50, 53, 59, 0.9);
pointer-events: none;
}
#overlay.active {
opacity: 1;
pointer-events: all;
}
.btn-modal {
background: url(info.png) no-repeat;
background-size: contain;
background-position: center;
color: white;
background-color: transparent;
border: none;
float: left;
height: 50px;
width: 50px;
margin: 10px;
}
a {
color: white;
text-decoration: none;
}
a:hover {
font-weight: bold;
color: green;
}

BIN
website/themes/logout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

37
website/themes/old.css Normal file
View file

@ -0,0 +1,37 @@
.Bilder_ {
padding: 10px;
max-width: 300px;
max-height:150px;
vertical-align: bottom;
display: block;
margin-top:auto;
margin-bottom:auto;
margin-left:auto;
margin-right:auto;
}
.Videos_ {
padding: 10px;
max-width: 300px;
max-height:150px;
margin-top:auto;
margin-bottom:auto;
margin-left:auto;
margin-right:auto;
display: block;
}
.kasten{
background: #555555;
margin-left: 10px;
margin-bottom: 10px;
border: 5px solid grey;
float:left;
width: 300px;
height: 250px;
}
body{
background: #676767;
}

BIN
website/themes/upload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -16,6 +16,7 @@ if(!empty($rowtoken) || !empty($rowpost)){
//echo "<b>Authenticated.</b>"; //echo "<b>Authenticated.</b>";
}else{ }else{
$uploadOK = false; $uploadOK = false;
echo "unauthenticated."; echo "<b>unauthenticated.</b>";
} }
?> ?>