File size: 7.74Kb
<?php
/****************************************************************************
* Скрипт распространяется "как есть", за неправильную работу скрипта автор
* ответственности не несет
* Не будь жмотом - поддержи российского производителя материально!!!
* R412172408556
****************************************************************************/
$page=$HTTP_GET_VARS['page'];
require "inc.php";
$myid=$_COOKIE["usid"];
$mypass=$_COOKIE["pass"];
$db=mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
if (!isset($myid)) $myid=1;
if (!isset($mypass)) $mypass=0;
$sqlc="select * from users where usid=$myid";
$c=mysql_query($sqlc);
$resc=mysql_fetch_array($c);
if ($resc[pass]!=$mypass)
{
setcookie("usid", 0);
setcookie("pass", 0);
}
if (!isset($page))
{
$page=1;
}
echo"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
echo"<html>\n";
echo"<head>\n";
echo"<title></title>\n";
echo"<link rel=\"Alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"rss.php\" />";
echo"<meta name=\"description\" content=\"\">\n";
echo"<meta name=\"keywords\" content=\"\">\n";
echo"</head>\n";
echo"<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#006699\" vlink=\"#006699\" alink=\"#006699\">\n";
echo"<STYLE type=\"text/css\">\n";
echo"A {text-decoration: none;}\n";
echo"body\n";
echo"{\n";
echo"margin-left: 1%;\n";
echo"margin-right: 1%;\n";
echo"font-family: Arial, Helvetica, sans-serif;\n";
echo"font-size: 10pt;\n";
echo"background-color: #F0F0F0;\n";
echo"}\n";
echo"</STYLE>\n";
include "top.php";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV>\n";
echo"<TABLE width=100% bgcolor=\"#F0F0F0\" border=0 cellpadding=5 bordercolor=\"#000000\" cellspacing=1>\n";
echo" <TR valign=top>\n";
echo" <TD>\n";
echo" <FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo" <DIV><a href=\"..\">[Main page]</a> <b>[Forum</b>";
if ($resc[usid]>0) echo "<a href=\"newtop.php\">(New Topic)</a>";
echo"<b>]</b></DIV>\n";
echo" </FONT>\n";
echo" </TD>\n";
echo" <TD>\n";
echo" <FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo" <DIV align=\"right\">\n";
$from=30*($page-1);
$sql2="select * from forum";
$res2=mysql_query($sql2);
$a=mysql_num_rows($res2);
$b=ceil($a/30);
if ($b!=1)
{
for ($i=1; $i<=$b; $i++)
{
if ($i!=$page)
{
echo "<a href=index.php?page=$i>";
}else echo "<b>[";
echo "$i";
if ($i!=$page)
{
echo "</a>";
}else echo "]</b>";
echo " ";
}
}
if ($resc[usid]>0)
{
echo " <a href=\"logout.php\">Logout($resc[name])</a>\n";
echo " <a href=\"profile.php\">Profile</a>\n";
}else
{
echo " <a href=\"login.php\">Login</a>\n";
echo " <a href=\"reg.php\">Register</a>\n";
}
echo" </DIV>\n";
echo" </FONT>\n";
echo" </TD>\n";
echo" </TR>\n";
echo" </TABLE>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV><TABLE width=100% border=1 cellpadding=1 bordercolor=\"#222288\" cellspacing=0>\n";
echo"<TR valign=top>\n";
echo"<TD>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV>\n";
echo"<TABLE width=100% bgcolor=\"#FFFFFF\" border=0 cellpadding=5 bordercolor=\"#000000\" cellspacing=1>\n";
echo"<TR valign=top>\n";
echo"<TD bgcolor=\"#8B93A0\" width=70%>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><FONT color=\"#000000\"><b>Topics</b></FONT></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD bgcolor=\"#8B93A0\" width=6%>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><FONT color=\"#000000\"><b>Replies</b></FONT></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD bgcolor=\"#8B93A0\" width=6%>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><FONT color=\"#000000\"><b>Author</b></FONT></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD bgcolor=\"#8B93A0\" width=6%>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><FONT color=\"#000000\"><b>Views</b></FONT></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD bgcolor=\"#8B93A0\" width=12%>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><FONT color=\"#000000\"><b>Date</b></FONT></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"</TR>\n";
$from=30*($page-1);
$sql2="select * from forum";
$res2=mysql_query($sql2);
$a=mysql_num_rows($res2);
$b=ceil($a/30);
$sql="select * from forum order by 'pid' desc limit $from,29";
$res=mysql_query($sql);
while($result=mysql_fetch_array($res))
{
$nm=mysql_num_rows($res);
$sqlus="select * from users where usid='$result[usid]'";
$us=mysql_query($sqlus);
$rus=mysql_fetch_array($us);
$topic=$result['topic'];
$sqlr="select * from replies where pid='$result[pid]'";
$ar=mysql_query($sqlr);
$replies=mysql_num_rows($ar);
$date=$result['date']." ".$result['time'];
echo"<TR valign=top>\n";
echo"<TD height=16 bgcolor=\"#CFD7E4\">\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV>";
if ($resc[usid]==1)
{
$pg=$page;
if ($nm==1) $pg=$pg-1;
if ($pg==0) $pg=1;
echo "<FONT size=1 color=\"#000000\" face=\"Arial\"><a href=\"deltop.php?pid=$result[pid]&page=$pg\">[delete]</a></font> ";
}
echo"<a href=\"viewtop.php?pid=$result[pid]\">$topic</a></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\">$replies</DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD height=16 bgcolor=\"#BEC6D3\"><FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><a href=mailto:$rus[email]>$rus[name]</a></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\">$result[views]</DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"<TD height=16 bgcolor=\"#BEC6D3\"><FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV align=\"center\"><small>$date</small></DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"</TR>\n";
}
echo "</table>\n";
echo"</TABLE>\n";
echo"</DIV>\n";
echo"</FONT>\n";
echo"</TD>\n";
echo"</TR>\n";
echo"</TABLE>\n";
echo"</DIV>\n";
echo"</FONT>\n";
echo"<FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo"<DIV>\n";
echo"<TABLE width=100% bgcolor=\"#F0F0F0\" border=0 cellpadding=5 bordercolor=\"#000000\" cellspacing=1>\n";
echo" <TR valign=top>\n";
echo" <TD>\n";
echo" <FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo" <DIV><a href=\"..\">[Main page]</a> <b>[Forum</b>";
if ($resc[usid]>0) echo "<a href=\"newtop.php\">(New Topic)</a>";
echo "<b>]</b></DIV>\n";
echo" </FONT>\n";
echo" </TD>\n";
echo" <TD>\n";
echo" <FONT size=2 color=\"#000000\" face=\"Arial\">\n";
echo" <DIV align=\"right\">\n";
$from=30*($page-1);
$sql2="select * from forum";
$res2=mysql_query($sql2);
$a=mysql_num_rows($res2);
$b=ceil($a/30);
if ($b!=1)
{
for ($i=1; $i<=$b; $i++)
{
if ($i!=$page)
{
echo "<a href=index.php?page=$i>";
}else echo "<b>[";
echo "$i";
if ($i!=$page)
{
echo "</a>";
}else echo "]</b>";
echo " ";
}
}
echo" </DIV>\n";
echo" </FONT>\n";
echo" </TD>\n";
echo" </TR>\n";
echo" </TABLE>\n";
include "bottom.php";
echo"</body>\n";
echo"</html>\n";
?>