<?php
/**
 * Reset Admin Password
 * Digital Product Store
 * WARNING: Delete this file immediately after use!
 */

require_once __DIR__ . '/config/database.php';

// === CONFIGURE THESE ===
$admin_email = 'admin@digitalstore.com';  // Your admin username/email
$new_password = 'e64b78fc3b';            // New password you want to set
// =======================

$hashed_password = password_hash($new_password, PASSWORD_DEFAULT);

try {
    $stmt = $pdo->prepare("UPDATE admins SET password = ? WHERE username = ?");
    $stmt->execute([$hashed_password, $admin_email]);

    if ($stmt->rowCount() > 0) {
        echo "✅ Password successfully updated for {$admin_email}. You can now log in.";
    } else {
        echo "⚠️ No admin found with username {$admin_email}. Check your email.";
    }
} catch (PDOException $e) {
    echo "❌ Error updating password: " . $e->getMessage();
}
?>