mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-07 02:43:12 +00:00
Rewriting classes for de-oopsie-ing
This commit is contained in:
parent
7f1782d7c6
commit
646b41e90a
7 changed files with 42 additions and 20 deletions
|
@ -30,7 +30,7 @@
|
||||||
unset($_SESSION['err']);
|
unset($_SESSION['err']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_info->is_loggedin()) {
|
if ($user_info->is_loggedin($conn)) {
|
||||||
?>
|
?>
|
||||||
<div class="defaultDecoration defaultSpacing defaultFonts">
|
<div class="defaultDecoration defaultSpacing defaultFonts">
|
||||||
<h2>Profile</h2>
|
<h2>Profile</h2>
|
||||||
|
|
|
@ -345,7 +345,7 @@ if (isset($_POST['submit_signup'])) {
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Argh', 'Your invite code/token did not check out, woopsie!', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Argh', 'Your invite code did not check out, woopsie!', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error = $error + 1;
|
$error = $error + 1;
|
||||||
|
@ -353,7 +353,7 @@ if (isset($_POST['submit_signup'])) {
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Woops', 'The server or website died inside and could not process your information, sowwy!', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Woops', 'The server or website died inside and could not process your request, sowwy!', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error = $error + 1;
|
$error = $error + 1;
|
||||||
|
@ -390,7 +390,7 @@ if (isset($_POST['submit_signup'])) {
|
||||||
$token_array = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz';
|
$token_array = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz';
|
||||||
$new_token = substr(str_shuffle($token_array), 0, 15);
|
$new_token = substr(str_shuffle($token_array), 0, 15);
|
||||||
|
|
||||||
mysqli_query($conn, "INSERT INTO tokens (code, used) VALUES('$new_toke', False)");
|
mysqli_query($conn, "INSERT INTO tokens (code, used) VALUES('$new_toke', 0)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yupeee! Account was made
|
// Yupeee! Account was made
|
||||||
|
@ -400,7 +400,7 @@ if (isset($_POST['submit_signup'])) {
|
||||||
loginShow();
|
loginShow();
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','New account (".$username.") has been made')");
|
mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','New account ($username) has been made')");
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
|
@ -501,7 +501,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Meep', 'Enter a new password!', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Meep', 'Enter a new password!', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error += 1;
|
$error += 1;
|
||||||
|
@ -509,7 +508,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Not long enough...', 'Password, must be 6 or more characters in length uwu', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Not long enough...', 'Password, must be 6 or more characters in length uwu', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error += 1;
|
$error += 1;
|
||||||
|
@ -522,7 +520,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Meep', 'You must confirm the password!!!!', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Meep', 'You must confirm the password!!!!', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error += 1;
|
$error += 1;
|
||||||
|
@ -532,7 +529,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('AAAA', 'Passwords do not match!!!', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('AAAA', 'Passwords do not match!!!', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error += 1;
|
$error += 1;
|
||||||
|
@ -547,7 +543,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Oopsie', 'An error occured while figuring out which user to change the password of... Are you an admin?', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Oopsie', 'An error occured while figuring out which user to change the password of... Are you an admin?', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$error += 1;
|
$error += 1;
|
||||||
|
@ -582,7 +577,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Password updated', 'Password has been reset for user! But their session may still be active', 'var(--success)', 'assets/icons/check.svg');
|
sniffleAdd('Password updated', 'Password has been reset for user! But their session may still be active', 'var(--success)', 'assets/icons/check.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -590,7 +584,6 @@ if (isset($_POST['password_reset_submit'])) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
sniffleAdd('Bruh', 'Something happened on our end, sowwy', 'var(--warning)', 'assets/icons/cross.svg');
|
sniffleAdd('Bruh', 'Something happened on our end, sowwy', 'var(--warning)', 'assets/icons/cross.svg');
|
||||||
flyoutClose();
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -1054,6 +1054,7 @@ body * {
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
font-family: "Secular One", sans-serif;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-color: #E8E3E3;
|
background-color: #E8E3E3;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -1064,11 +1065,17 @@ body * {
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
font-family: "Secular One", sans-serif;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-color: #E8E3E3;
|
background-color: #E8E3E3;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
.btn:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
a.btn {
|
a.btn {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -100,6 +100,7 @@ body {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
font-family: $font-body;
|
||||||
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
||||||
|
@ -112,6 +113,12 @@ body {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a.btn {
|
a.btn {
|
||||||
|
|
23
index.php
23
index.php
|
@ -26,12 +26,21 @@
|
||||||
unset($_SESSION['del']);
|
unset($_SESSION['del']);
|
||||||
}
|
}
|
||||||
if (isset($_SESSION['welc'])) {
|
if (isset($_SESSION['welc'])) {
|
||||||
?>
|
$user = $user_info->get_user_info($conn, $_SESSION['id']);
|
||||||
<script>
|
|
||||||
sniffleAdd('O hi <?php echo $_SESSION["username"]; ?>', 'You are now logged in, enjoy your stay!', 'var(--success)', 'assets/icons/hand-waving.svg');
|
if (isset($user['pfp_path'])) {
|
||||||
</script>
|
?>
|
||||||
<?php
|
<script>
|
||||||
unset($_SESSION['welc']);
|
sniffleAdd('O hi <?php echo $_SESSION["username"]; ?>', 'You are now logged in, enjoy your stay!', 'var(--success)', 'images/pfp/<?php echo $user["pfp_path"]; ?>');
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
sniffleAdd('O hi <?php echo $_SESSION["username"]; ?>', 'You are now logged in, enjoy your stay!', 'var(--success)', 'assets/icons/hand-waving.svg');
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
if ($user_info->is_admin($conn, $_SESSION['id'])) {
|
if ($user_info->is_admin($conn, $_SESSION['id'])) {
|
||||||
$check_sanity = $sanity->get_results();
|
$check_sanity = $sanity->get_results();
|
||||||
|
@ -43,6 +52,8 @@
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($_SESSION['welc']);
|
||||||
}
|
}
|
||||||
if (isset($_SESSION['err'])) {
|
if (isset($_SESSION['err'])) {
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
$user_info = new Account();
|
$user_info = new Account();
|
||||||
|
|
||||||
// Check if the user is logged in, otherwise redirect to login page
|
// Check if the user is logged in, otherwise redirect to login page
|
||||||
if ($user_info->is_loggedin() != true) {
|
if ($user_info->is_loggedin($conn) == false) {
|
||||||
header("location: account.php");
|
header("location: account.php");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -26,6 +26,8 @@
|
||||||
<p>After reset, you will be kicked out to login again</p>
|
<p>After reset, you will be kicked out to login again</p>
|
||||||
<br>
|
<br>
|
||||||
<form id="passwordForm" method="POST" enctype="multipart/form-data">
|
<form id="passwordForm" method="POST" enctype="multipart/form-data">
|
||||||
|
<input id="currentPassword" class="btn btn-neutral" placeholder="Current password!!!!" type='password' disabled>
|
||||||
|
<br>
|
||||||
<input id="newPassword" class="btn btn-neutral" type="password" name="new_password" placeholder="New Password">
|
<input id="newPassword" class="btn btn-neutral" type="password" name="new_password" placeholder="New Password">
|
||||||
<input id="confirmPassword" class="btn btn-neutral" type="password" name="confirm_password" placeholder="Confirm Password">
|
<input id="confirmPassword" class="btn btn-neutral" type="password" name="confirm_password" placeholder="Confirm Password">
|
||||||
<br>
|
<br>
|
||||||
|
@ -38,11 +40,13 @@
|
||||||
<script>
|
<script>
|
||||||
$("#passwordForm").submit(function(event) {
|
$("#passwordForm").submit(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
var current_password = $("#currentPassword").val();
|
||||||
var new_password = $("#newPassword").val();
|
var new_password = $("#newPassword").val();
|
||||||
var confirm_password = $("#confirmPassword").val();
|
var confirm_password = $("#confirmPassword").val();
|
||||||
var submit = $("#passwordSubmit").val();
|
var submit = $("#passwordSubmit").val();
|
||||||
|
|
||||||
$("#newSniff").load("app/account/account.php", {
|
$("#newSniff").load("app/account/account.php", {
|
||||||
|
current_password: current_password,
|
||||||
new_password: new_password,
|
new_password: new_password,
|
||||||
confirm_password: confirm_password,
|
confirm_password: confirm_password,
|
||||||
password_reset_submit: submit
|
password_reset_submit: submit
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
$user_info = new Account();
|
$user_info = new Account();
|
||||||
|
|
||||||
// Check if user is logged in
|
// Check if user is logged in
|
||||||
if (!$user_info->is_loggedin()) {
|
if (!$user_info->is_loggedin($conn)) {
|
||||||
$_SESSION['err'] = "You must be logged in to upload images!!!!!!!!";
|
$_SESSION['err'] = "You must be logged in to upload images!!!!!!!!";
|
||||||
header("location: account.php");
|
header("location: account.php");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue