-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
70 lines (52 loc) · 1.88 KB
/
index.php
File metadata and controls
70 lines (52 loc) · 1.88 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
include('inc/settings.php');
if(isset($_POST["login"]) and isset($_POST["pass"])){
$login = htmlspecialchars($_POST["login"], ENT_QUOTES);
$pass = md5(md5(htmlspecialchars($_POST["pass"], ENT_QUOTES)).'sQpwE');
$query = $sql->query(
"SELECT * FROM users WHERE login = '$login' AND pass = '$pass' "
);
if($sql->num($query) == 1){
$_SESSION["login"] = $login;
$_SESSION["pass"] = $pass;
}
}
if(isset($_SESSION["login"]) and isset($_SESSION["pass"])){
$login = htmlspecialchars($_SESSION["login"], ENT_QUOTES);
$pass = htmlspecialchars($_SESSION["pass"], ENT_QUOTES);
$query = $sql->query(
"SELECT * FROM users WHERE login = '$login' AND pass = '$pass' "
);
if($sql->num($query) == 1){
$_SESSION["login"] = $login;
$_SESSION["pass"] = $pass;
echo '<meta http-equiv="refresh" content="0; url=mylinks">';
return;
}
}
?>
<!doctype html>
<html>
<head>
<title>Вход</title>
<meta http-equiv = "Content-Type" content = "text-html; charset=utf-8">
<meta name = "viewport" content = "width=device-width, user-scalable=no">
<link href = "/inc/index_form.css" rel = "stylesheet">
</head>
<body>
<form id = "form_auth" action = "auth" method = "POST">
<div class = "form_title">Авторизация</div>
<div class = "form_item">
<label for = "f_login">Логин</label><br>
<input name = "login" id = "f_login" type = "text" placeholder = "Введите логин"><br>
</div>
<div class = "form_item">
<label for = "f_pass">Пароль</label><br>
<input name = "pass" id = "f_pass" type = "password" placeholder = "Введите пароль"><br>
</div>
<button type = "submit">Войти</button>
</form>
</body>
</html>