Файл: new_fanland/library.php
Строк: 67
<?php
###########################
# Данная версия скрипта принадлежит #
# LiraS aka Артур Лукин Иванович #
# Вносить свои изменения крайне #
# запрещенно! #
###########################
include("db.php");
include "cfg.php";
//Выбор статьи
function main()
{
echo '<div class="pt"><center>Библиотека</center></div>';
echo"<div class="main"><div class="in">"; pochta();
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM `library`"),0);
$whiel = mysql_query("SELECT id, title FROM `library`");
$lists = mysql_fetch_array($whiel);
if ($result == 0)
{ echo "--Статей нет--"; }
else{
do{
$lists['title'] = iconv("windows-1251","utf-8",$lists['title']);
printf("<a href="library.php?usr=$_GET[usr]&pwd=$_GET[pwd]&id=%s&lb=list_library">%s</a><br/>",$lists['id'],$lists['title']);
} while($lists = mysql_fetch_array($whiel));
}
echo"<br/>-----<br/>";
echo"<a href="main.php?usr=$_GET[usr]&pwd=$_GET[pwd]">В игру</a>";
}
//Сама статья!
function library_info()
{
$whiel = mysql_query("SELECT * FROM library WHERE id='$_GET[id]'");
$lists = mysql_fetch_array($whiel);
$lists['title'] = iconv("windows-1251","utf-8",$lists['title']);
$lists['text'] = iconv("windows-1251","utf-8",$lists['text']);
$lists['author'] = iconv("windows-1251","utf-8",$lists['author']);
echo '<div class="pt"><center>Библиотека</center></div>';
echo "<div class="main"><div class="in">"; pochta();
echo "Название: <b>$lists[title]</b><br/><small>Дата добавления: <b>$lists[time]</b></small><br/>";
echo "------------<br/>";
echo "$lists[text]<br/>Автор: <b>$lists[author]</b><br/>---------<br/>";
echo "<a href="library.php?usr=$_GET[usr]&pwd=$_GET[pwd]">назад</a><br/>";
echo "<a href="main.php?usr=$_GET[usr]&pwd=$_GET[pwd]">На главную</a>";
}
$db_connection = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_table, $db_connection);
mysql_query('SET NAMES cp1251');
$exist = mysql_num_rows(mysql_query("SELECT usr, pwd FROM users WHERE usr = '".mysql_real_escape_string($_GET['usr'])."' AND pwd = '".mysql_real_escape_string($_GET['pwd'])."'"));
$online = mysql_num_rows(mysql_query("SELECT * FROM online WHERE laikas > '$timeout'"));
$year = date("Y.m.d");
$times = date("H:i");
$vremechko = "$year $times";
$subt = file_get_contents("max_on.dat");
$max = explode("|", $subt);
$max_onl = $max[0];
$max_on_time = $max[1];
if ($online >= $max_onl)
{
$fp55 = fopen("max_on.dat", 'w');
fwrite($fp55, "$online|$vremechko|");
fclose($fp55);
}
if($exist == 1)
{
include("on.php");
if($_GET['lb'] == "")
{
$set['title']='Библиотека';
head();
title ();
main();}
elseif($_GET['lb'] == "list_library")
{
$whiel = mysql_query("SELECT * FROM library WHERE id='$_GET[id]'");
$lists = mysql_fetch_array($whiel);
$lists[title] = iconv("windows-1251","utf-8",$lists['title']);
$set['title']='Библиотека - '.$lists['title'].'';
head();
title();
library_info();}
}
else
{
echo "<div class="main"><div class="in">"; pochta();
echo "Вы не зарегистрированны!!!<br/>";
echo "<br/>";
}foot();
mysql_close($db_connection);
?>