-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthorization_process.php
36 lines (34 loc) · 1.12 KB
/
authorization_process.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php include('./connectionDB.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
$login = $_GET['login'];
$pass = $_GET['password'];
$authorization = mysqli_query($connection, "SELECT * FROM `users` WHERE `login` = '$login' and `pass` = '$pass' ");
$check = mysqli_fetch_all($authorization, MYSQLI_ASSOC);
if (mysqli_num_rows($authorization) == 0) {?>
<script type="text/javascript">
alert("Вы не зарегистрировались либо неправильно ввели пароль, попробуйте еще раз!");
</script>
<?php
echo '<script type="text/javascript">window.location = "index.php";</script>';
} else {
if ($check[0]['access'] == 1) {
$_SESSION['username'] = $login;
echo '<script type="text/javascript">window.location = "index.php";</script>';
exit;
} else {
echo '<script type="text/javascript">
window.location = "blocked.php";
</script>';
}
}
?>
</body>
</html>
<!--Обработчик кнопки 'Log in'
Проверяем логин и пароль пользователя в базе данных-->