game/settings.php

328 lines
13 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Core\Config;
use Core\Database;
use Core\Db;
if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php';
}
Config::init();
Database::init();
$u = User::start();
$filter = new Filter();
$allowedTextColors = ['Black', 'Blue', 'Fuchsia', 'Gray', 'Green', 'Maroon', 'Navy', 'Olive', 'Purple', 'Teal', 'Orange', 'Chocolate', 'DarkKhaki', 'SandyBrown'];
if ($u->info['admin']) {
$allowedTextColors[] = 'Red';
}
$simbolcount = strlen($u->info['hobby']);
$maxsimbols = 2000;
if (isset($_POST['name'], $_POST['hobby'], $_POST['ChatColor'], $_POST['saveanketa'])) {
if (!in_array($_POST['ChatColor'], $allowedTextColors)) {
$_POST['ChatColor'] = "Black";
}
if (!empty($filter->spamFiltr($_POST['name'])) || !empty($filter->spamFiltr($_POST['hobby']))) { // WTF ?!
Db::sql('update users set info_delete = unix_timestamp() + 86400 where id = ?', [$u->info['id']]);
}
if ($simbolcount > $maxsimbols && $u->info['admin'] == 0) {
$error = '<div style="color:#FF0000; position: absolute; left: 900px; top: 100px; ">
Максимальный размер поля "Увлечения / хобби" - ' . $maxsimbols . ' символов.</div>';
} else {
Db::sql(
'update users set name = ?, chatColor = ?, hobby = ? where id = ?',
[
$_POST['name'], $_POST['chatColor'], $_POST['hobby'],
]
);
$u->info['name'] = $_POST['name'];
$u->info['hobby'] = $_POST['hobby'];
$u->info['chatColor'] = $_POST['ChatColor'];
}
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Бойцовский Клуб - Настройки</title>
<link rel="stylesheet" href="i/move/design3.css">
<link rel="stylesheet" href="i/main.css">
<style>
@import url(https://fonts.googleapis.com/css?family=Philosopher&subset=latin,cyrillic);
body, td {
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 12pt;
color: #000000
}
A {
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 12pt;
color: #decdb9;
}
a:link {
color: #decdb9;
text-decoration: none
}
A:visited {
color: #decdb9;
text-decoration: none
}
A:hover, A:active {
color: #f3e9dd;
text-decoration: none;
}
body {
background-color: #000000;
margin: 0;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12pt;
color: #000000;
}
td.topbgl {
background-image: url(new/register/topbgl.jpg);
background-position: right top
}
input {
font-size: 12px;
}
div.footer {
text-align: center;
color: #EBD88B;
font-family: 'Philosopher', sans-serif;
font-size: 18px;
}
input, select {
background-color: transparent;
border-width: 0 0 1px;
border-radius: 0;
border-color: black;
}
option {
background-color: antiquewhite;
}
textarea {
background-color: antiquewhite;
border: 0;
border-radius: 0;
width: 95%;
height: 170px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
outline: 0;
}
fieldset {
border: 1px solid black;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
clear: both;
}
fieldset > legend {
font-weight: bold;
}
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="513" class="topbgl">&nbsp;</td>
</tr>
</table>
</td>
<td width="1%" valign="top" background="/new/register/bgl.jpg">
<div style="width: 67px; height: 108px;"><!-- тут был флеш --></div>
<img src="/new/register/topl.jpg"/></td>
<td width="20%" valign="top">
<table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/new/register/top.jpg" width="850" height="35"/></td>
</tr>
<tr>
<td height="1">
<img src="/new/register/top1_nul.jpg" width="850" height="65"/>
</td>
</tr>
<tr>
<td height="593" align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1" valign="top"
background="/new/register/vesch_leftbg.jpg"><img
src="/new/register/vesch_left.jpg" width="49"
height="416"/></td>
<td height="577" valign="top" bgcolor="#edd7ae">
<div>
<?= $error ?? '' ?>
<!-- content -->
<div style="text-align: center; margin-bottom: 8px;">
<?= $u->microLogin($u->info['id'], 1) ?>
</div>
<form method="post">
<fieldset>
<legend>Анкета</legend>
<div>
<table>
<tr>
<td><label for="name">Ваше реальное имя:</label></td>
<td><input id="name" name="name"
value="<?= htmlspecialchars($u->info['name']) ?>"
size="45" maxlength="90"/>
</td>
</tr>
<tr>
<td><label for="bday">День рождения:</label></td>
<td><input id="bday" type="date" disabled
value="<?= date(
'Y-m-d', strtotime($u->info['bithday'])
) ?>">
</td>
</tr>
<tr>
<td><label for="chatcolor">Цвет сообщений в чате:</label>
</td>
<td>
<select id="chatcolor" name="ChatColor"
style="width:250px;">
<?php foreach ($allowedTextColors as $color): ?>
<option style="background-color: <?= $color ?>"
value="<?= $color ?>">&nbsp;
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
</table>
<script>FORM1.ChatColor.value = "<?=$u->info['chatColor']?>";</script>
</div>
<br>
<textarea id="hobby" name="hobby" cols="60" rows="7"
placeholder="Напишите о себе...">
<?= htmlspecialchars($u->info['hobby']) ?>
</textarea>
<br>
<label for="hobby">
Увлечения / хобби <i>(ограничение <?= $maxsimbols ?>
символов и 300 строк)</i>
</label>
<br>
<input name="saveanketa" type="submit" class="btn" value="Сохранить"/>
</fieldset>
</form>
</div>
<td width="1" valign="top" bgcolor="#edd7ae">
<img src="/new/register/vesch_right.jpg" width="26"
height="423"/>
</td>
</tr>
<tr>
<td colspan="3" valign="top">
<img src="/new/register/vesch_bot2.jpg" width="850"
height="34"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="1%" valign="top" background="/new/register/bgr2.jpg">
<img src="/new/register/topr.jpg" width="83" height="593"/><br/>
<img src="/new/register/right2.jpg" width="83" height="114"/>
</td>
<td width="39%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="507" background="/new/register/topbgr.jpg">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td colspan="3" valign="top">
<img src="/new/register/bottom.jpg" width="1000" height="163"/>
</td>
<td valign="top">&nbsp;</td>
</tr>
</table>
<div class="footer"><?= Config::get('name') ?> &copy; 2013-<?= date('Y') ?></div>
<div style="display:none;"></div>
</body>
<script type="text/javascript">
function MM_preloadImages() { //v3.0
let d = document;
if (d.images) {
if (!d.MM_p) d.MM_p = [];
let i, j = d.MM_p.length, a = MM_preloadImages.arguments;
for (i = 0; i < a.length; i++)
if (a[i].indexOf("#") != 0) {
d.MM_p[j] = new Image;
d.MM_p[j++].src = a[i];
}
}
}
function MM_swapImgRestore() { //v3.0
let i, x, a = document.MM_sr;
for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}
function MM_findObj(n, d) { //v4.01
let p, i, x;
if (!d) d = document;
if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document;
n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) x = d.all[n];
for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
if (!x && d.getElementById) x = d.getElementById(n);
return x;
}
function MM_swapImage() { //v3.0
let i, j = 0, x, a = MM_swapImage.arguments;
document.MM_sr = [];
for (i = 0; i < (a < /dngth-2);i+=3)
if ((x = MM_findObj(a[i])) != null) {
document.MM_sr[j++] = x;
if (!x.oSrc) x.oSrc = x.src;
x.src = a[i + 2];
}
}
</script>
</html>