PDO::ERRMODE_EXCEPTION] ); $hash = password_hash($password, PASSWORD_BCRYPT); // Check if user exists $check = $pdo->prepare("SELECT COUNT(*) FROM admin_users WHERE email = ?"); $check->execute([$email]); if ($check->fetchColumn() > 0) { // Update existing $s = $pdo->prepare("UPDATE admin_users SET password_hash = ? WHERE email = ?"); $s->execute([$hash, $email]); $message = 'Password updated successfully!'; } else { // Create new $s = $pdo->prepare("INSERT INTO admin_users (id, email, password_hash, created_at) VALUES (?, ?, ?, NOW())"); $s->execute(['admin-1', $email, $hash]); $message = 'Admin account created successfully!'; } // Verify if (password_verify($password, $hash)) { $success = true; } else { $message = 'Error: Password verification failed.'; } } catch (Exception $e) { $message = 'Database error: ' . $e->getMessage(); } } } ?>
You can now login to the admin panel.
⚠ Delete this file immediately!
Run in SSH: rm /home/epictravelexpeditions.com/public_html/api/setup_password.php