battles/user_anketa.php

151 lines
7.1 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?
session_start();
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($_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("&lt;br&nbsp;/&gt;", "<br />", $_POST['hobbie']);
$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 = 'Изменения вступили в силу ...';
}
}
?>
<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>
</html>