<?php
/**
* @author ByUNNAMED
* @copyright 2012
*/
ob_start();
$title='Склад';//Титул
include('../../system/include/settings.inc');//Потключаемся к базе
include('../../system/include/function.inc');//Выводим функции
head($title,$udata2);//Верх страницы
if(isset($udata['pass']) && isset($udata2['nick'])){
switch($_GET['mod'])
{
default:
echo '<a href="?mod=weapon">Оружия</a><br/>';
echo '<a href="?mod=shield">Щиты</a><br/>';
echo '<a href="?mod=golova">Броня головы</a><br/>';
echo '<a href="?mod=body">Броня живота</a><br/>';
echo '<a href="?mod=nogi">Броня ног</a><br/>';
echo '<a href="index.asp?">Назад</a><br />';
break;
case 'weapon':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `implements`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `implements` WHERE `usr`='".$udata2['nick']."' and `type` = 'weapon' and `dressed` = 'not' LIMIT ".$from.",".$at_page."");
$avto = mysql_num_rows($req);
if($avto > 0)
{
while($wh = mysql_fetch_array($req))
{
echo '<a href="?mod=info&id='.$wh['id'].'">'.$wh['name'].'</a> [<a href="?mod=weapon_ok&id='.$wh['id'].'">Положить</a>]<br/>';
}
if($from > 0)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
}else{
echo 'Нет вещей!<br />';
}
echo '<a href="?">Назад</a>';
break;
case 'weapon_ok':
$id=abs(intval($_GET[id]));
$req = mysql_query("SELECT * FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
$wh = mysql_fetch_array($req);
if($wh['usr'] != $udata2['nick'])
{
echo 'Вы не можете Положить чужую вещь!<br /><a href="?">Назад</a>';
foot(); exit;
}
if($wh['type'] != 'weapon')
{
echo 'Это не оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$avto = mysql_num_rows($req);
if($avto <= 0)
{
echo 'Нет такого оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$req = mysql_query("DELETE FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
mysql_query("INSERT INTO `warehouse_items`
SET `usr` = '".$udata2['nick']."',
`name` = '".$wh['name']."',
`lat_name` = '".$wh['lat_name']."',
`p_ataka` = '".$wh['p_ataka']."',
`p_def` = '".$wh['p_def']."',
`p_golova` = '".$wh['p_golova']."',
`p_body` = '".$wh['p_body']."',
`p_nogi` = '".$wh['p_nogi']."',
`hp` = '".$wh['hp']."',
`lvl` = '".$wh['lvl']."',
`dressed` = 'not',
`type` = '".$wh['type']."',
`number` = '".$wh['number']."'");
if($req == true)
{
echo 'Вы успешно положили на склад '.$wh['name'];
echo '<br /><a href="?">Назад</a>';
}else{
echo 'Ошибка... Администратор извещен.';
echo '<br /><a href="?">Назад</a>';
mysql_query("INSERT INTO `log_error` SET `usr` = '".$udata2['nick']."', `text` = 'Ошибка при одевании оружия.', `file` = 'modules/character/'");
}
break;
case 'shield':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `implements`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `implements` WHERE `usr`='".$udata2['nick']."' and `type` = 'weapon' and `dressed` = 'not' LIMIT ".$from.",".$at_page."");
$avto = mysql_num_rows($req);
if($avto > 0)
{
while($wh = mysql_fetch_array($req))
{
echo '<a href="?mod=info&id='.$wh['id'].'">'.$wh['name'].'</a> [<a href="?mod=weapon_ok&id='.$wh['id'].'">Положить</a>]<br/>';
}
if($from > 0)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
}else{
echo 'Нет вещей!<br />';
}
echo '<a href="?">Назад</a>';
break;
case 'shield_ok':
$id=abs(intval($_GET[id]));
$req = mysql_query("SELECT * FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
$wh = mysql_fetch_array($req);
if($wh['usr'] != $udata2['nick'])
{
echo 'Вы не можете Положить чужую вещь!<br /><a href="?">Назад</a>';
foot(); exit;
}
if($wh['type'] != 'shield')
{
echo 'Это не оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$avto = mysql_num_rows($req);
if($avto <= 0)
{
echo 'Нет такого оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$req = mysql_query("DELETE FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
mysql_query("INSERT INTO `warehouse_items`
SET `usr` = '".$udata2['nick']."',
`name` = '".$wh['name']."',
`lat_name` = '".$wh['lat_name']."',
`p_ataka` = '".$wh['p_ataka']."',
`p_def` = '".$wh['p_def']."',
`p_golova` = '".$wh['p_golova']."',
`p_body` = '".$wh['p_body']."',
`p_nogi` = '".$wh['p_nogi']."',
`hp` = '".$wh['hp']."',
`lvl` = '".$wh['lvl']."',
`dressed` = 'not',
`type` = '".$wh['type']."',
`number` = '".$wh['number']."'");
if($req == true)
{
echo 'Вы успешно положили на склад '.$wh['name'];
echo '<br /><a href="?">Назад</a>';
}else{
echo 'Ошибка... Администратор извещен.';
echo '<br /><a href="?">Назад</a>';
mysql_query("INSERT INTO `log_error` SET `usr` = '".$udata2['nick']."', `text` = 'Ошибка при взятии вещей со склада.', `file` = 'modules/werhause/index.asp'");
}
break;
case 'golova':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `implements`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `implements` WHERE `usr`='".$udata2['nick']."' and `type` = 'weapon' and `dressed` = 'not' LIMIT ".$from.",".$at_page."");
$avto = mysql_num_rows($req);
if($avto > 0)
{
while($wh = mysql_fetch_array($req))
{
echo '<a href="?mod=info&id='.$wh['id'].'">'.$wh['name'].'</a> [<a href="?mod=weapon_ok&id='.$wh['id'].'">Положить</a>]<br/>';
}
if($from > 0)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
}else{
echo 'Нет вещей!<br />';
}
echo '<a href="?">Назад</a>';
break;
case 'golova_ok':
$id=abs(intval($_GET[id]));
$req = mysql_query("SELECT * FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
$wh = mysql_fetch_array($req);
if($wh['usr'] != $udata2['nick'])
{
echo 'Вы не можете Положить чужую вещь!<br /><a href="?">Назад</a>';
foot(); exit;
}
if($wh['type'] != 'golova')
{
echo 'Это не оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$avto = mysql_num_rows($req);
if($avto <= 0)
{
echo 'Нет такого оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$req = mysql_query("DELETE FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
mysql_query("INSERT INTO `warehouse_items`
SET `usr` = '".$udata2['nick']."',
`name` = '".$wh['name']."',
`lat_name` = '".$wh['lat_name']."',
`p_ataka` = '".$wh['p_ataka']."',
`p_def` = '".$wh['p_def']."',
`p_golova` = '".$wh['p_golova']."',
`p_body` = '".$wh['p_body']."',
`p_nogi` = '".$wh['p_nogi']."',
`hp` = '".$wh['hp']."',
`lvl` = '".$wh['lvl']."',
`dressed` = 'not',
`type` = '".$wh['type']."',
`number` = '".$wh['number']."'");
if($req == true)
{
echo 'Вы успешно положили на склад '.$wh['name'];
echo '<br /><a href="?">Назад</a>';
}else{
echo 'Ошибка... Администратор извещен.';
echo '<br /><a href="?">Назад</a>';
mysql_query("INSERT INTO `log_error` SET `usr` = '".$udata2['nick']."', `text` = 'Ошибка при взятии вещей со склада.', `file` = 'modules/werhause/index.asp'");
}
break;
case 'body':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `implements`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `implements` WHERE `usr`='".$udata2['nick']."' and `type` = 'weapon' and `dressed` = 'not' LIMIT ".$from.",".$at_page."");
$avto = mysql_num_rows($req);
if($avto > 0)
{
while($wh = mysql_fetch_array($req))
{
echo '<a href="?mod=info&id='.$wh['id'].'">'.$wh['name'].'</a> [<a href="?mod=weapon_ok&id='.$wh['id'].'">Положить</a>]<br/>';
}
if($from > 0)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
}else{
echo 'Нет вещей!<br />';
}
echo '<a href="?">Назад</a>';
break;
case 'body_ok':
$id=abs(intval($_GET[id]));
$req = mysql_query("SELECT * FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
$wh = mysql_fetch_array($req);
if($wh['usr'] != $udata2['nick'])
{
echo 'Вы не можете Положить чужую вещь!<br /><a href="?">Назад</a>';
foot(); exit;
}
if($wh['type'] != 'body')
{
echo 'Это не оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$avto = mysql_num_rows($req);
if($avto <= 0)
{
echo 'Нет такого оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$req = mysql_query("DELETE FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
mysql_query("INSERT INTO `warehouse_items`
SET `usr` = '".$udata2['nick']."',
`name` = '".$wh['name']."',
`lat_name` = '".$wh['lat_name']."',
`p_ataka` = '".$wh['p_ataka']."',
`p_def` = '".$wh['p_def']."',
`p_golova` = '".$wh['p_golova']."',
`p_body` = '".$wh['p_body']."',
`p_nogi` = '".$wh['p_nogi']."',
`hp` = '".$wh['hp']."',
`lvl` = '".$wh['lvl']."',
`dressed` = 'not',
`type` = '".$wh['type']."',
`number` = '".$wh['number']."'");
if($req == true)
{
echo 'Вы успешно положили на склад '.$wh['name'];
echo '<br /><a href="?">Назад</a>';
}else{
echo 'Ошибка... Администратор извещен.';
echo '<br /><a href="?">Назад</a>';
mysql_query("INSERT INTO `log_error` SET `usr` = '".$udata2['nick']."', `text` = 'Ошибка при взятии вещей со склада.', `file` = 'modules/werhause/index.asp'");
}
break;
case 'nogi':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `implements`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `implements` WHERE `usr`='".$udata2['nick']."' and `type` = 'weapon' and `dressed` = 'not' LIMIT ".$from.",".$at_page."");
$avto = mysql_num_rows($req);
if($avto > 0)
{
while($wh = mysql_fetch_array($req))
{
echo '<a href="?mod=info&id='.$wh['id'].'">'.$wh['name'].'</a> [<a href="?mod=weapon_ok&id='.$wh['id'].'">Положить</a>]<br/>';
}
if($from > 0)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
}else{
echo 'Нет вещей!<br />';
}
echo '<a href="?">Назад</a>';
break;
case 'nogi_ok':
$id=abs(intval($_GET[id]));
$req = mysql_query("SELECT * FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
$wh = mysql_fetch_array($req);
if($wh['usr'] != $udata2['nick'])
{
echo 'Вы не можете Положить чужую вещь!<br /><a href="?">Назад</a>';
foot(); exit;
}
if($wh['type'] != 'nogi')
{
echo 'Это не оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$avto = mysql_num_rows($req);
if($avto <= 0)
{
echo 'Нет такого оружия!<br /><a href="?">Назад</a>';
foot(); exit;
}
$req = mysql_query("DELETE FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
mysql_query("INSERT INTO `warehouse_items`
SET `usr` = '".$udata2['nick']."',
`name` = '".$wh['name']."',
`lat_name` = '".$wh['lat_name']."',
`p_ataka` = '".$wh['p_ataka']."',
`p_def` = '".$wh['p_def']."',
`p_golova` = '".$wh['p_golova']."',
`p_body` = '".$wh['p_body']."',
`p_nogi` = '".$wh['p_nogi']."',
`hp` = '".$wh['hp']."',
`lvl` = '".$wh['lvl']."',
`dressed` = 'not',
`type` = '".$wh['type']."',
`number` = '".$wh['number']."'");
if($req == true)
{
echo 'Вы успешно положили на склад '.$wh['name'];
echo '<br /><a href="?">Назад</a>';
}else{
echo 'Ошибка... Администратор извещен.';
echo '<br /><a href="?">Назад</a>';
mysql_query("INSERT INTO `log_error` SET `usr` = '".$udata2['nick']."', `text` = 'Ошибка при взятии вещей со склада.', `file` = 'modules/werhause/index.asp'");
}
break;
case 'info':
$id=abs(intval($_GET[id]));
$req = mysql_query("SELECT * FROM `implements` WHERE `id`='$id' and `usr` = '".$udata2['nick']."'");
$info = mysql_fetch_array($req);
echo $info['name'];
if($info['type'] == 'weapon')
{
echo '<br />Атака: '.$info['p_ataka'];
echo '<br />Уровень: '.$info['lvl'].'-30';
echo '<br /><a href="?mod='.$info['type'].'">Назад</a>';
}else{
echo '<br />Физ. Защита: '.$info['p_def'];
echo '<br />Защита головы: '.$info['p_golova'];
echo '<br />Защита живота: '.$info['p_body'];
echo '<br />Защита ног: '.$info['p_nogi'];
echo '<br />Уровень: '.$info['lvl'].'-30';
echo '<br /><a href="?mod='.$info['type'].'">Назад</a>';
}
break;
}
}else{echo'Вы не ';
echo '<a href="../../index.asp">авторизированы</a> или не выбран персонаж';
}
foot();
?>