<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'htqvuwzi_P_shapajita';

$dsn = "mysql:host=$host;dbname=$db;charset=utf8";

try {
    $pdo = new PDO($dsn, $user, $pass);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $sql = "CREATE TABLE IF NOT EXISTS login_attempts (
        id INT(11) NOT NULL AUTO_INCREMENT,
        ip_address VARCHAR(45) NOT NULL,
        login VARCHAR(100) NOT NULL,
        time INT(11) UNSIGNED DEFAULT NULL,
        PRIMARY KEY (id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";

    $pdo->exec($sql);
    echo "Table login_attempts created or already exists.";

} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}
?>
