<?php
include 'db-connection.php';
session_start();

// Get the email from the session variable
$email = $_POST['email'];

// Get the new password from the POST data
$new_password = $_POST['password'];

// Prepare the SQL statement
$sql = "UPDATE admin_accounts SET password = '$new_password' WHERE email = '$email'";

// Execute the statement
$result = mysqli_query($conn, $sql);

// Check if the update was successful
if ($result) {
  // Password updated successfully
    header('Location: ../pages-login-admin.php?password-reset-successful');
} else {
  // Password update failed
    header('Location: ../forgot-password-reset.php?password-reset-failed');
}
