Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/portal/modules/membership/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/portal/modules/membership/check_codes_debug.php

<?php
require_once '../../config/config.php';
checkLogin();

$db = Database::getInstance()->getConnection();

echo "<h2>Database Column Information</h2>";

// Check table structure
try {
    $stmt = $db->query("DESCRIBE memberuser_codes");
    $columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    echo "<h3>memberuser_codes table structure:</h3>";
    echo "<table border='1' cellpadding='5'>";
    echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th><th>Extra</th></tr>";
    foreach ($columns as $col) {
        echo "<tr>";
        echo "<td>" . htmlspecialchars($col['Field']) . "</td>";
        echo "<td>" . htmlspecialchars($col['Type']) . "</td>";
        echo "<td>" . htmlspecialchars($col['Null']) . "</td>";
        echo "<td>" . htmlspecialchars($col['Key']) . "</td>";
        echo "<td>" . htmlspecialchars($col['Default']) . "</td>";
        echo "<td>" . htmlspecialchars($col['Extra']) . "</td>";
        echo "</tr>";
    }
    echo "</table>";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

echo "<h3>Sample code data:</h3>";

// Get one code to check
try {
    $stmt = $db->query("SELECT id, tracking_code, 
                               LENGTH(barcode) as barcode_length, 
                               LENGTH(qrcode) as qrcode_length,
                               LEFT(barcode, 50) as barcode_preview,
                               LEFT(qrcode, 50) as qrcode_preview
                        FROM memberuser_codes 
                        LIMIT 1");
    $code = $stmt->fetch(PDO::FETCH_ASSOC);
    
    if ($code) {
        echo "<table border='1' cellpadding='5'>";
        echo "<tr><th>Field</th><th>Value</th></tr>";
        foreach ($code as $key => $value) {
            echo "<tr>";
            echo "<td>" . htmlspecialchars($key) . "</td>";
            echo "<td>" . htmlspecialchars($value) . "</td>";
            echo "</tr>";
        }
        echo "</table>";
        
        // Try to get full barcode
        $stmt2 = $db->prepare("SELECT barcode, qrcode FROM memberuser_codes WHERE id = ?");
        $stmt2->execute([$code['id']]);
        $fullCode = $stmt2->fetch(PDO::FETCH_ASSOC);
        
        echo "<h4>Barcode starts with: " . htmlspecialchars(substr($fullCode['barcode'], 0, 100)) . "</h4>";
        echo "<h4>QR Code starts with: " . htmlspecialchars(substr($fullCode['qrcode'], 0, 100)) . "</h4>";
    } else {
        echo "<p>No codes found in database</p>";
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
?>

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