You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[]'' at line 1
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style1.css">
<title></title>
</head>
<body>
<div class="container">
<form method="post" class="form-signin">
<h2>LOGIN</h2>
<input type="text" name="username" value="" placeholder="username" class="form-controll" required>
<input type="text" name="password" value="" placeholder="Password" class="form-controll" required>
<button class="btn-lg btn-primary btn-block"type="submit">login</button>
<a href="index.php" class="btn btn-large btn-primary btn-block">Register</a>
</form>
</div>
<?php
session_start();
require('connect.php');
if (isset($_POST['username']) and isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username='$username' and password='$password'";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$count = mysqli_num_rows($result);
if ($count == 1) {
$_SESSION['username'] = $username;
} else {
$fmsg = "Ощибка";
}
}
if (isset($_SESSION['username'])) {
$username = $_SESSION['username'];
echo "Hello" . $username . "";
echo "<a href='logout.php' class='btn btn-large btn-primary btn-block'>logout</a> ";
}
?>
</body>
</html>
<?php
session_start();
session_destroy();
header( 'Location index.php');
exit;
?>