AJAX rewrite

This commit is contained in:
Michał Gdula 2022-08-03 17:46:50 +01:00
parent d003fbdf1e
commit dc89737cfc
16 changed files with 689 additions and 184 deletions

View file

@ -1,43 +1,43 @@
<?php
if (is_dir("assets/icons/")) {
$dir = "assets/icons/";
} else {
$dir = "../assets/icons/";
}
?>
<footer class="footer-root flex-left around">
<footer class="flex-left around">
<div class="footer-child center flex-down">
<h3>Contact me</h3>
<a class='link' href="https://t.me/Fluffy_Bean">
<img class='svg' src='<?php echo $dir; ?>telegram-logo.svg'>
Telegram</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/telegram-logo.svg'>
Telegram
</a>
<a class='link' href="https://twitter.com/fluffybeanUwU">
<img class='svg' src='<?php echo $dir; ?>twitter-logo.svg'>
Twitter</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/twitter-logo.svg'>
Twitter
</a>
<a class='link' href="https://github.com/Fluffy-Bean">
<img class='svg' src='<?php echo $dir; ?>github-logo.svg'>
GitHub</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/github-logo.svg'>
GitHub
</a>
</div>
<div class="footer-child center flex-down">
<h3>Information</h3>
<a class='link' href="https://superdupersecteteuploadtest.fluffybean.gay/info/about.php">
<img class='svg' src='<?php echo $dir; ?>scroll.svg'>
About</a>
<a class='link' href="about.php">
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/scroll.svg'>
About
</a>
<a href="https://github.com/Fluffy-Bean/image-gallery">
<img class='svg' src='<?php echo $dir; ?>github-logo.svg'>
Project Code</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/github-logo.svg'>
Project Code
</a>
<a href="https://github.com/Fluffy-Bean/image-gallery/blob/main/LICENSE.md">
<img class='svg' src='<?php echo $dir; ?>link.svg'>
Legal</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/link.svg'>
Legal
</a>
</div>
<div class="footer-child center flex-down">
<h3>Other Work</h3>
<a class='link' href="https://testing.fluffybean.gay">
<img class='svg' src='<?php echo $dir; ?>link.svg'>
Testing Page</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/link.svg'>
Testing Page
</a>
<a class='link' href="https://gay.fluffybean.gay">
<img class='svg' src='<?php echo $dir; ?>link.svg'>
My website!</a>
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/link.svg'>
My website!
</a>
</div>
</footer>

View file

@ -1,30 +0,0 @@
<?php
// Check which directory icons are in
if (is_dir("assets/icons/")) {
$dir = "assets/icons/";
} else {
$dir = "../assets/icons/";
}
?>
<nav class="nav-root flex-left between">
<div class="nav-name flex-left">
<h3>OnlyLegs</h3>
</div>
<div class="nav-links flex-left">
<?php
echo "<a class='btn alert-default' href='https://superdupersecteteuploadtest.fluffybean.gay'><img class='svg' src='".$dir."house.svg'><span class='nav-hide'>Home</span></a>";
echo "<hr>";
echo "<a class='btn alert-default flyout-display' href='https://superdupersecteteuploadtest.fluffybean.gay?srch=show'><img class='svg' src='".$dir."binoculars.svg'><span class='nav-hide'>Search</span></a>";
echo "<hr>";
if (loggedin()) {
echo "<a class='btn alert-default' href='https://superdupersecteteuploadtest.fluffybean.gay/upload.php'><img class='svg' src='".$dir."upload.svg'><span class='nav-hide'>Upload</span></a>";
echo "<hr>";
echo "<a class='btn alert-default' href='https://superdupersecteteuploadtest.fluffybean.gay/account/account.php'><img class='svg' src='".$dir."user-circle.svg'><span class='nav-hide'>".substr($_SESSION["username"], 0, 15)."</span></a>";
} else {
echo "<a class='btn alert-high' href='https://superdupersecteteuploadtest.fluffybean.gay/account/login.php'><img class='svg' src='".$dir."user-circle-plus.svg'><span class='nav-hide'>Login</span></a>";
}
?>
</div>
</nav>

20
ui/nav.php Normal file
View file

@ -0,0 +1,20 @@
<nav class="nav-root flex-left between">
<div class="nav-name flex-left">
<p>Lynx Gallery</p>
</div>
<div class="nav-links flex-left">
<a class='btn alert-default' href='index.php'><img class='svg' src='<?php echo $root_dir; ?>assets/icons/house.svg'><span class='nav-hide'>Home</span></a>
<hr>
<a class='btn alert-default' href='search.php'><img class='svg' src='<?php echo $root_dir; ?>assets/icons/binoculars.svg'><span class='nav-hide'>Search</span></a>
<hr>
<?php
if (loggedin()) {
echo "<a class='btn alert-default' href='upload.php'><img class='svg' src='".$root_dir."assets/icons/upload.svg'><span class='nav-hide'>Upload</span></a>";
echo "<hr>";
echo "<a class='btn alert-default' href='/account/account.php'><img class='svg' src='".$root_dir."assets/icons/user-circle.svg'><span class='nav-hide'>".substr($_SESSION["username"], 0, 15)."</span></a>";
} else {
echo "<a class='btn alert-default' href='/account/login.php'><img class='svg' src='".$root_dir."assets/icons/user-circle-plus.svg'><span class='nav-hide'>Login</span></a>";
}
?>
</div>
</nav>

View file

@ -1,20 +1,56 @@
<?php
// Include required files and commands by every page on header
/*
Connect to database
In the future I want this section to be configurable, but that'll require some work to be done.
For now it's hard-coded, shouldn't be an issue as most people wont be changing this often anyway
*/
// Setting up connection variables
$conn_ip = "localhost";
$conn_username = "uwu";
$conn_password = "fennec621";
$conn_database = "swag";
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
if ($conn->connect_error) {
// Send notification that connection couldn't be made
}
/*
Start session
This is important as most pages use the PHP session and will complain if its not possible to access.
*/
session_start();
if (is_dir("ui/")) {
include_once("ui/functions.php");
/*
Check which directory user is in
I don't know if theres a better way of doing this? If there is please let me know
*/
if (is_file("index.php")) {
$root_dir = "";
} else {
include_once("../ui/functions.php");
$root_dir = "../";
}
$conn = mysqli_connect("localhost", "uwu", "fennec621", "swag");
if ($conn->connect_error) {
echo "<p class='alert alert-low'>Could not connect to database</p>";
}
/*
Include functions
Maybe I should put all the functions in this file? Dunno
*/
include $root_dir."ui/functions.php";
/*
Notification system
This is the notification system used by the website. Probably a little too much for what its used for
*/
echo "<div id='notify-root' class='notify-root'></div>";
?>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous">
<script>
console.log(" . . /|/| . . . . . . . \n .. /0 0 \\ . . . . . .. \n (III% . \\________, . . \n .. .\\_, .%###%/ \\'\\,.. \n . . . .||#####| |'\\ \\. \n .. . . ||. . .|/. .\\V. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . cc/ . .cc/ . . .");
</script>