2018-01-28 16:40:49 +00:00
< ? php
session_start ();
if ( ! isset ( $_SESSION [ 'uid' ])) { header ( " Location: index.php " ); }
2020-09-29 22:39:06 +00:00
require_once " functions.php " ;
2018-01-28 16:40:49 +00:00
$effect = mysql_fetch_array ( mysql_query ( " SELECT * FROM `effects` WHERE `owner` = ' { $user [ 'id' ] } ' LIMIT 1 " ));
if ( $user [ 'battle' ] != 0 ) { header ( 'location: fbattle.php' ); die (); }
if ( $user [ 'room' ] != 31 ) { die ( 'Для распределения статов необходимо находиться в прихожей "Башни смерти"' ); }
if ( isset ( $effect [ 'id' ])) { die ( 'Для распределения статов на В а с не дожно быть никаких эффектов' ); }
undressall ( $user [ 'id' ]);
if (( int ) $_GET [ 'delsn' ] > 0 ) {
mysql_query ( " DELETE FROM `deztow_charstams` WHERE `id` = ' " . ( int ) $_GET [ 'delsn' ] . " ' AND `name` = ' " . $_GET [ 'ddname' ] . " ' AND `owner` = ' " . ( int ) $user [ 'id' ] . " ' LIMIT 1 " );
}
if ( $_POST [ 'name' ]) {
$stats = 83 ;
if ( $stats == abs ( $_POST [ 'sila' ]) + abs ( $_POST [ 'lovk' ]) + abs ( $_POST [ 'inta' ]) + abs ( $_POST [ 'vinos' ]) + abs ( $_POST [ 'intel' ])) {
mysql_query ( " INSERT `deztow_charstams` (`owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`) VALUES (' " . $user [ 'id' ] . " ', ' " . $_POST [ 'name' ] . " ', ' " . abs ( $_POST [ 'sila' ]) . " ', ' " . abs ( $_POST [ 'lovk' ]) . " ', ' " . abs ( $_POST [ 'inta' ]) . " ', ' " . abs ( $_POST [ 'vinos' ]) . " ', ' " . abs ( $_POST [ 'intel' ]) . " ') ON DUPLICATE KEY UPDATE `sila` = ' " . abs ( $_POST [ 'sila' ]) . " ', `lovk` = ' " . abs ( $_POST [ 'lovk' ]) . " ', `inta` = ' " . abs ( $_POST [ 'inta' ]) . " ', `vinos` = ' " . abs ( $_POST [ 'vinos' ]) . " ', `intel` = ' " . abs ( $_POST [ 'intel' ]) . " ' " );
echo " <font color=red><b>Сохранено!</b></font> " . mysql_error ();
} else {
echo " <font color=red><b>Что-то не то с о статами... сумму проверьте. Необходимо использовать все статы!</b></font> " ;
}
}
$tec = mysql_fetch_array ( mysql_query ( " SELECT `id`, `owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`, `mudra`, `def` FROM `deztow_charstams` WHERE `owner` = ' { $user [ 'id' ] } ' AND `id` = ' " . ( int ) $_GET [ 'id' ] . " ' LIMIT 1 " ));
if ( ! isset ( $tec [ 'id' ])) {
$tec [ 'sila' ] = 3 ;
$tec [ 'lovk' ] = 3 ;
$tec [ 'inta' ] = 3 ;
$tec [ 'vinos' ] = 10 ;
$tec [ 'intel' ] = 0 ;
}
if ( $_GET [ 'setdef' ]){
mysql_query ( " UPDATE `deztow_charstams` SET `def` = 1 WHERE `owner` = ' { $user [ 'id' ] } ' AND `id` = " . ( int ) $_GET [ 'setdef' ] . " LIMIT 1 " );
mysql_query ( " UPDATE `deztow_charstams` SET `def` = 0 WHERE `owner` = ' { $user [ 'id' ] } ' AND `id` != " . ( int ) $_GET [ 'setdef' ] . " " );
echo " <font color=red><b>Сохранено.</b></font> " . mysql_error ();
}
?>
< html >
< head >
< link rel = " stylesheet " type = " text/css " href = " css/main.css " />
< meta content = " text/html; charset=utf-8 " http - equiv = " Content-type " />
< meta http - equiv = " Cache-Control " content = " no-cache " />
< meta http - equiv = " PRAGMA " content = " NO-CACHE " />
< meta http - equiv = " Expires " content = " 0 " />
</ head >
< body style = " background-color: #e2e0e0; " >
< h3 > Профили характеристик </ h3 >
Статы не позволяют сходить в БС ? Раскиньте ваши статы так , как вы хотите , и участвуйте в турнире ! Выбранный по умолчанию профиль , загрузится сам . Вы можете создавать неограниченное число профилей , и менять их за секунды до турнира !
< br />< br />
< table width = 100 % bordercolor = silver border = 1 cellpadding = 0 cellspacing = 0 >
< tr bgcolor = silver >
< td > Название </ td >< td width = 25 %> По ум .</ td >< td > Удалить </ td >
</ tr >
< ? php
$data = mysql_query ( " SELECT `id`, `name`, `def` FROM `deztow_charstams` WHERE `owner` = ' { $user [ 'id' ] } ' " );
while ( $row = mysql_fetch_array ( $data )) {
echo " <tr onclick='location.href= \" towerstamp.php?id= { $row [ 'id' ] } \" ;' style='cursor: hand;'><td><b> { $row [ 'name' ] } </b></td><td><a href='?setdef= " . ( $row [ 'def' ] ? " " : $row [ 'id' ]) . " '> " . ( $row [ 'def' ] ? " <font color=red>По умолчанию</font> " : " Установить " ) . " </a></td><td><a href='?delsn= " . $row [ 'id' ] . " &ddname= " . $row [ 'name' ] . " ' title= \" Удалить набор \" >X</a></td></tr> \n " ;
}
?>
</ table >< br />
< input type = " button " value = " Обновить " onclick = " window.location.href='towerstamp.php'; " />
< script >
function countall () {
document . all [ 'stats' ] . value = 83 - Math . abs ( document . all [ 'sila' ] . value ) - Math . abs ( document . all [ 'lovk' ] . value ) - Math . abs ( document . all [ 'inta' ] . value ) - Math . abs ( document . all [ 'vinos' ] . value ) - Math . abs ( document . all [ 'intel' ] . value );
}
function check_stats () {
2019-01-16 17:45:30 +00:00
const stats = document . getElementById ( 'stats' ) . value ;
const sila = document . getElementById ( 'sila' ) . value ;
const lovk = document . getElementById ( 'lovk' ) . value ;
const inta = document . getElementById ( 'inta' ) . value ;
const vinos = document . getElementById ( 'vinos' ) . value ;
if ( stats != 0 ) { alert ( 'Проверьте количество распределенных статов' ); }
2018-01-28 16:40:49 +00:00
else if ( sila < 3 ) { alert ( 'Сила не может быть меньше 3 ...' ); }
else if ( lovk < 3 ) { alert ( 'Ловкость не может быть меньше 3 ...' ); }
else if ( inta < 3 ) { alert ( 'Интуиция не может быть меньше 3 ...' ); }
else if ( vinos < 3 ) { alert ( 'Выносливость не может быть меньше 3 ...' ); }
else {
document . getElementById ( 'sub' ) . submit ();
}
}
</ script >
< form method = " POST " id = " sub " >
Назв .: < input type = " text " name = " name " value = " <?= $tec['name'] ?> " />
< table cellpadding = 0 cellspacing = 0 >
< tr bgcolor = silver >
< td > Характеристика & nbsp ; </ td >< td > Знач .</ td >
</ tr >
< tr >
< td > Сила </ td >< td >< input type = " text " id = " sila " size = " 4 " onblur = " countall(); " value = " <?= $tec['sila'] ?> " name = " sila " /></ td >
</ tr >
< tr >
< td > Ловкость </ td >< td >< input type = " text " id = " lovk " size = " 4 " onblur = " countall(); " value = " <?= $tec['lovk'] ?> " name = " lovk " /></ td >
</ tr >
< tr >
< td > Интуиция </ td >< td >< input type = " text " id = " inta " size = " 4 " onblur = " countall(); " value = " <?= $tec['inta'] ?> " name = " inta " /></ td >
</ tr >
< tr >
< td > Выносливость </ td >< td >< input type = " text " id = " vinos " size = " 4 " onblur = " countall(); " value = " <?= $tec['vinos'] ?> " name = " vinos " /></ td >
</ tr >
< tr >
< td > Интеллект </ td >< td >< input type = " text " id = " intel " size = " 4 " onblur = " countall(); " value = " <?= $tec['intel'] ?> " name = " intel " /></ td >
</ tr >
< tr >
< td > Свободных </ td >< td >< input type = " text " id = " stats " name = " stats " size = " 4 " disabled = " disabled " value = " 64 " /></ td >
</ tr >
</ table >
< input type = " button " onclick = " check_stats() " value = " Сохранить/изменить " />
</ form >
</ body >
</ html >