game/repass.php

222 lines
11 KiB
PHP

<?php
use Core\Config;
use Core\Database;
if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php';
}
$step = 1;
$error = '';
if (isset($_GET['login'])) {
$_POST['relogin'] = $_GET['login'];
}
if (isset($_POST['relogin'])) {
$_POST['relogin'] = htmlspecialchars($_POST['relogin'], null, 'cp1251');
Config::init();
Database::init();
define('IP', UserIp::get());
$u = User::start();
$usr = mysql_fetch_array(
mysql_query(
'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['relogin']) . '"'));
if (isset($usr['id'])) {
if ($usr['admin'] == 0 && $usr['banned'] == 0) {
$step = 2;
if (isset($_POST['redate'])) {
//Òðåòèé øàã
$lst_psw = mysql_fetch_array(
mysql_query(
'SELECT * FROM `repass` WHERE `uid` = "' . $usr['id'] . '" AND `time` > ' . (time(
) - 24 * 60 * 60) . ' AND `type` = "1" LIMIT 1'
)
);
if (isset($lst_psw['id'])) {
$error = 'Âûñûëàòü ïàðîëü ìîæíî íå áîëåå îäíîãî ðàçà â ñóòêè.';
} elseif (
str_replace('0', '', $_POST['redate']) == str_replace('0', '', $usr['bithday']) &&
($_POST['reanswer'] == $usr['q1'] || $usr['q1'] == '')
) {
$error = '<br><br><br>Ïàðîëü îò ïåðñîíàæà &quot;' . $usr['login'] . '&quot; áûë óñïåøíî âûñëàí íà E-mail óêàçàííûé ïðè ðåãèñòðàöèè! <br><br><br>';
$re = mysql_fetch_array(
mysql_query(
'SELECT * FROM `logs_auth` WHERE `uid` = "' . $usr['id'] . '" AND `type` = "0" AND `depass` != "" ORDER BY `id` DESC LIMIT 1'
)
);
if ($u['securetime'] < Config::get('securetime')) {
unset($re);
}
if (!isset($re['id'])) {
$sm = ['a', 'b', 'c', 'd', 'e', 'f', 'x', 'd', 'f', 'X', 'e', 'ER', 'XX', 'X'];
$re['depass'] = $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(
0, 12
)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9);
}
$title = 'Âîññòàíîâëåíèå ïàðîëÿ îò "' . $usr['login'] . '".';
$txt = 'Äîáðûé äåíü.<br>';
$txt .= 'Ñ IP-àäðåñà - <b>' . IP . '</b>, áûë çàïðîøåí ïàðîëü äëÿ âàøåãî ïåðñîíàæà.<br>Åñëè ýòî íå Âû, ïðîñòî óäàëèòå ýòî ïèñüìî.<br><br>';
$txt .= 'Âàø ëîãèí: <b>' . $usr['login'] . '</b><br>';
$txt .= 'Âàø ïàðîëü: ' . $re['depass'] . '<br><br>';
$txt .= 'Îòâå÷àòü íà äàííîå ïèñüìî íå íóæíî.<br><br>';
$txt .= 'Ñ óâàæåíèåì,<br>';
$txt .= 'Àäìèíèñòðàöèÿ Áîéöîâñêîãî Êëóáà';
//$mail = mails($usr['mail'], $txt, $title);
$mail = Core\Mail::send($usr['mail'], $txt, $title);
if ($mail === 1) {
mysql_query(
'UPDATE `users` SET `securetime` = "' . time() . '" , `allLock`="' . (time(
) + 60 * 60 * 24 * 0) . '",`pass` = "' . mysql_real_escape_string(
md5($re['depass'])
) . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
mysql_query(
'INSERT INTO `repass` (`uid`,`ip`,`type`,`time`) VALUES ("' . $usr['id'] . '","' . mysql_real_escape_string(
IP
) . '","1","' . time() . '")'
);
$step = 3;
} else {
$error = $mail;
}
unset($mail);
} else {
$error = 'Íåâåðíûé îòâåò íà ñåêðåòíûé âîïðîñ èëè íåâåðíî óêàçàí äåíü ðîæäåíèÿ.';
}
}
} else {
$error = 'Ïåðñîíàæó "' . $_POST['relogin'] . '" çàïðåùåíà âûñûëêà ïàðîëÿ!';
}
} else {
$error = 'Ëîãèí "' . htmlspecialchars($_POST['relogin'], null, 'cp1251') . '" íå íàéäåí â áàçå.';
}
}
?>
<!DOCTYPE html>
<html lang="ru-RU">
<head>
<meta charset="windows-1251"/>
<title>Âîññòàíîâëåíèå ïàðîëÿ îò ïåðñîíàæà Áîéöîâñêèé Êëóá</title>
<meta name="keywords"
content="áîéöîâñêèé êëóá èãðà, áîéöîâñêèé êëóá èãðàòü, èãðà áîéöîâñêèé êëóá, ñòàðûé áîéöîâñêèé Êëóá, áîéöîâñêèé êëóá îíëàéí èãðà, áîéöîâñêèé êëóá áðàóçåðíàÿ èãðà, èãðàòü â áîéöîâñêèé êëóá, èãðà áê, áê èãðà, ñòàðûé áê, èãðàòü â áê, áê îíëàéí èãðà, íîâûé áê, Ëåãåíäàðíûé Áîéöîâñêèé Êëóá, ëåãåíäàðíûé áê, combats, êîìáàòñ, combats ru, combats com, OldBK, oldbk ru, oldbk com, îëäáê, old bk, îëä áê, mycombats, rebk, recombats, oldcombats, obk2">
<meta name="description"
content="Íà ýòîé ñòðàíè÷êå èãðîêè ìîãóò âîññòàíîâèòü ñâîé èãðîâîé ïàðîëü â áðàóçåðíîé èãðå Íîâûé Áîéöîâñêèé Êëóá"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link href="homepage/index.css" type="text/css" rel="stylesheet">
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="100" align="center" valign="middle">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" align="center" valign="middle">&nbsp;</td>
<td align="center" valign="middle"><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td width="200">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" valign="middle">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="135" align="left" valign="middle"
background="https://top.new-combats.com/images/sitebk_02.jpg"
style="background-repeat:repeat-x">&nbsp;
</td>
<td width="135" align="right" valign="middle"
background="https://top.new-combats.com/images/sitebk_02.jpg"
style="background-repeat:repeat-x">&nbsp;
</td>
</tr>
<tr>
</td>
<td height="150" align="center" valign="middle" class="menu">
<p><b>Çàáûëè ïàðîëü îò ñâîåãî ïåðñîíàæà?</b></p>
<p>&nbsp;<?
if ($error != '') {
echo '<font color="red"><b>' . $error . '</b></font>';
}
?></p>
<form method="post" action="https://new-combats.com/repass.php">
<?
if ($step == 1) { ?>
<table width="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Óêàæèòå ëîãèí ïåðñîíàæà:</td>
<td><input onfocus="if ( 'Ëîãèí' == value ) { value = ''; } "
onblur="if ( '' == value ) { value = 'Ëîãèí'; } " value="Ëîãèí"
maxlength="40" style="padding:3px" name="relogin" type="text"
class="inup" id="relogin"></td>
</tr>
</table><br>
<input type="submit" class="btn" value="Ïåðåéòè ê ñëåäóþùåìó øàãó">
<? } elseif ($step == 2) { ?>
<table width="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Ëîãèí ïåðñîíàæà:</td>
<td>
<input value="<?= $_POST['relogin'] ?>" disabled maxlength="40"
style="padding:3px" type="text" class="inup">
<input type="hidden" name="relogin" value="<?= $_POST['relogin'] ?>">
</td>
</tr>
<?
if ($usr['a1'] != '') { ?>
<tr>
<td>Âàø âîïðîñ:</td>
<td>&nbsp;<b><?= $usr['a1'] ?></b></td>
</tr>
<tr>
<td>Âàø îòâåò:</td>
<td><input value="<?= $_POST['reanswer'] ?>" name="reanswer" maxlength="30"
style="padding:3px" type="text" class="inup"></td>
</tr>
<? } ?>
<tr>
<td>Âàø äåíü ðîæäåíèÿ:</td>
<td><input value="<?= $_POST['redate'] ?>" name="redate" maxlength="10"
style="padding:3px" type="text" class="inup"></td>
</tr>
</table>
<small class="testro">(äåíü ðîæäåíèÿ âû óêàçûâàëè ïðè ðåãèñòðàöèè ïåðñîíàæà â ôîðìàòå
dd.mm.yyyy)</small>
<br>
<br>
<br>
<input type="button" onclick="top.location.href='https://new-combats.com/repass.php'"
class="btn" value="Âåðíóòüñÿ">
<input type="submit" class="btn" value="Âûñëàòü ïàðîëü íà E-mail">
<? } ?>
</form>
<br><br><br><br>
</td>
</tr>
</table>
<div align="center" class="menu">
<a href="https://new-combats.com/">Âåðíóòñÿ íà ãëàâíóþ ñòðàíèöó</a>
</div>
</td>
</tr>
<tr>
<td height="50" align="center" valign="middle">&nbsp;</td>
</tr>
<tr>
<td height="50" align="center"><span
class="testro">&laquo;Ñòàðûé Áîéöîâñêèé Êëóá&raquo; &nbsp; &nbsp; 2018-<?= date('Y') ?> &copy; Áðàóçåðíàÿ îíëàéí èãðà</span>
</td>
</tr>
</table>
</body>
</html>