Fixing directory and required file issues

This commit is contained in:
Michał 2022-09-13 16:07:01 +00:00
parent 9ed36e2738
commit 1472692ed5
16 changed files with 51 additions and 119 deletions

View file

@ -2,14 +2,14 @@
<html>
<head>
<?php include "ui/header.php"; ?>
<?php require_once __DIR__."/ui/header.php"; ?>
</head>
<body>
<?php
include "ui/required.php";
include "ui/nav.php";
require_once __DIR__."/ui/required.php";
require_once __DIR__."/ui/nav.php";
?>
<div class="about-root">
@ -53,7 +53,7 @@
<p>To mrHDash...</p>
</div>
<?php include "ui/footer.php"; ?>
<?php require_once __DIR__."/ui/footer.php"; ?>
</body>
</html>

View file

@ -2,13 +2,13 @@
<html>
<head>
<?php include "ui/header.php"; ?>
<?php require_once __DIR__."/ui/header.php"; ?>
</head>
<body>
<?php
include "ui/required.php";
include "ui/nav.php";
require_once __DIR__."/ui/required.php";
require_once __DIR__."/ui/nav.php";
use App\Account;
@ -124,7 +124,7 @@
}
?>
<?php include "ui/footer.php"; ?>
<?php require_once __DIR__."/ui/footer.php"; ?>
</body>
</html>

View file

@ -1,7 +1,6 @@
<?php
// Include server connection
include "../server/conn.php";
include dirname(__DIR__)."/server/conn.php";
/*
|-------------------------------------------------------------

View file

@ -15,7 +15,7 @@
// Initialize the session
session_start();
// Include server connection
include "../server/conn.php";
include dirname(__DIR__)."/server/conn.php";
if (isset($_POST['submit'])) {
/*
@ -32,7 +32,7 @@ if (isset($_POST['submit'])) {
if (empty(trim($_POST["new_password"]))) {
?>
<script>
sniffleAdd('Meep', 'Enter a new password!', 'var(--red)', '../assets/icons/cross.svg');
sniffleAdd('Meep', 'Enter a new password!', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose();
</script>
<?php
@ -40,7 +40,7 @@ if (isset($_POST['submit'])) {
} elseif(strlen(trim($_POST["new_password"])) < 6) {
?>
<script>
sniffleAdd('Not long enough...', 'Password, must be 6 or more characters in length uwu', 'var(--red)', '../assets/icons/cross.svg');
sniffleAdd('Not long enough...', 'Password, must be 6 or more characters in length uwu', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose();
</script>
<?php
@ -53,7 +53,7 @@ if (isset($_POST['submit'])) {
if (empty(trim($_POST["confirm_password"]))) {
?>
<script>
sniffleAdd('Meep', 'You must confirm the password!!!!', 'var(--red)', '../assets/icons/cross.svg');
sniffleAdd('Meep', 'You must confirm the password!!!!', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose();
</script>
<?php
@ -63,7 +63,7 @@ if (isset($_POST['submit'])) {
if(empty($error) && ($new_password != $confirm_password)) {
?>
<script>
sniffleAdd('AAAA', 'Passwords do not match!!!', 'var(--red)', '../assets/icons/cross.svg');
sniffleAdd('AAAA', 'Passwords do not match!!!', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose();
</script>
<?php
@ -89,14 +89,14 @@ if (isset($_POST['submit'])) {
session_destroy();
?>
<script>
sniffleAdd('Password updated', 'Now goodbye.... you will be redirected in a moment', 'var(--green)', '../assets/icons/check.svg');
setTimeout(function(){window.location.href = "../account/login.php";}, 2000);
sniffleAdd('Password updated', 'Now goodbye.... you will be redirected in a moment', 'var(--green)', 'assets/icons/check.svg');
setTimeout(function(){window.location.href = "account/login.php";}, 2000);
</script>
<?php
} else {
?>
<script>
sniffleAdd('Bruh', 'Something happened on our end, sowwy', 'var(--red)', '../assets/icons/cross.svg');
sniffleAdd('Bruh', 'Something happened on our end, sowwy', 'var(--red)', 'assets/icons/cross.svg');
flyoutClose();
</script>
<?php

View file

@ -1,8 +1,8 @@
<?php
session_start();
// Include server connection
include "../server/conn.php";
include "../app.php";
include dirname(__DIR__)."/server/conn.php";
include dirname(__DIR__)."/app.php";
use App\Account;
use App\Image;
@ -37,16 +37,16 @@ if (isset($_POST['submit_delete'])) {
// Attempt to execute the prepared statement
if (mysqli_stmt_execute($stmt)) {
// See if image is in the directory
if (is_file("../../images/".$image_array['imagename'])) {
unlink("../../images/".$image_array['imagename']);
if (is_file(dirname(__DIR__)."/images/".$image_array['imagename'])) {
unlink(dirname(__DIR__)."/images/".$image_array['imagename']);
}
// Delete thumbnail if exitsts
if (is_file("../../images/thumbnails/".$image_array['imagename'])) {
unlink("../../images/thumbnails/".$image_array['imagename']);
if (is_file(dirname(__DIR__)."/images/thumbnails/".$image_array['imagename'])) {
unlink(dirname(__DIR__)."/images/thumbnails/".$image_array['imagename']);
}
// Delete preview if exitsts
if (is_file("../../images/previews/".$image_array['imagename'])) {
unlink("../../images/previews/".$image_array['imagename']);
if (is_file(dirname(__DIR__)."/images/previews/".$image_array['imagename'])) {
unlink(dirname(__DIR__)."/images/previews/".$image_array['imagename']);
}
// TP user to the homepage with a success message
?>

View file

@ -8,8 +8,8 @@
*/
session_start();
// Include server connection
include "../server/conn.php";
include "../app.php";
include dirname(__DIR__)."/server/conn.php";
include dirname(__DIR__)."/app.php";
use App\Make;

View file

@ -9,11 +9,6 @@ $conn_username = "uwu";
$conn_password = "fennec621";
$conn_database = "gallery";
/*
echo $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['SCRIPT_NAME']);
echo $_SERVER['PHP_SELF'];
*/
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
if ($conn->connect_error) {
?>

View file

@ -1,16 +1,4 @@
<script>
console.log("⣿⣿⣿⣿⣿⡿⠿⠻⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠻⠻⠟⠻⢿⣿⣿⣿⣿\n\
⣿⣿⡟⠁⢀⣠⣤⣤⣤⣤⣄⣀⣀⣀⣹⣿⣿⣷⣄⣀⣀⣀⣀⣤⣤⣤⣤⣀⠐⢽⣿⣿⣿\n\
⣿⣿⣿⣶⣿⡿⣛⡒⠒⠒⢒⠒⣲⠙⣿⣿⣿⣿⠟⣵⡒⢒⠒⠒⡀⣘⡻⣿⣿⣾⣿⣿⣿\n\
⣿⣿⣿⣿⣏⣞⡛⠃⠀⠀⠸⠷⢿⣧⣿⣿⣿⣿⣧⣿⣷⣛⣀⣀⣁⣛⣛⣮⣿⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢏⣾⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢻⣿⠏⣼⣿⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠿⠟⢛⣉⣴⣿⡏⣸⣿⣿⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⣧⣠⣤⣤⣤⣤⣤⣤⣶⣶⣶⣶⣿⣿⣿⣿⣿⠃⣿⣿⣿⣿⣿⣿⣿\n\
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿");
console.log(". . /|/| . . . . . . .\n\
.. /0 0 \\ . . . . . ..\n\
(III% . \\________, . .\n\

View file

@ -2,7 +2,7 @@
<html>
<head>
<?php include "ui/header.php"; ?>
<?php require_once __DIR__."/ui/header.php"; ?>
</head>
@ -18,8 +18,8 @@
| many rewrites and hours of learning....
|-------------------------------------------------------------
*/
include "ui/required.php";
include "ui/nav.php";
require_once __DIR__."/ui/required.php";
require_once __DIR__."/ui/nav.php";
use App\Account;
use App\Image;
@ -416,7 +416,7 @@
}
?>
<?php include "ui/footer.php"; ?>
<?php require_once __DIR__."/ui/footer.php"; ?>
</body>
</html>

View file

@ -2,13 +2,13 @@
<html>
<head>
<?php include "ui/header.php"; ?>
<?php require_once __DIR__."/ui/header.php"; ?>
</head>
<body>
<?php
include "ui/required.php";
include "ui/nav.php";
require_once __DIR__."/ui/required.php";
require_once __DIR__."/ui/nav.php";
?>
<script>
@ -83,6 +83,6 @@ include "ui/nav.php";
?>
</div>
<?php include "ui/footer.php"; ?>
<?php require_once __DIR__."/ui/footer.php"; ?>
</body>
</html>

View file

@ -2,14 +2,14 @@
<html>
<head>
<?php include "ui/header.php"; ?>
<?php require_once __DIR__."/ui/header.php"; ?>
</head>
<body>
<?php
include "ui/required.php";
include "ui/nav.php";
require_once __DIR__."/ui/required.php";
require_once __DIR__."/ui/nav.php";
use App\Account;
@ -48,7 +48,7 @@
});
</script>
<?php include "ui/footer.php"; ?>
<?php require_once __DIR__."/ui/footer.php"; ?>
</body>
</html>

View file

@ -1,48 +0,0 @@
<?php
/*if (isset($_GET['q']) && !empty($_GET['q'])) {
// Make search into an array
$search_array = explode(" ", $_GET['q']);
// Get images tags for comparing
$image_tag_array = explode(" ", $image['tags']);
// Compare arrays
$compare_results = array_intersect($image_tag_array, $search_array);
if (count($compare_results) > 0) {
// Getting thumbnail
if (file_exists("images/thumbnails/".$image['imagename'])) {
$image_path = "images/thumbnails/".$image['imagename'];
} else {
$image_path = "images/".$image['imagename'];
}
// Image loading
echo "<div class='gallery-item'>";
echo "<a href='image.php?id=".$image['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>";
echo "</div>";
}
}*/
?>
<!DOCTYPE html>
<html>
<head>
<?php include "ui/header.php"; ?>
</head>
<body>
<?php
include "ui/required.php";
include "ui/nav.php";
?>
<div class="search-root">
<h2>Where did the search go!</h2>
<p>Due to how it was implemented originally, it was hard to handle and work with. So I removed it.</p>
<p>It'll be coming back, but since it's going to be a lot of work it'll have to be much later.</p>
</div>
<?php include "ui/footer.php"; ?>
</body>
</html>

View file

@ -1,10 +1,10 @@
<footer class="flex-left around">
<a class='link' href="https://github.com/Fluffy-Bean">
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/github-logo.svg'>
<a class='link' href="https://github.com/Fluffy-Bean/image-gallery">
<img class='svg' src='assets/icons/github-logo.svg'>
Github
</a>
<a class='link' href="<?php echo $root_dir; ?>about.php">
<img class='svg' src='<?php echo $root_dir; ?>assets/icons/scroll.svg'>
<a class='link' href="about.php">
<img class='svg' src='assets/icons/scroll.svg'>
About
</a>

View file

@ -11,8 +11,6 @@ $loggedin = new Account();
<div class="nav-links flex-left">
<a class='btn' href='index.php'><img class='svg' src='assets/icons/house.svg'><span class='nav-hide'>Home</span></a>
<hr>
<a class='btn' href='search.php'><img class='svg' src='assets/icons/binoculars.svg'><span class='nav-hide'>Search</span></a>
<hr>
<?php
if ($loggedin->is_loggedin()) {
?>

View file

@ -2,7 +2,7 @@
/*
User defined settings
*/
include "app/settings/settings.php";
require_once dirname(__DIR__)."/app/settings/settings.php";
/*if ($debug["testing"]) {
// Used for testing, do not use this in production
@ -36,13 +36,13 @@ if (is_file("index.php")) {
/*
Connect to the server
*/
include "app/server/conn.php";
include "app/server/secrete.php";
require_once dirname(__DIR__)."/app/server/conn.php";
require_once dirname(__DIR__)."/app/server/secrete.php";
/*
Classes
*/
require_once 'app/app.php';
require_once dirname(__DIR__)."/app/app.php";
?>
<script>

View file

@ -2,7 +2,7 @@
<html>
<head>
<?php include "ui/header.php"; ?>
<?php require_once __DIR__."/ui/header.php"; ?>
<!-- Upload Script -->
<script>
@ -55,8 +55,8 @@
<body>
<?php
include "ui/required.php";
include "ui/nav.php";
require_once __DIR__."/ui/required.php";
require_once __DIR__."/ui/nav.php";
use App\Account;
$user_info = new Account();
@ -84,7 +84,7 @@
</form>
</div>
<?php include "ui/footer.php"; ?>
<?php require_once __DIR__."/ui/footer.php"; ?>
</body>
</html>