<?php
// Database Connection



$host = "localhost";
$dbname = "xxdawscj_wealthb";
$username = "xxdawscj_wealthb";  // Change if using a different MySQL user
$password = "xxdawscj_wealthb";  // Set password if required

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    
    echo "Connected to the database successfully!<br>";

    // Set Admin Credentials
    $admin_username = "admin2";  // Change this to your preferred username
    $admin_password = "leboscotuya"; // Change this to your desired password
    $ip = "0"; 

    // Hash the Password
    $hashed_password = password_hash($admin_password, PASSWORD_DEFAULT);

    // Insert into the Admin Table
    $sql = "INSERT INTO logins (username, password, ip) VALUES (:username, :password, :ip)";
    $stmt = $pdo->prepare($sql);
    $stmt->execute([
        'username' => $admin_username,
        'password' => $hashed_password,
        'ip' => $ip
    ]);

    echo "Admin user created successfully!<br>";
    echo "Username: " . $admin_username . "<br>";
    echo "Use your original password to log in.";
} catch (PDOException $e) {
    die("Database Error: " . $e->getMessage());
}
?>
