dev-php74 #30

Merged
lopar merged 17 commits from dev-php74 into master 2023-01-11 13:30:03 +00:00
2 changed files with 24 additions and 28 deletions
Showing only changes of commit 6794284497 - Show all commits

View File

@ -98,14 +98,13 @@ class UserRegister
public static function new(string $login, string $password, string $email, $ref, $birthday, $sex): string
{
$password = password_hash($password, PASSWORD_DEFAULT);
$ref = (int)$ref;
$ip = UserIp::get();
$sex = (int)$sex - 10; //Íà âõîäå 10\11, à ïåðåäàòü íàäî 0\1.
Db::sql(
'insert into users (users.real,login,host_reg,pass,ip,ipreg,room,timereg,mail,bithday,sex,fnq,molch2,level,hobby,clan_zv) values (1,?,?,?,?,?,9,unix_timestamp(),?,?,?,0,unix_timestamp() + 86400,8,\'\',0)',
[
$login,
$ref,
$ref ?? '',
$password,
$ip,
$ip,

View File

@ -313,7 +313,7 @@ if (!isset ($_POST['nick_u'])) {
<?php
} ?>
<?php
if (empty($_POST['email_u']) && !empty($_POST['nick_u']) && errorCheck(1, $_POST['nick_u']) == "") {
if (empty($_POST['email_u']) && !empty($_POST['nick_u']) && empty(errorCheck(1, $_POST['nick_u']))) {
?>
<div class="visible_class">
<h3>Ââåäèòå âàø äåéñòâóþùèé è íàñòîÿùèé "Email" àäðåñ </h3>
@ -321,7 +321,7 @@ if (empty($_POST['email_u']) && !empty($_POST['nick_u']) && errorCheck(1, $_POST
<h3>Âíèìàíèå! Ïðîâåðüòå ïàïêó "ÑÏÀÌ", èíîãäà, ïèñüìî ñ êîäîì ïîäòâåðæäåíèÿ ìîæåò ïîïàñòü òóäà.</h3>
</div>
<?php
} elseif (isset ($_POST['email_u']) && errorCheck(2, $_POST['email_u']) != "") {
} elseif (!empty($_POST['email_u']) && !empty(errorCheck(2, $_POST['email_u']))) {
?>
<div class="visible_class">
<h3>Ââåäèòå âàø äåéñòâóþùèé è íàñòîÿùèé "Email" àäðåñ </h3>
@ -340,8 +340,8 @@ if (empty($_POST['email_u']) && !empty($_POST['nick_u']) && errorCheck(1, $_POST
if (
empty($_POST['secure_code']) &&
!empty($_POST['email_u']) &&
errorCheck(2, $_POST['email_u']) == "" &&
errorCheck(3, $_POST['email_u'], $_POST['nick_u']) == ""
empty(errorCheck(2, $_POST['email_u'])) &&
empty(errorCheck(3, $_POST['email_u'], $_POST['nick_u']))
) {
?>
<div class="visible_class">
@ -351,7 +351,7 @@ if (
<input type="text" name="secure_code" placeholder="Ïðîâåðî÷íûé Êîä"/>
</div>
<?php
} elseif (isset ($_POST['secure_code']) && errorCheck(4, $_POST['secure_code'], $_POST['email_u']) != "") {
} elseif (!empty($_POST['secure_code']) && !empty(errorCheck(4, $_POST['secure_code'], $_POST['email_u']))) {
?>
<div class="visible_class">
<h3>Íà email: <?php
@ -373,7 +373,7 @@ if (
if (
(empty($_POST['pass1_u']) || empty($_POST['pass2_u'])) &&
!empty($_POST['secure_code']) &&
errorCheck(4, $_POST['secure_code'], $_POST['email_u']) == ""
empty(errorCheck(4, $_POST['secure_code'], $_POST['email_u']))
) {
?>
<div class="visible_class">
@ -412,7 +412,8 @@ if (
if (
empty($_POST['pol_u']) &&
!empty($_POST['pass1_u']) &&
!empty($_POST['pass2_u']) && errorCheck(5, $_POST['pass1_u'], $_POST['pass2_u']) == ""
!empty($_POST['pass2_u']) &&
empty(errorCheck(5, $_POST['pass1_u'], $_POST['pass2_u']))
) {
?>
<div class="visible_class">
@ -508,11 +509,11 @@ if (
!empty($_POST['pol_u']) &&
!empty($_POST['bday_u']) &&
!empty($_POST['class_u']) &&
errorCheck(4, $_POST['secure_code'], $_POST['email_u']) == ""
empty(errorCheck(4, $_POST['secure_code'], $_POST['email_u']))
) {
session_start();
$u = User::start();
//Ñîçäàåì ïåðñîíàæà
if ($_POST['ref'] > 0) {
$_POST['ref'] = Db::getValue('select count(*) from users where id = ?', [$_POST['ref']]) ?: 0;
@ -520,16 +521,17 @@ if (
$uid = UserRegister::new(
$_POST['nick_u'],
$_POST['ref'],
$_POST['pass1_u'],
$_POST['email_u'],
$_POST['ref'],
$_POST['bday_u'],
$_POST['pol_u']
);
if ($uid > 0) {
setcookie('login', $_POST['nick_u'], (time() + 60 * 60 * 24 * 7), '', '.new-combats.com');
setcookie('registrationModal', 'true', (time() + 60 * 60 * 24 * 7), '', 'new-combats.com');
$u = User::start();
if (isset($_COOKIE['from'])) {
Db::sql(
@ -637,7 +639,7 @@ if (
Db::sql('insert into online (uid, timeStart) values (?,unix_timestamp())', [$uid]);
//ìóëüòû
$ppl = Db::getRow(
$ppl = Db::getRows(
'select * from logs_auth where ip != \'\' and (ip = ? or ip = ? or ip = (select ip from logs_auth where uid = ? and ip != ?))',
[
UserIp::get(), $_COOKIE['ip'], $uid, UserIp::get(),
@ -655,21 +657,16 @@ if (
//Îáíîâÿåì òàáëèöû
Db::sql('update users set ip = ? where id = ?', [UserIp::get(), $uid]);
if (
!setcookie('login', $_POST['nick_u'], (time() + 60 * 60 * 24 * 7), '', '.new-combats.com') ||
!setcookie('pass', md5($_POST['pass1_u']), (time() + 60 * 60 * 24 * 7), '', '.new-combats.com') ||
!setcookie('registrationModal', 'true', (time() + 60 * 60 * 24 * 7), '', 'new-combats.com')
) {
die('Îøèáêà ñîõðàíåíèÿ cookie.');
} else {
Db::sql('insert into users_learning_status (uid) values (?)', [$uid]);
Db::sql('delete from secure_code where email = ?' [$_POST['email_u']]);
die(
'Ñïàñèáî çà ðåãèñòðàöèþ â èãðîâîì ìèðå Áîéöîâñêîãî Êëóáà, æåëàåì âàì ïîáåä è äîëãîé èãðû.
 ñëó÷àå âîïðîñîâ ïî èãðå, Âàì áóäåò äîñòóïåí îáùèé ÷àò!
<br><script>function test(){ top.location.href="https://' . Config::get('host') . '/bk"; } setTimeout("test()",100);</script>'
<br><script>function test(){ top.location.href="https://' . Config::get(
'host'
) . '/bk"; } setTimeout("test()",100);</script>'
);
}
}
} else {
?>