-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_admin_users.php
More file actions
64 lines (56 loc) · 2.39 KB
/
debug_admin_users.php
File metadata and controls
64 lines (56 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
require_once 'includes/database.php';
echo "<h2>Admin Users Debug</h2>";
if ($conn && !$conn->connect_error) {
echo "<p>Database connection: OK</p>";
// Check if admin_users table exists
$result = $conn->query("SHOW TABLES LIKE 'admin_users'");
if ($result->num_rows > 0) {
echo "<p>admin_users table: EXISTS</p>";
// Get all admin users
$result = $conn->query("SELECT id, username, email, role, status, last_login, created_at FROM admin_users");
if ($result->num_rows > 0) {
echo "<h3>Admin Users:</h3>";
echo "<table border='1'>";
echo "<tr><th>ID</th><th>Username</th><th>Email</th><th>Role</th><th>Status</th><th>Last Login</th><th>Created</th></tr>";
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['role'] . "</td>";
echo "<td>" . $row['status'] . "</td>";
echo "<td>" . $row['last_login'] . "</td>";
echo "<td>" . $row['created_at'] . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<p>No admin users found</p>";
}
// Test password verification
echo "<h3>Password Test:</h3>";
$test_username = 'vikram@stratnova.ai';
$test_password = 'Stratnova@123';
$stmt = $conn->prepare("SELECT password FROM admin_users WHERE username = ?");
$stmt->bind_param("s", $test_username);
$stmt->execute();
$result = $stmt->get_result();
if ($user = $result->fetch_assoc()) {
$stored_hash = $user['password'];
echo "<p>User found: $test_username</p>";
echo "<p>Stored hash: " . substr($stored_hash, 0, 20) . "...</p>";
echo "<p>Password verify result: " . (password_verify($test_password, $stored_hash) ? 'SUCCESS' : 'FAILED') . "</p>";
} else {
echo "<p>User not found: $test_username</p>";
}
} else {
echo "<p>admin_users table: NOT EXISTS</p>";
}
} else {
echo "<p>Database connection: FAILED</p>";
if ($conn) {
echo "<p>Error: " . $conn->connect_error . "</p>";
}
}
?>