This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
reg.php
192 lines (158 loc) · 9.8 KB
/
reg.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
include('methods/DB.php');
include('UserInformation.php');
function isLoggedIn() {
if (isset($_COOKIE['SNID'])) {
if (DB::query('SELECT user_id FROM login_tokens WHERE token=:token', array(':token'=>sha1($_COOKIE['SNID'])))) {
$userid = DB::query('SELECT user_id FROM login_tokens WHERE token=:token', array(':token'=>sha1($_COOKIE['SNID'])))[0]['user_id'];
if (isset($_COOKIE['SNID_'])) {
return $userid;
} else {
$cstrong = True;
$token = bin2hex(openssl_random_pseudo_bytes(64, $cstrong));
DB::query('INSERT INTO login_tokens VALUES (\'\', :token, :user_id)', array(':token'=>sha1($token), ':user_id'=>$userid));
DB::query('DELETE FROM login_tokens WHERE token=:token', array(':token'=>sha1($_COOKIE['SNID'])));
setcookie("SNID", $token, time() + 60 * 60 * 24 * 7, '/', NULL, NULL, TRUE);
setcookie("SNID_", '1', time() + 60 * 60 * 24 * 3, '/', NULL, NULL, TRUE);
return $userid;
}
}
}
return false;
}
if (isLoggedIn()) {
header("Location: http://{$_SERVER['SERVER_NAME']}/apps/");
}
if (isset($_POST['createaccount'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$ip = UserInfo::get_ip();
$versionos = UserInfo::get_os();
$browser = UserInfo::get_browser();
if (!DB::query('SELECT username FROM users WHERE username=:username', array(':username'=>$username))) {
if (strlen($username) >= 3 && strlen($username) <= 32) {
if (preg_match('/[a-zA-Z0-9_]+/', $username)) {
if (strlen($password) >= 6 && strlen($password) <= 60) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!DB::query('SELECT email FROM users WHERE email=:email', array(':email'=>$email))) {
DB::query('INSERT INTO users VALUES (\'\', :username, :password, :email, :ip, :browser, :version_os)', array(':username'=>$username, ':password'=>password_hash($password, PASSWORD_BCRYPT), ':email'=>$email, ':ip'=>$ip, ':browser'=>$browser, ':version_os'=>$versionos));
echo "<br><br><center><h3>Успешная регистрация, можете входить в аккаунт!</h3>></center>";
} else {
echo '<br><br><center><h3>Почта уже используется!</h3></center>';
}
} else {
echo '<br><br><center><h3>Неверный тип почты!</h3></center>';
}
} else {
echo '<br><br><center><h3>Пароль должен быть длинее 6 символов, не больше 60!</h3></center>';
}
} else {
echo '<br><br><center><h3>Никнейм должен быть от 3 символов, до 32!</h3></center>';
}
} else {
echo '<br><br><center><h3>В никнейме содержатся кракозябры!</h3></center>';
}
} else {
echo '<br><br><center><h3>Пользователь уже существует!</h3></center>';
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Catbin | Авторизация</title>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://webuildthemes.com/guidebook/assets/css/vendor.css">
<link rel="stylesheet" href="https://webuildthemes.com/guidebook/assets/css/style.css">
<link rel="stylesheet" href="/assets/fonts/stylesheet.css">
<link rel="stylesheet" href="/assets/scripts/css/login.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/uikit.min.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/uikit.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/uikit-icons.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/bootstrap-material-design.min.css" integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX" crossorigin="anonymous">
<script src="https://unpkg.com/[email protected]/dist/umd/popper.js" integrity="sha384-fA23ZRQ3G/J53mElWqVJEGJzU0sTs+SvzG8fXVWP+kJQ1lwFAOkcUOysnlKJC33U" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/js/bootstrap-material-design.js" integrity="sha384-CauSuKpEqAFajSpkdjv3z9t8E7RlpJ1UP0lKM/+NdtSarroVKu069AlsRPKkFBz9" crossorigin="anonymous"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-174561723-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLaye r.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-174561723-1');
</script>
<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(66291088, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/66291088" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<style>
body { background-color: #222226; font-family: Google Sans; }
@font-face {
font-family: 'Google Sans';
src: url('/assets/fonts/GoogleSans-Medium.eot');
src: local('Google Sans Medium'), local('GoogleSans-Medium'),
url('/assets/fonts/GoogleSans-Medium.eot?#iefix') format('embedded-opentype'),
url('/assets/fonts/GoogleSans-Medium.woff2') format('woff2'),
url('/assets/fonts/GoogleSans-Medium.woff') format('woff'),
url('/assets/fonts/GoogleSans-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
.background-accordion {
background-color: aliceblue;
}
.uk-accordion {
background-color: aliceblue;
}
.catbin-descp {
margin: 64px;
}
a, li, h1, h2, h3, h4, h5, h6, p, label {
color: aliceblue;
}
</style>
<meta charset="UTF-8">
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
</head>
<body oncontextmenu="return false" data-spy="scroll" data-target="#toc">
<script src="https://sindresorhus.com/devtools-detect/index.js"></script>
<script>
document.currentScript.parentElement.volume = 0.50;
if(window.devtools.isOpen) { window.location.href = "/antipiracy"; }
window.addEventListener('devtoolschange', event => { window.location.href = "/antipiracy"; });
</script>
<div class="l-form">
<form action="reg" class="form" method="POST">
<center><h5 class="form__title">Зарегистрируйтесь в Catbin</h5></center>
<br><div class="form__div">
<input type="nickname" class="form__input" placeholder=" " name="username" id="username">
<label for="" class="form__label">Логин</label>
</div>
<div class="form__div">
<input type="email" class="form__input" placeholder=" " name="email" id="email">
<label for="" class="form__label">Электронная почта</label>
</div>
<div class="form__div">
<input type="password" class="form__input" placeholder=" " name="password" id="password">
<label for="" class="form__label">Пароль</label>
</div>
<input type="submit" class="form__button" value="Зарегистрироваться" name="createaccount">
<br><br><br><center><a href="/login.php">У вас уже есть аккаунт?</a></center>
</form>
</div>
</body>
</html>