2018-03-01 18:43:46 +00:00
|
|
|
<?php
|
2018-01-28 16:40:49 +00:00
|
|
|
session_start();
|
2018-03-01 18:43:46 +00:00
|
|
|
if (!isset($_SESSION['uid'])) {
|
|
|
|
header('Location: /index.php');
|
|
|
|
die();
|
|
|
|
}
|
2018-03-01 20:26:45 +00:00
|
|
|
include_once('config.php');
|
|
|
|
include_once('functions.php');
|
2018-03-01 19:14:51 +00:00
|
|
|
|
|
|
|
if ($u->i()['battle'] > 0) {
|
2018-03-01 18:43:46 +00:00
|
|
|
header('Location: /fbattle.php');
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2018-03-01 20:26:45 +00:00
|
|
|
$name = filter_input(INPUT_POST, $_POST['name']);
|
|
|
|
$color = filter_input(INPUT_POST, $_POST['color']);
|
|
|
|
$hobbie = str_replace("\\n", "<br />", $_POST['hobbie']);
|
|
|
|
$hobbie = str_replace("\\r", "", $_POST['hobbie']);
|
|
|
|
$hobbie = str_replace("<br />", "<br />", $_POST['hobbie']);
|
2018-03-01 19:14:51 +00:00
|
|
|
|
2018-03-01 20:26:45 +00:00
|
|
|
if ($name || $color || $hobbie) {
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2018-03-01 18:43:46 +00:00
|
|
|
$simbolcount = strlen($hobbie);
|
2018-03-01 19:14:51 +00:00
|
|
|
|
2018-03-01 18:43:46 +00:00
|
|
|
switch ($color) {
|
2018-03-01 19:14:51 +00:00
|
|
|
case 1: $color = 'blue'; break;
|
|
|
|
case 2: $color = 'green'; break;
|
|
|
|
default: $color = 'black'; break;
|
2018-03-01 18:43:46 +00:00
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2018-03-01 19:14:51 +00:00
|
|
|
if ($simbolcount > 1500) {
|
|
|
|
err('Максимальная длинна поля Хобби: 1500 символов!');
|
2018-03-01 18:43:46 +00:00
|
|
|
} else {
|
2018-03-01 19:14:51 +00:00
|
|
|
db::c()->query('UPDATE `users` SET `realname` = "?s", `color` = "?s", `info` = "?s" WHERE `id` = ?i', $name, $color, $hobbie, $u->i()['id']);
|
2018-03-01 18:43:46 +00:00
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
}
|
|
|
|
?>
|
2018-03-01 18:43:46 +00:00
|
|
|
<!doctype html>
|
2018-01-28 16:40:49 +00:00
|
|
|
<html>
|
2018-03-01 18:43:46 +00:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8"/>
|
|
|
|
<link rel="stylesheet" href="css/main.css">
|
|
|
|
<title>Анкета</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a href="main.php">← на главную</a>
|
2018-03-01 19:14:51 +00:00
|
|
|
<h1>Анкета персонажа <?= $u->i()['login'] ?></h1>
|
2018-03-01 18:43:46 +00:00
|
|
|
<form method="post" action="user_anketa.php">
|
2018-03-01 19:14:51 +00:00
|
|
|
<input name="name" placeholder="Реальное имя" value="<?= $u->i()['realname']; ?>"><br>
|
2018-03-01 18:43:46 +00:00
|
|
|
<select name="color" id="color">
|
|
|
|
<option value="0" selected>Чёрный</option>
|
|
|
|
<option value="1">Синий</option>
|
|
|
|
<option value="2">Зелёный</option>
|
2018-03-01 19:14:51 +00:00
|
|
|
</select><label for="color"></label><br>
|
|
|
|
<textarea name="hobbie" placeholder="Хобби"><?= $u->i()['info'] ?></textarea><br>
|
2018-03-01 18:43:46 +00:00
|
|
|
<input name="submit" type="submit">
|
|
|
|
</form>
|
|
|
|
</body>
|
2018-01-28 16:40:49 +00:00
|
|
|
</html>
|