<?php
// Simple test to check if the page can load
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "<h1>Test Page Loading Check</h1>";

// Test basic PHP functionality
echo "<p>PHP is working: " . phpversion() . "</p>";

// Test file existence
$files_to_check = [
    '../config/database.php',
    '../includes/sms_helper.php'
];

foreach ($files_to_check as $file) {
    if (file_exists($file)) {
        echo "<p style='color:green;'>✓ File exists: $file</p>";
    } else {
        echo "<p style='color:red;'>✗ File missing: $file</p>";
    }
}

// Try to include files
try {
    if (file_exists('../config/database.php')) {
        require_once '../config/database.php';
        echo "<p style='color:green;'>✓ Database file included successfully</p>";
        
        // Test database connection
        if (isset($pdo)) {
            echo "<p style='color:green;'>✓ Database connection available</p>";
        } else {
            echo "<p style='color:orange;'>⚠ Database connection not established</p>";
        }
    }
} catch (Exception $e) {
    echo "<p style='color:red;'>✗ Error including database: " . $e->getMessage() . "</p>";
}

try {
    if (file_exists('../includes/sms_helper.php')) {
        require_once '../includes/sms_helper.php';
        echo "<p style='color:green;'>✓ SMS Helper included successfully</p>";
    }
} catch (Exception $e) {
    echo "<p style='color:red;'>✗ Error including SMS helper: " . $e->getMessage() . "</p>";
}

echo "<p><a href='test_non_musking_sms.php'>Try the main test page again</a></p>";
?>