<?php
/**
 * Install Eight — Projects table
 * Run once in browser, then delete this file.
 */
require_once 'config.php';
require_once 'function.php';

header('Content-Type: text/html; charset=utf-8');

if (!$conn) {
    die('<h2 style="color:red">DB connection failed</h2>');
}

ensure_projects_table();

$prefix = DB_PREFIX;
$check = $conn->query("SHOW TABLES LIKE '{$prefix}projects'");
$ok = $check && $check->num_rows > 0;

echo '<!DOCTYPE html><html><head><meta charset="utf-8"><title>Install Eight</title></head><body style="font-family:sans-serif;padding:40px">';
if ($ok) {
    echo '<h2 style="color:green">✓ ste_projects table ready</h2>';
    echo '<p>Projects admin: <a href="admin/projects.php">admin/projects.php</a></p>';
    echo '<p style="color:#b45309"><strong>Delete install-eight.php after this.</strong></p>';
} else {
    echo '<h2 style="color:red">Table creation failed: ' . htmlspecialchars($conn->error) . '</h2>';
}
echo '</body></html>';
