![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/-73928298/ |
<?php
require_once 'config/database.php';
echo "<h2>Database Connection Test</h2>";
// Test database connection
$pdo = getDBConnection();
if ($pdo) {
echo "✅ Database connection successful<br>";
// Test users table structure
try {
$stmt = $pdo->query("DESCRIBE users");
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<h3>Users Table Structure:</h3>";
echo "<table border='1'>";
echo "<tr><th>Column</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th></tr>";
foreach ($columns as $column) {
echo "<tr>";
echo "<td>" . $column['Field'] . "</td>";
echo "<td>" . $column['Type'] . "</td>";
echo "<td>" . $column['Null'] . "</td>";
echo "<td>" . $column['Key'] . "</td>";
echo "<td>" . $column['Default'] . "</td>";
echo "</tr>";
}
echo "</table>";
// Test registration query
echo "<h3>Testing Registration Query:</h3>";
$testName = "Test User";
$testEmail = "test" . time() . "@example.com";
$testPassword = password_hash("test123", PASSWORD_DEFAULT);
$testCity = "Test City";
$testCountry = "Test Country";
try {
$stmt = $pdo->prepare("
INSERT INTO users (name, email, password, credits, plan, city, country, created_at)
VALUES (?, ?, ?, 5, 'free', ?, ?, NOW())
");
if ($stmt->execute([$testName, $testEmail, $testPassword, $testCity, $testCountry])) {
$userId = $pdo->lastInsertId();
echo "✅ Test registration successful! User ID: $userId<br>";
// Clean up test user
$stmt = $pdo->prepare("DELETE FROM users WHERE id = ?");
$stmt->execute([$userId]);
echo "✅ Test user cleaned up<br>";
} else {
echo "❌ Test registration failed<br>";
print_r($stmt->errorInfo());
}
} catch (Exception $e) {
echo "❌ Test registration error: " . $e->getMessage() . "<br>";
}
} catch (Exception $e) {
echo "❌ Error checking table structure: " . $e->getMessage() . "<br>";
}
} else {
echo "❌ Database connection failed<br>";
}
echo "<h3>Registration Form Test:</h3>";
echo "<form method='POST' action='auth/register_new.php'>";
echo "<input type='text' name='name' placeholder='Name' required><br>";
echo "<input type='email' name='email' placeholder='Email' required><br>";
echo "<input type='password' name='password' placeholder='Password' required><br>";
echo "<input type='password' name='confirm_password' placeholder='Confirm Password' required><br>";
echo "<input type='text' name='city' placeholder='City'><br>";
echo "<input type='text' name='country' placeholder='Country'><br>";
echo "<button type='submit'>Test Registration</button>";
echo "</form>";
?>