More bug fixes!

This commit is contained in:
Michał Gdula 2022-10-05 18:54:26 +00:00
parent 59b30d9d73
commit be7d4b5b43
5 changed files with 30 additions and 22 deletions

View file

@ -18,9 +18,18 @@
<?php include __DIR__."/assets/ui/header.php"; ?>
</head>
<body>
<?php include __DIR__."/assets/ui/nav.php"; ?>
<?php
include __DIR__."/assets/ui/nav.php";
if (isset($_SESSION['err'])) {
?>
<script>
sniffleAdd('Woopsie', '<?php echo $_SESSION["err"]; ?>', 'var(--warning)', 'assets/icons/cross.svg');
</script>
<?php
unset($_SESSION['err']);
}
<?php
if ($user_info->is_loggedin()) {
?>
<div class="defaultDecoration defaultSpacing defaultFonts">

View file

@ -11,15 +11,6 @@
$group_info = new Group;
$diff = new Diff();
if (isset($_SESSION['err'])) {
?>
<script>
sniffleAdd("Error", "<?php echo $_SESSION['msg']; ?>", "var(--warning)", "assets/icons/trash.svg");
</script>
<?php
unset($_SESSION['err']);
}
if (!empty($_GET['id']) && isset($_GET['id']) && $_GET['id'] != null) {
$group = $group_info->get_group_info($conn, $_GET['id']);
@ -46,6 +37,15 @@
<?php
include __DIR__."/assets/ui/nav.php";
if (isset($_SESSION['err'])) {
?>
<script>
sniffleAdd("Error", "<?php echo $_SESSION['msg']; ?>", "var(--warning)", "assets/icons/trash.svg");
</script>
<?php
unset($_SESSION['err']);
}
if (isset($_SESSION['msg'])) {
?>
<script>
@ -54,9 +54,7 @@
<?php
unset($_SESSION['msg']);
}
?>
<?php
if (isset($_GET['id']) && !empty($_GET['id'])) {
$image_list = array_reverse(explode(" ", $group['image_list']));

View file

@ -94,10 +94,10 @@
<div class="defaultDecoration defaultSpacing defaultFonts">
<h2>Description</h2>
<?php
if (empty($image['description'])) {
if (empty($image['alt'])) {
echo "<p>No description provided.</p>";
} else {
echo "<p>".$image['description']."</p>";
echo "<p>".$image['alt']."</p>";
}
?>
</div>
@ -109,13 +109,13 @@
<?php
// User
if (empty($image['author'])) {
if (isset($author['username'])) {
echo "<p>Author: ".$author['username']."</p>";
} else {
echo "<p>Author: Deleted user</p>";
}
echo "<p>Author: No author</p>";
} else {
echo "<p>Author: <a href='profile.php?user=".$image['author']."' class='link'>".$author['username']."</a></p>";
if (isset($author['username'])) {
echo "<p>Author: <a href='profile.php?user=".$image['author']."' class='link'>".$author['username']."</a></p>";
} else {
echo "<p>Author: <a href='profile.php?user=".$image['author']."' class='link'>Deleted user</a></p>";
}
}
// Image ID

View file

@ -47,7 +47,7 @@
if (isset($_SESSION['err'])) {
?>
<script>
sniffleAdd('Error', '<?php echo $_SESSION["err"]; ?>', 'var(--warning)', 'assets/icons/cross.svg');
sniffleAdd('Woopsie', '<?php echo $_SESSION["err"]; ?>', 'var(--warning)', 'assets/icons/cross.svg');
</script>
<?php
unset($_SESSION['err']);

View file

@ -6,6 +6,7 @@
// Check if user is logged in
if (!$user_info->is_loggedin()) {
$_SESSION['err'] = "You must be logged in to upload images!!!!!!!!";
header("location: account.php");
}
?>