<?php
/**
 * One-time script: Update all members' phone and email for owner testing.
 * Sets phone = 0243658609, email = appnationals@gmail.com for every member.
 * Run once via browser: /nazareth/install/update-members-contact-for-testing.php
 */

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

header('Content-Type: text/html; charset=utf-8');
echo "<!DOCTYPE html><html><head><meta charset='UTF-8'><title>Update Members Contact</title>";
echo "<style>body{font-family:system-ui,sans-serif;padding:2rem;background:#f5f5f5;}pre{background:#fff;padding:1rem;border-radius:8px;}</style></head><body><h1>Update members contact for testing</h1><pre>\n";

try {
    $stmt = $pdo->prepare("UPDATE members SET phone = ?, email = ?");
    $stmt->execute(['0243658609', 'appnationals@gmail.com']);
    $updated = $stmt->rowCount();

    echo "Done. Updated $updated member(s):\n";
    echo "  - phone = 0243658609\n";
    echo "  - email = appnationals@gmail.com\n";
    echo "\n<a href='" . (defined('BASE_PATH') ? BASE_PATH : '/nazareth') . "/members'>View Members</a>\n";
} catch (PDOException $e) {
    echo "Error: " . htmlspecialchars($e->getMessage()) . "\n";
}

echo "</pre></body></html>";
