<?php
// =====================================================
// RESET ADMIN LOZINKE - TapTap Card
// =====================================================
// VAŽNO: OBRIŠI OVAJ FILE nakon korištenja!
// =====================================================

// Uključi config za bazu
require_once 'config.php';

$newPassword = 'mojTapTapace#25';
$username = 'admin';

// Generiraj hash
$hash = password_hash($newPassword, PASSWORD_DEFAULT);

echo "<h2>🔐 Reset Admin Lozinke</h2>";
echo "<hr>";

try {
    $db = getDB();
    
    // Update lozinke
    $stmt = $db->prepare('UPDATE admin_users SET password = ? WHERE username = ?');
    $stmt->execute([$hash, $username]);
    
    echo "<div style='color: green; font-size: 18px; font-weight: bold;'>";
    echo "✅ USPJEŠNO! Lozinka promijenjena!";
    echo "</div><br>";
    
    echo "<strong>Podaci za prijavu:</strong><br>";
    echo "Username: <code>{$username}</code><br>";
    echo "Password: <code>{$newPassword}</code><br><br>";
    
    echo "<hr>";
    echo "<div style='color: red; font-weight: bold;'>";
    echo "⚠️ VAŽNO: Odmah obriši ovaj file (reset-admin.php) sa servera!";
    echo "</div>";
    
} catch (Exception $e) {
    echo "<div style='color: red;'>";
    echo "❌ GREŠKA: " . $e->getMessage();
    echo "</div>";
}
?>