game/repass.php
2022-06-07 00:30:34 +03:00

267 lines
11 KiB
PHP

<?
$step = 1;
$error = '';
if(isset($_GET['login'])) {
$_POST['relogin'] = $_GET['login'];
}
//die('Âîññòàíîâëåíèå ïàðîëÿ íåäîñòóïíî. Ñîçäàéòå íîâîãî ïåðñîíàæà è íàïèøèòå ëþáîìó ìîäåðàòîðó.');
function GetRealIp()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
define('IP',GetRealIp());
function send_mime_mail($name_from, // èìÿ îòïðàâèòåëÿ
$email_from, // email îòïðàâèòåëÿ
$name_to, // èìÿ ïîëó÷àòåëÿ
$email_to, // email ïîëó÷àòåëÿ
$data_charset, // êîäèðîâêà ïåðåäàííûõ äàííûõ
$send_charset, // êîäèðîâêà ïèñüìà
$subject, // òåìà ïèñüìà
$body // òåêñò ïèñüìà
)
{
$to = mime_header_encode($name_to, $data_charset, $send_charset)
. ' <' . $email_to . '>';
$subject = mime_header_encode($subject, $data_charset, $send_charset);
$from = mime_header_encode($name_from, $data_charset, $send_charset)
.' <' . $email_from . '>';
if($data_charset != $send_charset) {
$body = iconv($data_charset, $send_charset, $body);
}
/*$headers = "From: $from\r\n";
$headers .= "Content-type: text/html; charset=$send_charset\r\n";*/
$headers = array ('From' => $email_from, 'Content-type' => 'text/html; charset='.$send_charset.'\r\n', 'To' => $to, 'Subject' => $subject, 'Reply-To' => $email_from);
set_include_path("." . PATH_SEPARATOR . ($UserDir = dirname($_SERVER['DOCUMENT_ROOT'])) . "/pear/php" . PATH_SEPARATOR . get_include_path());
require_once "Mail.php";
$smtp = Mail::factory('smtp', array(
'host' => 'smtp.gmail.com',
'port' => '587',
'auth' => true,
'username' => 'newcombats22@gmail.com', //your gmail account
'password' => 'newcombats1974' // your password
));
$mail = $smtp->send($to, $headers, $body);
/*
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>"); die;
} else {
echo("<p>Message successfully sent!</p>"); die;
}*/
return $mail;
}
function mime_header_encode($str, $data_charset, $send_charset) {
if($data_charset != $send_charset) {
$str = iconv($data_charset, $send_charset, $str);
}
return '=?' . $send_charset . '?B?' . base64_encode($str) . '?=';
}
function send_mail($to,$to_name,$from = 'admnew-combats@gmail.com',$name = '<b>Áîéöîâñêèé Êëóá</b> 2',$title,$text) {
send_mime_mail($name,
$from,
$to_name,
$to,
'CP1251', // êîäèðîâêà, â êîòîðîé íàõîäÿòñÿ ïåðåäàâàåìûå ñòðîêè
'KOI8-R', // êîäèðîâêà, â êîòîðîé áóäåò îòïðàâëåíî ïèñüìî
$title,
$text); // \r\n
}
if(isset($_POST['relogin'])) {
$_POST['relogin'] = htmlspecialchars($_POST['relogin'],NULL,'cp1251');
include('_incl_data/__config.php');
define('GAME',true);
include('_incl_data/class/__db_connect.php');
$usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['relogin']).'" LIMIT 1'));
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'] < $c['securetime'] ) {
unset($re);
}
if(!isset($re['id'])) {
$sm = array('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);
//$error = 'Ðàññûëêà âðåìåííî íå ðàáîòàåò.<br>Ïàðîëü îò ïåðñîíàæà: </b>'.$re['depass'].'<b>';
}else{
//$error = 'Ðàññûëêà âðåìåííî íå ðàáîòàåò.<br>Ïàðîëü îò ïåðñîíàæà: </b>'.$re['depass'].'<b>';
}
$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 .= 'Àäìèíèñòðàöèÿ Áîéöîâñêîãî Êëóáà';
//if(send_mail($urs['mail'],$urs['login'],'admnew-combats@gmail.com','ÁÊ2 - Support',$title,$txt)) {
if(send_mime_mail('Áîéöîâñêèé Êëóá - Support',
'admnew-combats@gmail.com',
''.$usr['login'].'',
$usr['mail'],
'CP1251', // êîäèðîâêà, â êîòîðîé íàõîäÿòñÿ ïåðåäàâàåìûå ñòðîêè
'KOI8-R', // êîäèðîâêà, â êîòîðîé áóäåò îòïðàâëåíî ïèñüìî
$title,
$txt))
{
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 = 'Íå óäàëîñü îòïðàâèòü ñîîáùåíèå. Ïîïðîáóéòå ïîçæå.';
}
}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>
<!--LiveInternet counter-->
<!--/LiveInternet-->
</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>