<?php
// db_test.php
echo "<h3>Database Connection Bruteforce Tester</h3>";

$host = 'localhost';
$db = 'u69319090017';

// List of potential usernames
$users = [
    'u69319090017',
    '69319090017'
];

// List of potential passwords to try
$passwords = [
    '69319090017',     // Student ID only (no 'u')
    'u69319090017',    // Student ID with 'u'
    '0017',            // Last 4 digits
    'u0017',           // 'u' + Last 4 digits
    '@0017',           // '@' + Last 4 digits
    '1234',
    '123456',
    '12345678',
    '123456789',
    'password',
    'admin',
    'root',
    ''
];

$success = false;

foreach ($users as $user) {
    foreach ($passwords as $pass) {
        try {
            $pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8mb4", $user, $pass);
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            echo "<p style='color: green; font-weight: bold;'>SUCCESS! Username: '$user', Password: '$pass' connected successfully!</p>";
            $success = true;
            break 2;
        } catch (PDOException $e) {
            // Echo connection attempt (optional, hide to avoid clutter)
            // echo "Failed: user='$user', pass='$pass'<br>";
        }
    }
}

if (!$success) {
    echo "<p style='color: red;'>All default student password patterns failed. Please consult your instructor or check your hosting credentials document.</p>";
}
?>
