2022-07-26 13:27:27 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2022-08-03 16:46:50 +00:00
|
|
|
<title>Lynx Gallery</title>
|
|
|
|
|
2022-08-09 20:09:20 +00:00
|
|
|
<!-- Stylesheets -->
|
2022-08-12 16:54:35 +00:00
|
|
|
<link rel="stylesheet" href="../css/main.css">
|
2022-08-09 20:09:20 +00:00
|
|
|
<link rel="stylesheet" href="../css/normalise.css">
|
|
|
|
|
|
|
|
<!-- Google Fonts -->
|
|
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@600">
|
|
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Secular+One&display=swap">
|
2022-08-03 16:46:50 +00:00
|
|
|
|
|
|
|
<!-- JQuery -->
|
2022-08-09 20:09:20 +00:00
|
|
|
<script
|
|
|
|
src="https://code.jquery.com/jquery-3.6.0.min.js"
|
|
|
|
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
|
|
|
crossorigin="anonymous">
|
|
|
|
</script>
|
2022-08-09 10:14:30 +00:00
|
|
|
|
|
|
|
<!-- Sniffle script! -->
|
|
|
|
<script src="../Sniffle/sniffle.js"></script>
|
|
|
|
<link rel='stylesheet' href='../Sniffle/sniffle.css'>
|
|
|
|
|
|
|
|
<!-- Flyout script! -->
|
|
|
|
<script src="../Flyout/flyout.js"></script>
|
|
|
|
<link rel='stylesheet' href='../Flyout/flyout.css'>
|
2022-07-26 13:27:27 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
2022-08-09 10:14:30 +00:00
|
|
|
include "../ui/required.php";
|
2022-08-03 16:46:50 +00:00
|
|
|
include "../ui/nav.php";
|
2022-07-26 13:27:27 +00:00
|
|
|
|
|
|
|
// Initialize the session
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
// Check if the user is logged in, otherwise redirect to login page
|
|
|
|
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
|
2022-07-26 13:52:41 +00:00
|
|
|
header("location: https://superdupersecteteuploadtest.fluffybean.gay/account/login.php");
|
2022-07-26 13:27:27 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['reset'])) {
|
|
|
|
|
|
|
|
// Validate new password
|
|
|
|
if (empty(trim($_POST["new_password"]))) {
|
|
|
|
$error = "Enter new password!";
|
|
|
|
} elseif(strlen(trim($_POST["new_password"])) < 6) {
|
|
|
|
$error = "Password not long enough, must be 6 or more characters!";
|
|
|
|
} else {
|
|
|
|
$new_password = trim($_POST["new_password"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate confirm password
|
|
|
|
if (empty(trim($_POST["confirm_password"]))) {
|
|
|
|
$error = "Pls confirm the password";
|
|
|
|
} else {
|
|
|
|
$confirm_password = trim($_POST["confirm_password"]);
|
|
|
|
if(empty($error) && ($new_password != $confirm_password)) {
|
|
|
|
$error = "Password did not match!!!!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for errors
|
|
|
|
if (empty($error)) {
|
|
|
|
// Prepare for wack
|
|
|
|
$sql = "UPDATE users SET password = ? WHERE id = ?";
|
|
|
|
|
|
|
|
if ($stmt = mysqli_prepare($conn, $sql)) {
|
|
|
|
mysqli_stmt_bind_param($stmt, "si", $param_password, $param_id);
|
|
|
|
|
|
|
|
// Setting up Password parameters
|
|
|
|
$param_password = password_hash($new_password, PASSWORD_DEFAULT);
|
|
|
|
$param_id = $_SESSION["id"];
|
|
|
|
|
|
|
|
// Attempt to execute (sus)
|
|
|
|
if (mysqli_stmt_execute($stmt)) {
|
|
|
|
// Password updated!!!! Now goodbye
|
|
|
|
session_destroy();
|
2022-07-26 13:52:41 +00:00
|
|
|
header("Location: https://superdupersecteteuploadtest.fluffybean.gay/account/login.php");
|
2022-07-26 13:27:27 +00:00
|
|
|
} else {
|
|
|
|
$error = "Oopsie woopsie, somthing brokie :c";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
2022-08-12 16:54:35 +00:00
|
|
|
<div class="password-reset-root">
|
|
|
|
<h2>Reset Password</h2>
|
|
|
|
<p>After reset, you will be kicked out to login again</p>
|
|
|
|
<br>
|
|
|
|
<form method="POST" action="password-reset.php" enctype="multipart/form-data">
|
|
|
|
<input class="btn btn-neutral" type="password" name="new_password" placeholder="New Password">
|
|
|
|
<input class="btn btn-neutral" type="password" name="confirm_password" placeholder="Confirm Password">
|
|
|
|
<br>
|
|
|
|
<button class="btn btn-bad" type="submit" name="reset"><img class="svg" src="../assets/icons/sign-in.svg">Reset</button>
|
2022-07-26 13:27:27 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
2022-08-09 10:14:30 +00:00
|
|
|
<?php include "../ui/footer.php"; ?>
|
2022-07-26 13:27:27 +00:00
|
|
|
</body>
|
|
|
|
</html>
|