-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistration.php
More file actions
50 lines (45 loc) · 1.75 KB
/
registration.php
File metadata and controls
50 lines (45 loc) · 1.75 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
<?php
//include_once 'Autentication/Auth.php';
include_once 'DataBase.php';
$login = htmlspecialchars($_POST['login']);
$pwd = htmlspecialchars($_POST['pwd']);
$db = DBWorkerFabric::GetDataBaseWorker();
if ($login != "" && $pwd != "") {
if ($db->findUser($login) > 0) {
echo 'Пользователь с таким именем уже есть.';
} else {
$db->addUser($login, $pwd);
$handeled = true;
header('Refresh: 2; URL=index.php');
echo 'Регистрация завершена успешно';
}
}
?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title>Регистрация</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>
<!--TODO: Оформить.-->
<?php
if ($handeled) {
exit();
}
?>
<form action="registration.php" method="POST">
<div>Логин: <input type="text" name="login" /></div>
<div>Пароль: <input type="PASSWORD" name="pwd" /></div>
<div><input type="submit" value="Зарегистрироваться"/> </div>
</form>
</div>
</body>
</html>