216 lines
9.1 KiB
PHP
216 lines
9.1 KiB
PHP
<?php
|
|
function GetRealIp(){
|
|
if (!empty($_SERVER['HTTP_CLIENT_IP']))
|
|
return $_SERVER['HTTP_CLIENT_IP'];
|
|
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
|
|
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
return $_SERVER['REMOTE_ADDR'];
|
|
}
|
|
|
|
define('IP',GetRealIp());
|
|
|
|
include('_incl_data/__config.php');
|
|
define('GAME',true);
|
|
include('_incl_data/class/__db_connect.php');
|
|
include('_incl_data/class/__magic.php');
|
|
include('_incl_data/class/__user.php');
|
|
include('_incl_data/class/__filter_class.php');
|
|
include('_incl_data/class/__quest.php');
|
|
|
|
$free_stats = 125;
|
|
|
|
if($u->info['banned'] > 0) {
|
|
header('location: /index.php');
|
|
die();
|
|
}
|
|
|
|
$tjs = '';
|
|
|
|
if($u->info['bithday'] == '01.01.1800' && $u->info['inTurnirnew'] == 0) {
|
|
unset($_GET,$_POST);
|
|
}
|
|
|
|
if($u->info['activ']>0) {
|
|
die('Âàì íåîáõîäèìî àêòèâèðîâàòü ïåðñîíàæà.<br>Àâòîðèçèðóéòåñü ñ ãëàâíîé ñòðàíèöû.');
|
|
}
|
|
|
|
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'].'" áûë ñòåðò.';
|
|
}
|
|
}
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="windows-1251">
|
|
<title>Ñòàðûé Áîéöîâñêèé Êëóá - Ïðîôèëè õàðàêòåðèñòèê</title>
|
|
<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
|
|
<script type="text/javascript" src="js/jquery.js"></script>
|
|
<script>
|
|
var free_stats = <?=$free_stats?>;
|
|
function test_free() {
|
|
var i = 1;
|
|
var a = 0;
|
|
while( i <= 6 ) {
|
|
a += Number($('#s'+i).val());
|
|
i++;
|
|
}
|
|
$('#free_s').val( free_stats - a );
|
|
if( free_stats - a > 0 ) {
|
|
$('#result_ch').html('');
|
|
}else if( free_stats - a == 0 ) {
|
|
$('#result_ch').html(' <font color="green"><b>Òåïåðü ìîæíî ñîõðàíÿòü</b></font>');
|
|
}else{
|
|
$('#result_ch').html(' <font color="red"><b>Íåäîñòàòî÷íî õàðàêòåðèñòèê!</b></font>');
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<h3>Ïðîôèëè õàðàêòåðèñòèê</h3><br>
|
|
<?
|
|
if( $u->error != '' ) {
|
|
echo '<div><font color="red"><b>'.$u->error.'</b></font></div><br>';
|
|
}
|
|
?>
|
|
Ñòàòû íå ïîçâîëÿþò ñõîäèòü â ðóèíû? Ðàñêèíüòå âàøè ñòàòû òàê, êàê âû õîòèòå, è ó÷àñòâóéòå â òóðíèðå! Âûáðàííûé ïî óìîë÷àíèþ ïðîôèëü, çàãðóçèòñÿ ñàì. Âû ìîæåòå ñîçäàâàòü äî äâàäöàòè ïðîôèëåé è ìåíÿòü èõ çà ñåêóíäû äî òóðíèðà!
|
|
<br><br>
|
|
<table style="border:1px solid #000;" width="100%" border="0" cellspacing="0" cellpadding="5">
|
|
<tr>
|
|
<td style="border-right:1px solid #000;" bgcolor="#b5b5b5">Íàçâàíèå</td>
|
|
<td style="border-right:1px solid #000;" bgcolor="#b5b5b5">Ïî óìîë÷àíèþ</td>
|
|
<td bgcolor="#b5b5b5">Óäàëèòü</td>
|
|
</tr>
|
|
<?
|
|
$j = 0;
|
|
$sp = mysql_query('SELECT * FROM `ruine_sets` WHERE `uid` = "'.$u->info['id'].'" ORDER BY `time` DESC');
|
|
while( $pl = mysql_fetch_array($sp) ) {
|
|
?>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#d2d0d1"><?=$pl['name']?></td>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#d2d0d1">
|
|
<? if( $pl['use'] == 0 ) { ?>
|
|
<a href="https://new-combats.com/ruin_characteristics.php?use=<?=$pl['id']?>">Óñòàíîâèòü</a>
|
|
<? }else{ ?>
|
|
<b><font color="red">Ïî óìîë÷àíèþ</font></b>
|
|
<? } ?></td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#d2d0d1"><a href="https://new-combats.com/ruin_characteristics.php?delete=<?=$pl['id']?>">óäàëèòü</a></td>
|
|
</tr>
|
|
<? $j++; } ?>
|
|
</table>
|
|
<?
|
|
if( $j == 0 ) {
|
|
echo '<div style="padding:5px;border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;background-color:#d2d0d1;" align="center">Íåò ñîõðàíåííûõ ïðîôèëåé</div>';
|
|
}
|
|
?>
|
|
<br>
|
|
<input type="button" value="Îáíîâèòü" class="btnnew" onClick="location.href='https://new-combats.com/ruin_characteristics.php';">
|
|
<br><br>
|
|
<hr>
|
|
<br>
|
|
<form method="post" action="https://new-combats.com/ruin_characteristics.php">
|
|
Íàçâàíèå: <input name="set_name" type="text" value="" class="textnew" style="width:144px;"><br><br>
|
|
<table style="border:1px solid #000;" width="100%" border="0" cellspacing="0" cellpadding="5">
|
|
<tr>
|
|
<td style="border-right:1px solid #000;" width="200" bgcolor="#B5B5B5">Õàðàêòåðèñòèêà</td>
|
|
<td bgcolor="#B5B5B5">Çíà÷åíèå</td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Ñèëà</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s1" name="s1" type="text" value="" class="textnew" style="width:44px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Ëîâêîñòü</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s2" name="s2" type="text" value="" class="textnew" style="width:44px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Èíòóèöèÿ</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s3" name="s3" type="text" value="" class="textnew" style="width:44px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Âûíîñëèâîñòü</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s4" name="s4" type="text" value="" class="textnew" style="width:44px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Èíòåëëåêò</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s5" name="s5" type="text" value="" class="textnew" style="width:44px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Ìóäðîñòü</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s6" name="s6" type="text" value="" class="textnew" style="width:44px;"></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">Ñâîáîäíûõ ñòàòîâ</td>
|
|
<td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input id="free_s" disabled="disabled" type="text" value="<?=$free_stats?>" class="textnew" style="width:44px;"><span id="result_ch"></span></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<input type="submit" value="Ñîõðàíèòü / Èçìåíèòü" class="btnnew">
|
|
</form>
|
|
<script>test_free();</script>
|
|
</body>
|
|
</html>
|