Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/portal/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/portal/check_db.php

<?php
require_once 'config/config.php';

echo "<h1>Database Status Check</h1>";

try {
    $db = Database::getInstance()->getConnection();
    
    // Check if members table exists
    $stmt = $db->query("SHOW TABLES LIKE 'members'");
    if ($stmt->rowCount() > 0) {
        echo "<p style='color: green;'>✓ Members table exists</p>";
        
        // Check if member_id column exists
        $stmt = $db->query("SHOW COLUMNS FROM members LIKE 'member_id'");
        if ($stmt->rowCount() > 0) {
            echo "<p style='color: green;'>✓ member_id column exists</p>";
        } else {
            echo "<p style='color: red;'>✗ member_id column is missing!</p>";
        }
        
        // Show all columns
        echo "<h3>Available columns in members table:</h3>";
        $columns = $db->query("SHOW COLUMNS FROM members")->fetchAll();
        echo "<ul>";
        foreach ($columns as $col) {
            echo "<li>{$col['Field']} - {$col['Type']}</li>";
        }
        echo "</ul>";
        
    } else {
        echo "<p style='color: red;'>✗ Members table does NOT exist!</p>";
        echo "<p><strong>You need to run the installer:</strong></p>";
        echo "<p><a href='install.php' style='background: blue; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;'>Run Installer</a></p>";
    }
    
    // Show all tables
    echo "<h3>Available tables in database:</h3>";
    $tables = $db->query("SHOW TABLES")->fetchAll();
    if (count($tables) > 0) {
        echo "<ul>";
        foreach ($tables as $table) {
            echo "<li>" . $table[0] . "</li>";
        }
        echo "</ul>";
    } else {
        echo "<p style='color: red;'>No tables found. Database is empty!</p>";
    }
    
} catch (PDOException $e) {
    echo "<p style='color: red;'>Database connection error: " . $e->getMessage() . "</p>";
    echo "<p><strong>You need to run the installer:</strong></p>";
    echo "<p><a href='install.php' style='background: blue; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;'>Run Installer</a></p>";
}
?>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists