-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.php
57 lines (48 loc) · 2.04 KB
/
registration.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Сокольская Е.К.</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel=”stylesheet” href=”https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css” />
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="cpntainer">
<div class="row">
<div class="col-12">
<h1>Регистрация</h1>
</div>
</div>
<div class="row">
<div class="col-12">
<from method="POST" action="registration.php">
<div class="row form_reg"><input class="form" type="email" name="email" placeholder="Email"></div>
<div class="row form_reg"><input class="form" type="text" name="login" placeholder="Login"></div>
<div class="row form_reg"><input class="form" type="password" name="password" placeholder="Password"></div>
<button type="submit" class="btn_red btn_red" name="submit">Продолжить</button>
</form>
</div>
</div>
</div>
</body>
</html>
<?php
require_once('bd.php');
$link = mysqli_connect('127.0.0.1', 'root', '1', 'first');
if (isset($_COOKIE{'Users'})) {
header("Location: login.php");
}
if (isset($_POST['submit'])) {
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
if (!$email || !$username || !$password) die ('Пожалуйста введите все значения!');
$sql = "INSERT INTO users (email, username, password) VALUES ('$email', '$username', '$password')";
if(!mysqli_query($link, $sql)) {
echo "Не удалось добавить пользователя";
}
}
?>