mirror of
https://github.com/Anvilcraft/jensmemes
synced 2024-11-25 01:22:32 +01:00
Frontend Fixes
This commit is contained in:
parent
00ea30c03f
commit
6c16f3cf4f
5 changed files with 119 additions and 20 deletions
6
website/.gitignore
vendored
Normal file
6
website/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
config.php
|
||||
dbcon.php
|
||||
static/
|
||||
.htaccess
|
||||
.idea
|
||||
Neuer Ordner
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
|
||||
include ('../dbcon.php');
|
||||
|
||||
$clientIP =$_SERVER['REMOTE_ADDR'];
|
||||
$tk = $_COOKIE['token'];
|
||||
$sql = "UPDATE `token` SET `latest-ip` = '$clientIP' WHERE `token` = '$tk';
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
<?php
|
||||
global $cats;
|
||||
foreach ($cats as $cate) {
|
||||
|
||||
$parts = explode(":", $cate);
|
||||
$cname = str_replace(' ', '_', $cate->name);
|
||||
echo '
|
||||
<div id="' . $cate->name . '">
|
||||
<div id="' . $cname . '">
|
||||
<h2>' . $cate->name . '</h2>';
|
||||
$memeobj = json_decode(file_get_contents("https://jensmemes.tilera.xyz/api/memes?category=" . $cate->id));
|
||||
$memes = $memeobj->memes;
|
||||
|
@ -31,6 +33,7 @@ foreach ($cats as $cate) {
|
|||
';
|
||||
}
|
||||
}
|
||||
mysqli_free_result( $db_ergJens );
|
||||
echo '</div><br clear="all">';
|
||||
}
|
||||
|
||||
|
|
72
website/incl/memecat.php
Normal file
72
website/incl/memecat.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
$catobj = json_decode(file_get_contents("https://jensmemes.tilera.xyz/api/categories"));
|
||||
$cats = $catobj->categories;
|
||||
|
||||
echo '
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(\'#show\').on(\'change\', function() {
|
||||
';
|
||||
global $cats;
|
||||
$c2 = 0;
|
||||
foreach ($cats as $cate){
|
||||
$cname = str_replace(' ', '_',$cate->name);
|
||||
if($c2==0){
|
||||
echo '
|
||||
if(this.value=="'.$cname.'"){
|
||||
';
|
||||
|
||||
foreach ($cats as $catdis) {
|
||||
if($catdis->name!=$cate->name){
|
||||
$cat_dis = str_replace(" ", '_', $catdis->name);
|
||||
echo '$("#'.$cat_dis.'").hide();';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
$("#'.$cname.'").show();
|
||||
}';
|
||||
$c2=1;
|
||||
}else{
|
||||
echo '
|
||||
else if(this.value=="'.$cname.'"){
|
||||
';
|
||||
|
||||
foreach ($cats as $catdis) {
|
||||
if($catdis->name!=$cate->name){
|
||||
$cat_dis = str_replace(" ", '_', $catdis->name);
|
||||
echo '$("#'.$cat_dis.'").hide();';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
$("#'.$cname.'").show();
|
||||
}';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
echo '
|
||||
<div id="themediv">
|
||||
<p>Anzeigen:</p>
|
||||
<select id="show">
|
||||
|
||||
';
|
||||
|
||||
global $cats;
|
||||
$c = 0;
|
||||
foreach ($cats as $cate) {
|
||||
$cname = str_replace(' ', '_', $cate->name);
|
||||
if($c==0){
|
||||
echo '<option value="'.$cname.'" selected>'.$cname.'</option>';
|
||||
$c=1;
|
||||
}
|
||||
echo '<option value="'.$cname.'">'.$cname.'</option>';
|
||||
}
|
||||
|
||||
echo '</select></div>';
|
||||
|
||||
?>
|
|
@ -79,24 +79,12 @@
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<div id="themediv">
|
||||
|
||||
<p>Anzeigen::</p>
|
||||
<select id='show'>
|
||||
<option value="0" selected>All</option>
|
||||
<option value="1">JensMemes</option>
|
||||
<option value="2">Realtox Memes</option>
|
||||
<option value="3">Hendrik Memes</option>
|
||||
<option value="4">Random Memes</option>
|
||||
<option value="5">Hide all Memes</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
include('incl/memecat.php');
|
||||
$tokencookie = $_COOKIE['token'];
|
||||
if (!empty($tokencookie)) {
|
||||
echo '<b style="color:red;">Authentifiziert</b>';
|
||||
} ?>
|
||||
<form method='post' action='https://jensmemes.tilera.xyz/api/upload' 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>
|
||||
|
@ -105,7 +93,7 @@
|
|||
echo '
|
||||
<input type="text" name="token" id="token" placeholder="Token">';
|
||||
} else {
|
||||
echo '<input type="hidden" name="token" value="' . $tokencookie . '">';
|
||||
echo '<input type="hidden" id="tokenform" name="token" value="' . $tokencookie . '">';
|
||||
}
|
||||
?>
|
||||
<label for="type">Memetype</label>
|
||||
|
@ -117,15 +105,48 @@
|
|||
?>
|
||||
|
||||
</select>
|
||||
<button id="btn-close-CSS"></button>
|
||||
<i id="msg"></i>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function (e) {
|
||||
$('#btn-close-CSS').on('click', function () {
|
||||
var form_data = new FormData();
|
||||
var ins = document.getElementById('real-file').files.length;
|
||||
var backend_url = 'https://jensmemes.tilera.xyz/api/upload';
|
||||
for (var x = 0; x < ins; x++) {
|
||||
form_data.append("file[]", document.getElementById('real-file').files[x]);
|
||||
}
|
||||
var token = $('#tokenform').val();
|
||||
var cat = $('#type').val();
|
||||
form_data.append('token', token);
|
||||
form_data.append('category', cat);
|
||||
|
||||
$.ajax({
|
||||
url: backend_url,
|
||||
dataType: 'text',
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data: form_data,
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
$('#msg').html(response);
|
||||
},
|
||||
error: function (response) {
|
||||
$('#msg').html(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<center><input type='submit' name='submit' id="btn-close-CSS" value=''></center>
|
||||
</form>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
|
||||
include "dbcon.php";
|
||||
include 'incl/img.php';
|
||||
include 'incl/clientIP.php';
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue