info['banned'] > 0) { header('location: /index.php'); die(); } $tjs = ''; if ($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) { unset($_GET, $_POST); } if (isset($_POST['set_name'])) { $_POST['set_name'] = htmlspecialchars($_POST['set_name']); $set_x = mysql_fetch_array( mysql_query( 'SELECT COUNT(*) FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `name` != "' . mysql_real_escape_string( $_POST['set_name'] ) . '" LIMIT 1' ) ); if ($set_x[0] > 20) { $u->error = 'Нельзя создавать более 20 профилей'; } else { $set_x = mysql_fetch_array( mysql_query( 'SELECT `id` FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `name` = "' . mysql_real_escape_string( $_POST['set_name'] ) . '" LIMIT 1' ) ); // $f = $free_stats; // свободных статов $i = 1; while ($i <= 6) { $_POST['s' . $i] = round((int)$_POST['s' . $i]); if ($_POST['s' . $i] < 0) { $_POST['s' . $i] = 0; } $f -= $_POST['s' . $i]; $i++; } // if ($f < 0 || $f > $free_stats) { $u->error = 'Ошибка в распределении статов.'; } elseif (isset($set_x['id'])) { mysql_query( 'UPDATE `ruine_sets` SET `s1` = "' . mysql_real_escape_string($_POST['s1']) . '", `s2` = "' . mysql_real_escape_string($_POST['s2']) . '", `s3` = "' . mysql_real_escape_string($_POST['s3']) . '", `s4` = "' . mysql_real_escape_string($_POST['s4']) . '", `s5` = "' . mysql_real_escape_string($_POST['s5']) . '", `s6` = "' . mysql_real_escape_string($_POST['s6']) . '", `free` = "' . mysql_real_escape_string($f) . '", `time` = "' . time() . '" WHERE `id` = "' . $set_x['id'] . '" LIMIT 1' ); $u->error = 'Профиль "' . $_POST['set_name'] . '" был успешно перезаписан!'; } else { mysql_query( 'INSERT INTO `ruine_sets` ( `uid`,`name`,`free`,`s1`,`s2`,`s3`,`s4`,`s5`,`s6`,`time` ) VALUES ( "' . $u->info['id'] . '","' . mysql_real_escape_string( $_POST['set_name'] ) . '","' . mysql_real_escape_string($f) . '", "' . mysql_real_escape_string($_POST['s1']) . '", "' . mysql_real_escape_string($_POST['s2']) . '", "' . mysql_real_escape_string($_POST['s3']) . '", "' . mysql_real_escape_string($_POST['s4']) . '", "' . mysql_real_escape_string($_POST['s5']) . '", "' . mysql_real_escape_string($_POST['s6']) . '", "' . time() . '" )' ); $u->error = 'Профиль "' . $_POST['set_name'] . '" был создан.'; } } } elseif (isset($_GET['use'])) { $set_x = mysql_fetch_array( mysql_query( 'SELECT * FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . mysql_real_escape_string( $_GET['use'] ) . '" LIMIT 1' ) ); if (isset($set_x['id'])) { mysql_query('UPDATE `ruine_sets` SET `use` = 0 WHERE `uid` = "' . $u->info['id'] . '"'); mysql_query('UPDATE `ruine_sets` SET `use` = 1 WHERE `id` = "' . $set_x['id'] . '" LIMIT 1'); $u->error = 'Профиль "' . $set_x['name'] . '" был установлен по умолчанию.'; } } elseif (isset($_GET['delete'])) { $set_x = mysql_fetch_array( mysql_query( 'SELECT * FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . mysql_real_escape_string( $_GET['delete'] ) . '" LIMIT 1' ) ); if (isset($set_x['id'])) { mysql_query('DELETE FROM `ruine_sets` WHERE `id` = "' . $set_x['id'] . '" LIMIT 1'); $u->error = 'Профиль "' . $set_x['name'] . '" был стерт.'; } } ?>
Название | По умолчанию | Удалить |
= $pl['name'] ?> | if ($pl['use'] == 0) { ?> Установить } else { ?> По умолчанию } ?> | удалить |