<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "<h2>Testing update.php dependencies</h2>";

// Test 1: Check class.crud.php syntax
echo "<h3>1. Checking class.crud.php syntax:</h3>";
$output = shell_exec('php -l class.crud.php 2>&1');
echo "<pre>$output</pre>";

// Test 2: Try to load class.crud.php
echo "<h3>2. Loading class.crud.php:</h3>";
try {
    include_once 'class.crud.php';
    echo "<span style='color:green;'>SUCCESS</span><br>";
} catch (Throwable $e) {
    echo "<span style='color:red;'>ERROR: " . $e->getMessage() . "</span><br>";
    echo "File: " . $e->getFile() . "<br>";
    echo "Line: " . $e->getLine() . "<br>";
}

// Test 3: Check if dbconnect.php exists
echo "<h3>3. Checking dbconnect.php:</h3>";
if (file_exists('dbconnect.php')) {
    echo "<span style='color:green;'>EXISTS</span><br>";
    try {
        include 'dbconnect.php';
        echo "<span style='color:green;'>Loaded successfully</span><br>";
    } catch (Throwable $e) {
        echo "<span style='color:red;'>ERROR: " . $e->getMessage() . "</span><br>";
    }
} else {
    echo "<span style='color:red;'>NOT FOUND</span><br>";
}

echo "<h3>Done</h3>";
?>
