File manager - Edit - /home/webapp69.cm.in.th/u69319090030/030 shop/admin/debug_db.php
Back
<?php require_once __DIR__ . '/../config/db.php'; echo "<h2>Database Debug Telemetry</h2>"; try { // Check if table exists $stmt = $pdo->query("SHOW TABLES LIKE 'users'"); $tableExists = $stmt->fetch(); if (!$tableExists) { echo "<p style='color:red;'>[ERROR] The 'users' table does not exist in the database '" . DB_NAME . "'.</p>"; echo "<p>Please open <strong>http://localhost/030 shop/admin/setup_db.php</strong> to create the tables.</p>"; } else { echo "<p style='color:green;'>[SUCCESS] The 'users' table exists.</p>"; // Fetch all users $stmt = $pdo->query("SELECT id, username, email, role, status, password FROM users"); $users = $stmt->fetchAll(); echo "<table border='1' cellpadding='8' style='border-collapse:collapse; width:100%; text-align:left;'>"; echo "<tr style='background:#eee;'><th>ID</th><th>Username</th><th>Email</th><th>Role</th><th>Status</th><th>Password Hash</th><th>Verify 'password123'</th></tr>"; if (empty($users)) { echo "<tr><td colspan='7' style='text-align:center;'>No users in database. Please run setup_db.php first.</td></tr>"; } else { foreach ($users as $u) { $isCorrectPassword = password_verify('password123', $u['password']) ? "✅ VALID" : "❌ INVALID"; echo "<tr>"; echo "<td>" . $u['id'] . "</td>"; echo "<td>" . htmlspecialchars($u['username']) . "</td>"; echo "<td>" . htmlspecialchars($u['email']) . "</td>"; echo "<td>" . htmlspecialchars($u['role']) . "</td>"; echo "<td>" . htmlspecialchars($u['status']) . "</td>"; echo "<td style='font-family:monospace;'>" . htmlspecialchars($u['password']) . "</td>"; echo "<td style='font-weight:bold;'>" . $isCorrectPassword . "</td>"; echo "</tr>"; } } echo "</table>"; } } catch (PDOException $e) { echo "<p style='color:red;'>[ERROR] Database Query Error: " . $e->getMessage() . "</p>"; }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings