<!DOCTYPE html>
<html>
<head>
    <title>SMS Settings Check</title>
    <meta charset="UTF-8">
</head>
<body>
    <h1>SMS Settings Check</h1>
    <?php
    // Database configuration
    require_once 'config/database.php';

    echo "<h2>Checking SMS settings in database...</h2>\n\n";

    // Check all relevant settings
    $settings = [
        'non_musking_enabled',
        'non_musking_username',
        'non_musking_password',
        'sms_send_bank_transaction_notifications',
        'non_musking_templates_bank_transaction',
        'non_musking_templates_bank_transaction_rejection'
    ];

    foreach ($settings as $setting) {
        $stmt = $pdo->prepare("SELECT setting_value FROM settings WHERE setting_key = ?");
        $stmt->execute([$setting]);
        $result = $stmt->fetch();

        if ($result) {
            echo "<p><strong>$setting:</strong> " . htmlspecialchars($result['setting_value']) . "</p>\n";
        } else {
            echo "<p><strong>$setting:</strong> <span style='color: red;'>NOT FOUND</span></p>\n";
        }
    }

    echo "<h2>Checking if SMS helper functions exist...</h2>\n";

    // Check if sms_helper.php exists and has the required functions
    $smsHelperPath = 'includes/sms_helper.php';
    if (file_exists($smsHelperPath)) {
        echo "<p><span style='color: green;'>sms_helper.php exists</span></p>\n";
        $content = file_get_contents($smsHelperPath);
        
        $functions = ['non_musking_send_template', 'non_musking_send', 'sms_config'];
        foreach ($functions as $func) {
            if (strpos($content, $func) !== false) {
                echo "<p><strong>$func:</strong> <span style='color: green;'>FOUND</span></p>\n";
            } else {
                echo "<p><strong>$func:</strong> <span style='color: red;'>NOT FOUND</span></p>\n";
            }
        }
    } else {
        echo "<p><span style='color: red;'>sms_helper.php: NOT FOUND</span></p>\n";
    }

    echo "<h2>Checking config/sms.php file...</h2>\n";
    $smsConfigPath = 'config/sms.php';
    if (file_exists($smsConfigPath)) {
        echo "<p><span style='color: green;'>config/sms.php exists</span></p>\n";
    } else {
        echo "<p><span style='color: red;'>config/sms.php: NOT FOUND</span></p>\n";
    }
    ?>
</body>
</html>