Просмотр файла forum/findus.php

Размер файла: 2.98Kb
<?
session_start();
include ("header.php");
$date=date("Ymd");
$data=$autorize['lasttime'];
           $forums="Общий форум";

           if (!$autorize) {
           echo $div["header"];
           echo "[<a href=\"login.php?".session_name()."=".session_id()."\">Вход</a>][<a href=\"reg.php\">Регистрация</a>]<br/>";
           echo $div["end"];
           }
           echo $div["header"];
           echo "[<a href=\"index.php?".session_name()."=".session_id()."\">Список форумов</a>]<br/>";
           echo $div["end"];
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "-<br/>";}
           if(empty($start)) $start = 0;
           $start=intval($start);
           if($start<0) $start=0; $num_msgs=10;

           $arrmsg = mysql_query("select * from messages where (`who`='$user');");
           $imsg=mysql_fetch_array($arrmsg);
           $idmsg=$imsg['id'];
           echo $div["end"];
           if (mysql_affected_rows()==0)
           {
           echo $div["ten"];
           echo "Нет ответов юзера...<br/>";
           echo $div["end"];
           }
           else
           {
           $arr = mysql_query("SELECT DISTINCT * from forum,messages where ((forum.themes=messages.themes)and(messages.who='$user'));");
           $q = mysql_query("SELECT DISTINCT * from forum,messages where ((forum.themes=messages.themes)and(messages.who='$user')) order by messages.id desc limit $start,$num_msgs;");
           $reg=mysql_num_rows($arr);
           echo "Ответы юзера в темах:<br/>";
           echo $div["ten"];
           while ($field=mysql_fetch_array($q))
           {
           $forum=$field['1'];
           $podforum=$field['2'];
           $tema=$field['3'];
           $id=$field['0'];
           $idmsg=$field['id'];
           $who=$field['7'];
           $qi = mysql_query("select * from messages where ((forums='$forum')and(podforums='$podforum')and(themes='$tema'));");
           $row=mysql_fetch_array($qi);
           $i=mysql_num_rows($qi);
           $max_lines_on_page=$autorize['postmsg'];
           $all=$i;
           $maxpage=ceil($all/$max_lines_on_page);
           echo "$forum » $podforum » <a href=\"postslist.php?postp=$idmsg&amp;p=$id&amp;".session_name()."=".session_id()."\">$tema</a>[$i] $who <br/>";
           }
             $i = @mysql_num_rows($arr);
             if($start!=0)
             echo "<a href=\"findus.php?user=$user&amp;".session_name()."=".session_id()."&amp;start=".($start-$num_msgs)."\">".htmlspecialchars("<<--")."</a><br/>";
             if($i>$start+$num_msgs)
             echo "<a href=\"findus.php?user=$user&amp;".session_name()."=".session_id()."&amp;start=".($start+$num_msgs)."\">".htmlspecialchars("-->>")."</a><br/>";
           echo $div["end"];
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "-<br/>";}
           echo $div["end"];

include ("footer.php");
?>