-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
46 lines (38 loc) · 1.3 KB
/
register.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
<?php
include "configs/main.php";
include $siteUrl . '/configs/db.php';
include $siteUrl . '/parts/header.php';
if (isset($_POST["name"]) && isset($_POST["login"]) && isset($_POST["password"])
&& $_POST["name"] != "" && $_POST["login"] != "" && $_POST["password"] != "") {
// вставить в таблицу "users" ()
$sql = "INSERT INTO user (name, phone, password) VALUES ('" . $_POST["name"] . "' , '" . $_POST["login"] ."', '" . $_POST["password"] . "')";
if($conn->query($sql)) {
header("Location: login.php");
} else {
echo "<h2>Error</h2>" . mysqli_error($conn);
}
}
?>
<div class="row">
<form method="POST">
<div class="form-group">
<label>Name</label>
<input class="form-control" type="text" name="name">
<small class="form-text text-muted">Your name</small>
</div>
<div class="form-group">
<label>Login</label>
<input class="form-control" type="text" name="login">
<small class="form-text text-muted">Phone number</small>
</div>
<div class="form-group">
<label>Password</label>
<input class="form-control" type="password" name="password">
<small class="form-text text-muted">Enter password</small>
</div>
<button type="submit" class="btn btn-secondary">Registrate</button>
</form>
</div>
<?php
include $_SERVER['DOCUMENT_ROOT'] . '/parts/footer.php';
?>