This repository has been archived by the owner on Dec 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
45 lines (45 loc) · 1.69 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
<?php
require_once "connection.php";
if($auth != 0) {
exit("<script>location.href='/'</script>");
}
?>
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script>
function reg() {
$("#msg").html("Загрузка...");
var nick = $("#nick").val();
var pass = $("#pass").val();
var email = $("#email").val();
var rl = $("#rl").val();
$.ajax({
type: "POST",
url: "scripts/register.php",
data: { nick:nick, pass:pass, rl:rl, email:email }
}).done(function(result) {
if(result == 1) {
$("#msg").html("Заполните поля");
} else if(result == 2) {
$("#msg").html("Почта неправильная");
} else if(result == 3) {
$("#msg").html("Ник занят");
$("#nick").val("");
} else if(result == 5) {
$("#msg").html("На вашу почту отправленно письмо с подтверждением аккаунта");
$("#nick").val("");
$("#pass").val("");
$("#email").val("");
} else if(result == -1) {
$("#msg").html("Ошибка сервера");
}
});
}
</script>
<body>
<p id="msg"></p>
<input id="nick" type="text" placeholder="Ник"/><br />
<input id="pass" type="password" placeholder="Пароль"/><br />
<input id="email" type="text" placeholder="Почта"/><br />
<input id="rl" type="text" placeholder="Реальное имя"/><br />
<button onclick="reg()">Регистрация</button>
</body>