Update main page

This commit is contained in:
lopar 2018-03-02 17:31:43 +02:00
parent 031879acad
commit 85aa7f2492
3 changed files with 59 additions and 209 deletions

248
main.php
View File

@ -49,7 +49,7 @@ if (!isset($_SESSION['stackall'])) {
$_SESSION['stackall'] = true; $_SESSION['stackall'] = true;
} }
if (@$_GET['stackall']) { if ($_GET['stackall']) {
$_SESSION['stackall'] = ($_SESSION['stackall'] ? false : true); $_SESSION['stackall'] = ($_SESSION['stackall'] ? false : true);
/* /*
$rec = mysql_query("SELECT `id` FROM `inventory` WHERE `owner` = '$user[id]' AND `setsale` = 0 AND `koll` >= 1 ORDER BY `id` DESC"); $rec = mysql_query("SELECT `id` FROM `inventory` WHERE `owner` = '$user[id]' AND `setsale` = 0 AND `koll` >= 1 ORDER BY `id` DESC");
@ -78,7 +78,7 @@ if ($_GET['unstack']) {
if (isset($_GET['obraz']) && $_GET['obraz'] !== null && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif' || $shadow['mshadow'] || $shadow['wshadow'])) { if (isset($_GET['obraz']) && $_GET['obraz'] !== null && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif' || $shadow['mshadow'] || $shadow['wshadow'])) {
if ($user['sex']) { if ($user['sex']) {
switch (@$_GET['obraz']) { switch ($_GET['obraz']) {
case 0: case 0:
mysql_query("UPDATE `users` SET `shadow` = 'man0.gif' WHERE `id` = '{$user['id']}' LIMIT 1"); mysql_query("UPDATE `users` SET `shadow` = 'man0.gif' WHERE `id` = '{$user['id']}' LIMIT 1");
break; break;
@ -129,7 +129,7 @@ if (isset($_GET['obraz']) && $_GET['obraz'] !== null && ($user['shadow'] == 'g0.
break; break;
} }
} else { } else {
switch (@$_GET['obraz']) { switch ($_GET['obraz']) {
case 0: case 0:
mysql_query("UPDATE `users` SET `shadow` = 'g0.gif' WHERE `id` = '{$user['id']}' LIMIT 1"); mysql_query("UPDATE `users` SET `shadow` = 'g0.gif' WHERE `id` = '{$user['id']}' LIMIT 1");
break; break;
@ -252,14 +252,18 @@ if (isset($eff['id']) && $_GET['got']) {
$_GET['got'] = 0; $_GET['got'] = 0;
} }
$array = array( $array = [
1 => array(), 2 => array(), 3 => array(), 4 => array(), 1 => [], 2 => [], 3 => [], 4 => [],
5 => array('min_level' => 1, 'max_level' => 3), 6 => array('min_level' => 1, 'max_level' => 3), 7 => array('min_level' => 1, 'max_level' => 3), 8 => array('min_level' => 4, 'max_level' => 21), 5 => ['min_level' => 1, 'max_level' => 3], 6 => ['min_level' => 1, 'max_level' => 3],
9 => array('min_level' => 4, 'max_level' => 6), 10 => array('min_level' => 7, 'max_level' => 9), 11 => array('min_level' => 10, 'max_level' => 12), 12 => array('min_level' => 13, 'max_level' => 15), 7 => ['min_level' => 1, 'max_level' => 3], 8 => ['min_level' => 4, 'max_level' => 21],
13 => array('min_level' => 16, 'max_level' => 19), 14 => array('min_level' => 19, 'max_level' => 21), 15 => array('paladin' => 1), 16 => array('paladin' => 1), 9 => ['min_level' => 4, 'max_level' => 6], 10 => ['min_level' => 7, 'max_level' => 9],
17 => array('align' => 3), 36 => array('align' => 2), 54 => array('align' => 6), 19 => array('sex' => 2), 11 => ['min_level' => 10, 'max_level' => 12], 12 => ['min_level' => 13, 'max_level' => 15],
18 => array('align' => 3), 56 => array('align' => 2), 55 => array('align' => 6) 13 => ['min_level' => 16, 'max_level' => 19], 14 => ['min_level' => 19, 'max_level' => 21],
); 15 => ['paladin' => 1], 16 => ['paladin' => 1],
17 => ['align' => 3], 18 => ['align' => 3], 19 => ['sex' => 2],
36 => ['align' => 2],
54 => ['align' => 6], 55 => ['align' => 6], 56 => ['align' => 2]
];
function gone_rooms($room) function gone_rooms($room)
{ {
@ -300,12 +304,6 @@ function gone_rooms($room)
$error = 1; $error = 1;
} }
} }
if (isset($param['sex'])) {
if (($param['sex'] == 2 && $user['sex'] == 1) || ($param['sex'] == 1 && $user['sex'] == 0)) {
err("<b>Вы не можете попасть в эту комнату. Пол не подходит...</b>");
$error = 1;
}
}
if ($error == 0 OR $user['admin'] == 1) { if ($error == 0 OR $user['admin'] == 1) {
mysql_query("UPDATE `users`, `online` SET `users`.`room` = '$room', `online`.`room` = '$room' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$user['id']}'"); mysql_query("UPDATE `users`, `online` SET `users`.`room` = '$room', `online`.`room` = '$room' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$user['id']}'");
header('Location: main.php'); header('Location: main.php');
@ -316,122 +314,27 @@ if (isset($_GET['got']) && $_GET['got']) {
gone_rooms($_GET['room']); gone_rooms($_GET['room']);
} }
if (@$_REQUEST['changepsw']) { ?> if ($_REQUEST['transreport']) {
<HTML>
<HEAD>
<script LANGUAGE='JavaScript'>
document.ondragstart = test;
//запрет на перетаскивание
document.onselectstart = test;
//запрет на выделение элементов страницы
document.oncontextmenu = test;
//запрет на выведение контекстного меню
function test() {
return false
}
</SCRIPT>
<link rel=stylesheet type="text/css" href="css/main.css">
<link rel="stylesheet" href="css/newstyle18.css" type="text/css">
<link rel="stylesheet" href="/i/btn.css" type="text/css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0>
</HEAD>
<body bgcolor=e2e0e0>
<FORM ACTION="main.php" METHOD=POST>
<table width=100%>
<tr>
<td><h3>Безопасность</h3></td>
<td align=right><INPUT TYPE=button value="Вернуться"
onClick="location.href='main.php?edit=0.467837356797105';"></td>
</tr>
</table>
<fieldset>
<legend><b>Сменить пароль</b></legend>
<?php
if ($_POST['oldpass'] && $_POST['npass'] && $_POST['npass2']) {
$ops = mysql_fetch_array(mysql_query("SELECT `pass` FROM `users` WHERE `id` = '{$user['id']}' LIMIT 1"));
if ($ops[0] == md5($_POST['oldpass'])) {
if ($_POST['npass'] == $_POST['npass2']) {
if (mysql_query("UPDATE `users` SET `pass` = '" . md5($_POST['npass']) . "' WHERE `id` = '{$user['id']}' LIMIT 1")) {
echo "<font color=red><b>Пароль удачно сменен.</b></font>";
}
} else {
echo "<font color=red><b>Не совпадают новые пароли.</b></font>";
}
} else {
echo "<font color=red><b>Неверный старый пароль.</b></font>";
}
}
?>
<table>
<tr>
<td align=right>Старый пароль:</td>
<td><input type=password name="oldpass"></td>
</tr>
<tr>
<td align=right>Новый пароль:</td>
<td><input type=password name="npass"></td>
</tr>
<tr>
<td align=right>Новый пароль (еще раз):</td>
<td><input type=password name="npass2"></td>
</tr>
<tr>
<td align=right><input type=submit value="Сменить пароль" name="changepsw"></td>
<td></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
<?php die();
}
if (@$_REQUEST['transreport']) {
?> ?>
<HTML> <HTML>
<HEAD> <HEAD>
<script LANGUAGE='JavaScript'> <link rel=stylesheet href="css/main.css">
document.ondragstart = test; <meta charset="utf-8">
//запрет на перетаскивание
document.onselectstart = test;
//запрет на выделение элементов страницы
document.oncontextmenu = test;
//запрет на выведение контекстного меню
function test() {
return false
}
</SCRIPT>
<link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0>
</HEAD> </HEAD>
<body bgcolor=e2e0e0> <body>
<FORM ACTION="main.php" METHOD=POST> <FORM ACTION="main.php" METHOD=POST>
<P align=right><INPUT TYPE=button value="Подсказка (?)" style="background-color:#A9AFC0" <P align=right><INPUT TYPE=submit value="Вернуться" name=edit></P>
onClick="window.open('help/schet.html', 'help', 'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')">
<INPUT TYPE=submit value="Вернуться" name=edit></P>
<H3>Отчет о переводах</H3> <H3>Отчет о переводах</H3>
Вы можете получить отчет о переводах кредитов/вещей от вас/к вам за указанный день. Услуга платная, стоит <B>5 кр.</B><BR>
Вы можете получить отчет о переводах кредитов/вещей от вас/к вам за указанный день. Услуга платная, стоит <B>0.5
кр.</B><BR>
У вас на счету: <B><?= $user['money'] ?></B> кр.<BR> У вас на счету: <B><?= $user['money'] ?></B> кр.<BR>
Укажите дату, на которую хотите получить отчет: <INPUT TYPE=text NAME=date value="<?= date("d.m.y") ?>"> <INPUT Укажите дату, на которую хотите получить отчет:
TYPE=submit name=transreport value="Заказать отчет"> <INPUT TYPE=text NAME=date value="<?= date("d.m.y") ?>">
<INPUT TYPE=submit name=transreport value="Заказать отчет">
</FORM> </FORM>
<BR><BR> <BR><BR>
<?php <?php
if ($_POST['date'] && ($user['money'] >= 0.5)) { if ($_POST['date'] && ($user['money'] >= 5)) {
$user['money'] -= 0.5; $user['money'] -= 5;
mysql_query("UPDATE `users` SET `money` = '" . $user['money'] . "' WHERE `id` = {$user['id']} LIMIT 1"); mysql_query("UPDATE `users` SET `money` = '" . $user['money'] . "' WHERE `id` = {$user['id']} LIMIT 1");
echo "Выписка о переводах на персонажа \"{$user['login']}\" за " . $_POST['date'] . ":<BR>"; echo "Выписка о переводах на персонажа \"{$user['login']}\" за " . $_POST['date'] . ":<BR>";
$data = mysql_query("SELECT * FROM `delo` WHERE `pers` = '{$user['id']}' AND `type` = 1 AND `date` > '" . mktime(0, 0, 0, substr($_POST['date'], 3, 2), substr($_POST['date'], 0, 2), substr($_POST['date'], 6, 2)) . "' AND `date` < '" . mktime(23, 59, 59, substr($_POST['date'], 3, 2), substr($_POST['date'], 0, 2), substr($_POST['date'], 6, 2)) . "' ;"); $data = mysql_query("SELECT * FROM `delo` WHERE `pers` = '{$user['id']}' AND `type` = 1 AND `date` > '" . mktime(0, 0, 0, substr($_POST['date'], 3, 2), substr($_POST['date'], 0, 2), substr($_POST['date'], 6, 2)) . "' AND `date` < '" . mktime(23, 59, 59, substr($_POST['date'], 3, 2), substr($_POST['date'], 0, 2), substr($_POST['date'], 6, 2)) . "' ;");
@ -450,25 +353,23 @@ if (@$_REQUEST['transreport']) {
die(); die();
} }
if ($_POST['setshadow']) {
if (@$_POST['setshadow']) {
?> ?>
<HTML> <HTML>
<HEAD> <HEAD>
<link rel=stylesheet type="text/css" href="css/main.css"> <link rel=stylesheet href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type> <meta charset="utf-8">
</HEAD> </HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#e2e0e0> <body>
<table width=100%> <table width=100%>
<tr> <tr>
<td><h3>Выбрать образ персонажа "<?= $user['login'] ?>"</h3></td> <td><h3>Выбрать образ персонажа</h3></td>
<td align=right><INPUT TYPE=button value="Вернуться" <td align=right><INPUT TYPE=button value="Вернуться"
onClick="location.href='main.php?edit=0.467837356797105';"></td> onClick="location.href='main.php?edit=0.467837356797105';"></td>
</tr> </tr>
<tr> <tr>
<td align=center style="color:red;">Внимание! Образ персонажа выбирается только один раз.</td> <td align=center style="color:red;">Внимание! Образ персонажа выбирается только один раз.</td>
</tr> </tr>
</table> </table>
<center> <center>
<TABLE cellpadding="0" cellspacing="1" style="padding:5px;"> <TABLE cellpadding="0" cellspacing="1" style="padding:5px;">
@ -549,10 +450,6 @@ if (@$_POST['setshadow']) {
</tr> </tr>
<tr> <tr>
<td><a href="?edit=1&obraz=41"><img src="i/shadow/<?= $shadow['wshadow'] ?>"></a></td> <td><a href="?edit=1&obraz=41"><img src="i/shadow/<?= $shadow['wshadow'] ?>"></a></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
<? <?
} }
@ -565,36 +462,20 @@ if (@$_POST['setshadow']) {
die(); die();
} }
// //
if (@$_POST['setshadowclan']) { if ($_POST['setshadowclan']) {
?> ?>
<HTML> <HTML>
<HEAD> <HEAD>
<script LANGUAGE='JavaScript'> <link rel=stylesheet href="css/main.css">
document.ondragstart = test; <meta charset="utf-8">
//запрет на перетаскивание
document.onselectstart = test;
//запрет на выделение элементов страницы
document.oncontextmenu = test;
//запрет на выведение контекстного меню
function test() {
return false
}
</SCRIPT>
<link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
</HEAD> </HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#e2e0e0> <body>
<table width=100%> <table width=100%>
<tr> <tr>
<td><h3>Выбрать образ персонажа "<?= $user['login'] ?>"</h3></td> <td><h3>Выбрать образ персонажа</h3></td>
<td align=right><INPUT TYPE=button value="Вернуться" <td align=right><INPUT TYPE=button value="Вернуться"
onClick="location.href='main.php?edit=0.467837356797105';"></td> onClick="location.href='main.php?edit=0.467837356797105';"></td>
</tr> </tr>
<tr>
<td align=center style="color:red;"></td>
</tr>
</table> </table>
<center> <center>
<TABLE border=0 cellpadding="0" cellspacing="0" style="padding:5px;"> <TABLE border=0 cellpadding="0" cellspacing="0" style="padding:5px;">
@ -630,39 +511,17 @@ if (@$_POST['setshadowclan']) {
die(); die();
} }
// if ($_GET['setch']) {
if (@$_GET['setch']) {
$online = mysql_query("SELECT * FROM `online` WHERE `real_time` >= '" . (time() - 60) . "'"); $online = mysql_query("SELECT * FROM `online` WHERE `real_time` >= '" . (time() - 60) . "'");
while ($v = mysql_fetch_array($online)) { while ($v = mysql_fetch_array($online)) {
$or[$v['room']]++; $or[$v['room']]++;
} }
#$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$user['id']}' LIMIT 1"));
//echo $user['room'] ;
?> ?>
<html> <html>
<head> <head>
<script LANGUAGE='JavaScript'> <link rel="stylesheet" href="css/main.css"/>
document.ondragstart = test; <meta charset="utf-8">
//запрет на перетаскивание
document.onselectstart = test;
//запрет на выделение элементов страницы
document.oncontextmenu = test;
//запрет на выведение контекстного меню
function test() {
return false
}
</SCRIPT>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<meta http-equiv="Cache-Control" content="no-cache, max-age=0, must-revalidate, no-store">
<meta http-equiv="PRAGMA" content="NO-CACHE"/>
<meta http-equiv="Expires" content="0"/>
<script> <script>
function inforoom(room) { function inforoom(room) {
@ -685,29 +544,8 @@ if (@$_GET['setch']) {
} else { } else {
return 'false'; return 'false';
} }
}; }
</script> </script>
<style>
.hover:hover {
border-radius: 8px;
cursor: pointer;
}
.btn {
font-family: MS Sans Serif;
font-size: 10px;
text-align: center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: inline-block;
line-height: 10px \0/;
}
</style>
</head> </head>
<body id="body" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#e2e0e0" <body id="body" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#e2e0e0"
@ -1336,7 +1174,7 @@ if (@$_GET['setch']) {
} }
header("Cache-Control: no-cache"); header("Cache-Control: no-cache");
if (@$_GET['edit']) { if ($_GET['edit']) {
if ($_GET['ups']) { if ($_GET['ups']) {
switch ($_GET['ups']) { switch ($_GET['ups']) {
@ -2373,8 +2211,6 @@ if (@$_GET['edit']) {
<INPUT class="button-mid btn" TYPE=button name=combats value="Анкета" <INPUT class="button-mid btn" TYPE=button name=combats value="Анкета"
onClick="location.href='user_anketa.php';" style="font-weight:bold;"> onClick="location.href='user_anketa.php';" style="font-weight:bold;">
<INPUT class="button-big btn" TYPE="submit" name="changepsw" value="Безопасность" title="Безопасность"
style="FONT-WEIGHT: bold;">
<INPUT class="button-big btn" TYPE="submit" name="transreport" value="Отчет о переводах" <INPUT class="button-big btn" TYPE="submit" name="transreport" value="Отчет о переводах"
title="Отчет о переводах"> title="Отчет о переводах">
<INPUT class="button-dark-mid btn" TYPE="button" value="Подсказка" style="background-color:#A9AFC0" <INPUT class="button-dark-mid btn" TYPE="button" value="Подсказка" style="background-color:#A9AFC0"

View File

@ -7,7 +7,7 @@ if ($hreject) {
include("config.php"); include("config.php");
$login = filter_input(INPUT_POST, 'login'); $login = filter_input(INPUT_POST, 'login');
$password = filter_input(INPUT_POST, 'psw'); $password = password_hash(filter_input(INPUT_POST, 'psw'),PASSWORD_DEFAULT);
$birthday = filter_input(INPUT_POST, 'birthday'); $birthday = filter_input(INPUT_POST, 'birthday');
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$law = filter_input(INPUT_POST, 'law', FILTER_VALIDATE_BOOLEAN); $law = filter_input(INPUT_POST, 'law', FILTER_VALIDATE_BOOLEAN);

View File

@ -12,8 +12,10 @@ if ($u->i()['battle'] > 0) {
die(); die();
} }
$name = filter_input(INPUT_POST, $_POST['name']); $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS);
$color = filter_input(INPUT_POST, $_POST['color']); $oldpsw = filter_input(INPUT_POST, 'oldpsw', FILTER_SANITIZE_SPECIAL_CHARS);
$newpsw = filter_input(INPUT_POST, 'newpsw', FILTER_SANITIZE_SPECIAL_CHARS);
$color = filter_input(INPUT_POST, 'color', FILTER_VALIDATE_INT);
$hobbie = str_replace("\\n", "<br />", $_POST['hobbie']); $hobbie = str_replace("\\n", "<br />", $_POST['hobbie']);
$hobbie = str_replace("\\r", "", $_POST['hobbie']); $hobbie = str_replace("\\r", "", $_POST['hobbie']);
$hobbie = str_replace("&lt;br&nbsp;/&gt;", "<br />", $_POST['hobbie']); $hobbie = str_replace("&lt;br&nbsp;/&gt;", "<br />", $_POST['hobbie']);
@ -34,6 +36,12 @@ if ($name || $color || $hobbie) {
db::c()->query('UPDATE `users` SET `realname` = "?s", `color` = "?s", `info` = "?s" WHERE `id` = ?i', $name, $color, $hobbie, $u->i()['id']); db::c()->query('UPDATE `users` SET `realname` = "?s", `color` = "?s", `info` = "?s" WHERE `id` = ?i', $name, $color, $hobbie, $u->i()['id']);
} }
} }
if ($oldpsw && $newpsw){
if (password_verify($oldpsw, $u->i()['psw'])){
db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `id` = ?i', password_hash($newpsw,PASSWORD_DEFAULT), $u->i()['id']);
} else err('Неверный текущий пароль!');
}
?> ?>
<!doctype html> <!doctype html>
<html> <html>
@ -55,5 +63,11 @@ if ($name || $color || $hobbie) {
<textarea name="hobbie" placeholder="Хобби"><?= $u->i()['info'] ?></textarea><br> <textarea name="hobbie" placeholder="Хобби"><?= $u->i()['info'] ?></textarea><br>
<input name="submit" type="submit"> <input name="submit" type="submit">
</form> </form>
<h1>Безопасность</h1>
<form method="post" action="user_anketa.php">
<input placeholder="Старый пароль" name="oldpsw">
<input placeholder="Новый пароль" name="newpsw">
<input type="submit">
</form>
</body> </body>
</html> </html>