PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
// /admin/reset_password.php
require_once '../config/database.php';
// 1. Connect to Database
$database = new Database();
$db = $database->getConnection();
// 2. Define Credentials
$email = "admin@swift.com";
$new_password = "admin"; // <--- This is the password you want to use
// 3. Securely Hash the Password
$hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
try {
// 4. Check if user exists
$checkQuery = "SELECT id FROM users WHERE email = :email";
$stmt = $db->prepare($checkQuery);
$stmt->bindParam(":email", $email);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// UPDATE existing user
$updateQuery = "UPDATE users SET password = :password WHERE email = :email";
$updateStmt = $db->prepare($updateQuery);
$updateStmt->bindParam(":password", $hashed_password);
$updateStmt->bindParam(":email", $email);
$updateStmt->execute();
echo "<div style='color: green; font-family: sans-serif; padding: 20px; border: 2px solid green; background: #eaffea;'>
<h3>✅ Success!</h3>
<p>Password for <b>$email</b> has been reset.</p>
<p>New Password: <b>$new_password</b></p>
<a href='login.php'>Go to Login</a>
</div>";
} else {
// INSERT new user if not exists
$insertQuery = "INSERT INTO users (email, password, role) VALUES (:email, :password, 'admin')";
$insertStmt = $db->prepare($insertQuery);
$insertStmt->bindParam(":email", $email);
$insertStmt->bindParam(":password", $hashed_password);
$insertStmt->execute();
echo "<div style='color: blue; font-family: sans-serif; padding: 20px; border: 2px solid blue; background: #eaf4ff;'>
<h3>✅ Admin Created!</h3>
<p>User <b>$email</b> created successfully.</p>
<p>Password: <b>$new_password</b></p>
<a href='login.php'>Go to Login</a>
</div>";
}
} catch (PDOException $e) {
echo "<div style='color: red;'><h3>❌ Error</h3>" . $e->getMessage() . "</div>";
}
?>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E