File manager - Edit - /home/justdoit/portal.springpasscapital.com/debug-registration.php
Back
<?php // debug-registration.php - Run this to test database connection error_reporting(E_ALL); ini_set('display_errors', 1); require_once 'config/database.php'; echo "<h2>Spring Pass Capital - Registration Debug</h2>"; // Test database connection try { echo "<p style='color:green;'>✅ Database connection successful</p>"; // Check if users table exists $stmt = $pdo->query("SHOW TABLES LIKE 'users'"); if ($stmt->rowCount() > 0) { echo "<p style='color:green;'>✅ Users table exists</p>"; // Show users table structure $stmt = $pdo->query("DESCRIBE users"); echo "<h3>Users Table Structure:</h3>"; echo "<table border='1' cellpadding='5'>"; echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th></tr>"; while ($row = $stmt->fetch()) { echo "<tr>"; echo "<td>{$row['Field']}</td>"; echo "<td>{$row['Type']}</td>"; echo "<td>{$row['Null']}</td>"; echo "<td>{$row['Key']}</td>"; echo "</tr>"; } echo "</table>"; // Check required columns $requiredColumns = ['username', 'date_of_birth', 'avatar', 'security_question', 'security_answer', 'referral_code', 'marketing_consent']; echo "<h3>Checking Required Columns:</h3>"; foreach ($requiredColumns as $column) { $stmt = $pdo->query("SHOW COLUMNS FROM users LIKE '$column'"); if ($stmt->rowCount() > 0) { echo "<p style='color:green;'>✅ Column '$column' exists</p>"; } else { echo "<p style='color:red;'>❌ Column '$column' is MISSING</p>"; } } } else { echo "<p style='color:red;'>❌ Users table does not exist! Run database_setup.sql first.</p>"; } // Check accounts table $stmt = $pdo->query("SHOW TABLES LIKE 'accounts'"); if ($stmt->rowCount() > 0) { echo "<p style='color:green;'>✅ Accounts table exists</p>"; } else { echo "<p style='color:red;'>❌ Accounts table does not exist!</p>"; } // Check transactions table $stmt = $pdo->query("SHOW TABLES LIKE 'transactions'"); if ($stmt->rowCount() > 0) { echo "<p style='color:green;'>✅ Transactions table exists</p>"; } else { echo "<p style='color:red;'>❌ Transactions table does not exist!</p>"; } // Check rewards table $stmt = $pdo->query("SHOW TABLES LIKE 'rewards'"); if ($stmt->rowCount() > 0) { echo "<p style='color:green;'>✅ Rewards table exists</p>"; } else { echo "<p style='color:red;'>❌ Rewards table does not exist!</p>"; } // Check messages table $stmt = $pdo->query("SHOW TABLES LIKE 'messages'"); if ($stmt->rowCount() > 0) { echo "<p style='color:green;'>✅ Messages table exists</p>"; } else { echo "<p style='color:red;'>❌ Messages table does not exist!</p>"; } // Test insert (will be rolled back) echo "<h3>Testing Registration Insert:</h3>"; try { $pdo->beginTransaction(); $testData = [ 'John Debug', 'debuguser123', 'debug@test.com', password_hash('Test@1234', PASSWORD_DEFAULT), '+1234567890', '1990-01-01', 'JD', 'pet', password_hash('fluffy', PASSWORD_DEFAULT), 'DEBUG123', 'customer', 'pending_kyc', 0 ]; $stmt = $pdo->prepare(" INSERT INTO users ( full_name, username, email, password, phone, date_of_birth, avatar, security_question, security_answer, referral_code, role, status, marketing_consent, created_at, updated_at ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW() ) "); $stmt->execute($testData); $testUserId = $pdo->lastInsertId(); echo "<p style='color:green;'>✅ Test insert successful (ID: $testUserId)</p>"; $pdo->rollBack(); echo "<p style='color:blue;'>ℹ️ Test data rolled back</p>"; } catch (Exception $e) { $pdo->rollBack(); echo "<p style='color:red;'>❌ Test insert failed: " . $e->getMessage() . "</p>"; } } catch (PDOException $e) { echo "<p style='color:red;'>❌ Database connection failed: " . $e->getMessage() . "</p>"; } echo "<hr>"; echo "<p><a href='register.php'>Go to Registration Page</a></p>"; echo "<p><a href='index.php'>Go to Login Page</a></p>"; ?>
| ver. 1.4 |
Github
|
.
| PHP 7.0.33 | Generation time: 0.11 |
proxy
|
phpinfo
|
Settings