Файл: books.php
Строк: 33
<?php
/*ANDREY69RUS*/ define('cms', 1);
require_once 'core.php';
if ($user)
{
Error_Reporting(E_ALL & ~E_NOTICE);
$u = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$user."'"));
if ($u['x'] == 3 AND $u['y'] == 1)
{
echo '<div class="menu">Магазин "Первое издание"</div>';
echo '<center><img src="/fon/logo5.png" alt="city"><br/></center>';
echo '<div class="pt">';
switch ($_GET['a'])
{
default:
echo 'Я, Хамэр. У меня собраны все экземпляры чипов Сиродила.<br />';
echo '<a href="?a=show&sort=id">Посмотреть чипы</a><br />';
echo '<a href="./index.php">Уйти</a><br />';
echo '<br /><a href="./guide.php?a=books">Информация о чипах</a>';
break;
case 'show':
echo 'Сортировать по: <br /><a href="?a=show&sort=id">ID</a> | <a href="?a=show&sort=cost">Стоимости</a> | <a href="?a=show&sort=time">Страницам</a> | <a href="?a=show&sort=title">Названию</a><div class="lin"></div>';
////////
if (!isset($_GET['sort'])) header('Location: ./books.php');
if ($_GET['sort'] !== 'id' AND $_GET['sort'] !== 'cost' AND $_GET['sort'] !== 'time' AND $_GET['sort'] !== 'title') header('Location: ./books.php');
////////
include('navigation.php');
$all_books = mysql_result(mysql_query("select count(*) from `book` order by ".$_GET['sort'].""),0);
$newlist = new books($all_books, 15, true);
$query = mysql_query("select * from `book` order by ".$_GET['sort']." asc limit ". $newlist->limit().";");
while($res = mysql_fetch_assoc($query))
{
echo '<a href="?a=inf_b&id='.$res['id'].'">'.$res['title'].'</a><br />';
}echo '<br />';
echo $newlist->back_forward_links();
break;
case 'inf_b':
if (isset($_GET['id']))
{
$i = mysql_fetch_array(mysql_query("SELECT * FROM `book` WHERE id = '".$_GET['id']."'"));
if ($i['id'] == '') header('Location: ./shop_b.php');
echo '<b>'.$i['title'].'</b><div class="lin"></div>';
echo 'Информация: <br>';
echo '</b> мудрость:'.'<b>'.$i['mudrost'].'</b> <br />';
echo '</b> страниц: '.'<b>'.$i['time'].'</b><br />';
echo '<b>'.$i['cost'].'</b> септимов ('.$u['money'].')';
echo '<div class="lin"></div>';
echo '<a href="?a=buy_b&id='.$i['id'].'">Купить</a><br />';
echo '<a href="?a=show&sort=id">Вернуться</a><br />';
}
break;
}
echo '</div>';
} else header('Location: ./world.php');
}
else
{
header('Location: ./index.php');
}
include './include/foot.php';
?>