Фикс анкеты персонажа.
This commit is contained in:
parent
6882362ef9
commit
7d7a83a8a0
@ -18,13 +18,10 @@ class nick
|
||||
public function login(){
|
||||
$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$this->id)->fetch_assoc();
|
||||
if ($this->invis){
|
||||
// db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc();
|
||||
$user['login'] = 'невидимка';
|
||||
$user['level'] = 100;
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
//$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$id)->fetch_assoc();
|
||||
//$invisible = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc();
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
session_start();
|
||||
$hreject = filter_input(INPUT_COOKIE, GAMEDOMAIN);
|
||||
if ($hreject) {
|
||||
|
198
user_anketa.php
198
user_anketa.php
@ -1,150 +1,72 @@
|
||||
<?
|
||||
<?php
|
||||
session_start();
|
||||
if(!isset($_SESSION['uid'])) { header('Location: /index.php'); die(); }
|
||||
if (!isset($_SESSION['uid'])) {
|
||||
header('Location: /index.php');
|
||||
die();
|
||||
}
|
||||
include('config.php');
|
||||
include('functions.php');
|
||||
if($user['battle'] > 0) { header('Location: /fbattle.php'); die(); }
|
||||
|
||||
if ($user['battle'] > 0) {
|
||||
header('Location: /fbattle.php');
|
||||
die();
|
||||
}
|
||||
|
||||
if ($_POST['submit']) {
|
||||
$name = filter_input(INPUT_POST, $_POST['name']);
|
||||
$color = filter_input(INPUT_POST, $_POST['color']);
|
||||
// $name = htmlspecialchars($_POST['name'], NULL, 'cp1251');
|
||||
// $color = htmlspecialchars($_POST['color'], NULL, 'cp1251');
|
||||
$hobbie = str_replace("\\n", "<br />", $_POST['hobbie']);
|
||||
$hobbie = str_replace("\\r", "", $_POST['hobbie']);
|
||||
$hobbie = str_replace("<br />", "<br />", $_POST['hobbie']);
|
||||
|
||||
|
||||
if($_POST['sewe']) {
|
||||
$name = htmlspecialchars($_POST['name'], NULL, 'cp1251');
|
||||
$diviz = htmlspecialchars($_POST['motto'], NULL, 'cp1251');
|
||||
$color = htmlspecialchars($_POST['color'], NULL, 'cp1251');
|
||||
$icq = htmlspecialchars($_POST['icq'], NULL, 'cp1251');
|
||||
$homePage = htmlspecialchars($_POST['homePage'], NULL, 'cp1251');
|
||||
$city = htmlspecialchars($_POST['city'], NULL, 'cp1251');
|
||||
$hobbie = str_replace("\\n", "<br />", $_POST['hobbie']);
|
||||
$hobbie = str_replace("\\r", "", $_POST['hobbie']);
|
||||
$hobbie = str_replace("<br />", "<br />", $_POST['hobbie']);
|
||||
$simbolcount = strlen($hobbie);
|
||||
switch ($color) {
|
||||
case 1: $newcolor = 'blue'; break;
|
||||
case 2: $newcolor = 'green'; break;
|
||||
default: $newcolor = 'black'; break;
|
||||
}
|
||||
|
||||
if (isset($color) && !($color == "black" || $color == "blue" || $color == "green")) {
|
||||
$error = "Возможно использовать цвета указанные только в меню анкеты!";
|
||||
$color = "Black";
|
||||
} elseif ($simbolcount > 1500) {
|
||||
$error = "Максимальная длинна поля Хобби: 1500 символов ...";
|
||||
} else {
|
||||
db::c()->query('UPDATE `users` SET `realname` = "?s", `color` = "?s", `info` = "?s" WHERE `id` = ?i', $name, $color, $hobbie, $user['id']);
|
||||
|
||||
$simbolcount = strlen($hobbie);
|
||||
|
||||
if(isset($color) && $user['align'] != '2.99' && !($color == "black" || $color == "blue" || $color == "fuchsia" || $color == "gray" || $color == "green" || $color == "maroon" || $color == "navy" || $color == "olive" || $color == "purple" || $color == "teal" || $color == "orange" || $color == "chocolate" || $color == "darkKhaki" || $color == "sandyBrown")) {
|
||||
$error = "Возможно использовать цвета указанные только в меню анкеты!";
|
||||
$color = "Black";
|
||||
} elseif($user['align'] != '2.99' && $simbolcount > 1500) {
|
||||
$error = "Максимальная длинна поля Хобби: 1500 символов ...";
|
||||
} else {
|
||||
mysql_query('UPDATE `users` SET `realname` = "'.mysql_real_escape_string($name).'", `lozung` = "'.mysql_real_escape_string($diviz).'", `color` = "'.mysql_real_escape_string($color).'", `icq` = "'.mysql_real_escape_string($icq).'", `http` = "'.mysql_real_escape_string($homePage).'", `city` = "'.mysql_real_escape_string($city).'", `info` = "'.mysql_real_escape_string($hobbie).'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
|
||||
echo mysql_error();
|
||||
$user['realname'] = $name; $user['lozung'] = $diviz; $user['color'] = $color; $user['icq'] = $icq; $user['http'] = $homePage; $user['city'] = $city; $user['info'] = $hobbie;
|
||||
$error = 'Изменения вступили в силу ...';
|
||||
}
|
||||
$user['realname'] = $name;
|
||||
$user['color'] = $color;
|
||||
$user['info'] = $hobbie;
|
||||
$error = 'Изменения вступили в силу ...';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Language" content="ru" />
|
||||
<link rel="stylesheet" href="css/main.css" type="text/css" />
|
||||
<title>404</title>
|
||||
<style text="text/css">
|
||||
.header {
|
||||
color: #8f0000;
|
||||
font-family: Arial;
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
table.soctable {
|
||||
border: 0px solid #d4d4d4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table.soctable td, table.soctable th {
|
||||
border: 0px solid #c4c4c4;
|
||||
padding: 5px;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="http://g.capitalcity.old-dark.ru/js/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
top.jQuery.fn.center = function () {
|
||||
this.css("position", "absolute");
|
||||
this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
|
||||
this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
|
||||
return this;
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: font-size: 10pt; background-color: #e2e0e0; font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;">
|
||||
<div id="hint4"></div>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="header">Анкета персонажа <?=$user['login']; ?></td>
|
||||
<td align="right" width="250"><input type="button" onclick="location.href = 'user_anketa.php';" value=" Обновить " style="cursor: pointer;" /> <input type="button" value=" Вернуться " onclick="location.href = 'main.php';" style="cursor: pointer;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<form action="?" name="anketa" id="anketa" method="POST">
|
||||
<input type="hidden" name="act" value="save" />
|
||||
<table align="center" border="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>Реальное имя:</td>
|
||||
<td><input style="width: 100%" type="text" name="name" value="<?=$user['realname']; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Девиз:</td>
|
||||
<td><input style="width: 100%" type="text" name="motto" value="<?=$user['lozung']; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Цвет сообщений:</td>
|
||||
<td>
|
||||
<select name="color">
|
||||
<option style="background: #f2f0f0; color: black" value="black">Черный</option>
|
||||
<option style="background: #f2f0f0; color: blue" value="blue">Синий</option>
|
||||
<option style="background: #f2f0f0; color: fuchsia" value="fuchsia">Розовый</option>
|
||||
<option style="background: #f2f0f0; color: gray" value="gray">Серый</option>
|
||||
<option style="background: #f2f0f0; color: green" value="green">Зеленый</option>
|
||||
<option style="background: #f2f0f0; color: maroon" value="maroon">Темнокрасный</option>
|
||||
<option style="background: #f2f0f0; color: navy" value="navy">Темносиний</option>
|
||||
<option style="background: #f2f0f0; color: olive" value="olive">Оливковый</option>
|
||||
<option style="background: #f2f0f0; color: purple" value="purple">Фиолетовый</option>
|
||||
<option style="background: #f2f0f0; color: teal" value="teal">Морской волны</option>
|
||||
<option style="background: #f2f0f0; color: orange" value="orange">Оранжевый</option>
|
||||
<option style="background: #f2f0f0; color: chocolate" value="chocolate">Шоколадный</option>
|
||||
<option style="background: #f2f0f0; color: darkkhaki" value="darkKhaki">Темный хаки</option>
|
||||
<option style="background: #f2f0f0; color: sandybrown" value="sandyBrown">Темнопесочный</option>
|
||||
<? if($user['align'] == 2.99) { echo '<option style="background: #f2f0f0; color: red" value="Red">Красный</option>'; } ?>
|
||||
</select>
|
||||
<script language="javascript" type="text/javascript">var coloru = '<?=$user['color'];?>'; if(coloru == '' || coloru == 0) { anketa.color.value = "black"; } else { anketa.color.value = "<?=$user['color']?>"; }</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ICQ:</td>
|
||||
<td><input style="width: 100%" type="text" name="icq" value="<?=$user['icq']; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Домашняя страничка:</td>
|
||||
<td><input style="width: 100%" type="text" name="homePage" value="<?=$user['http']; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Город:</td>
|
||||
<td><input style="width: 100%" type="text" name="city" value="<?=$user['city']; ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
Увлечения / хобби:
|
||||
<br /><textarea name="hobbie" style="width: 400px; height: 300px;"><?=$user['info']; ?></textarea>
|
||||
<br /><input type="submit" value=" Сохранить " style="cursor: pointer; width: 100%;" name="sewe" />
|
||||
<? if($error != '') { echo '<b style=\'color: Red;\'>'.$error.'</b>'; } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<title>Анкета</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a href="main.php">← на главную</a>
|
||||
<h1>Анкета персонажа <?= $user['login'] ?></h1>
|
||||
<form method="post" action="user_anketa.php">
|
||||
<input name="name" placeholder="Реальное имя" value="<?= $user['realname']; ?>"><br>
|
||||
<select name="color" id="color">
|
||||
<option value="0" selected>Чёрный</option>
|
||||
<option value="1">Синий</option>
|
||||
<option value="2">Зелёный</option>
|
||||
</select><label for="color"></label>
|
||||
<textarea name="hobby" placeholder="Хобби"><?= $user['info'] ?></textarea>
|
||||
<input name="submit" type="submit">
|
||||
</form>
|
||||
<div id="hint4"></div>
|
||||
<?php if (!empty($error)) err($error); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user