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

Размер файла: 51.78Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
function myErrorHandler ($errno, $errstr, $errfile, $errline) {}
set_error_handler("myErrorHandler");
header("Content-type:text/html; charset=utf-8");
include("core.php"); //load main functions
include("conf.php"); //load config
echo $style;
echo connect($dbuser,$dbpass,$dbserver,$dbname);
$action=$_GET["action"];
$id=$_GET["id"];
$nick=$_GET["nick"];
$pass=$_GET["pass"];
if (!$logged) $permissions=0; else {$permissions1=mysql_fetch_array(
        mysql_query("SELECT status FROM users WHERE name='".$nick."'"));
        $permissions=$permissions1[0];}
if ($banned) $permissions=0;
slogin($nick,$pass);
global $logged;
if ($logged) {echo onlineadd($_GET["nick"]);
 $phone = explode(" ",$HTTP_USER_AGENT);
                                                        $phone = $phone[0];
 $phnupdated=mysql_query("UPDATE users SET tlphone='".$phone."' WHERE name='".$nick."'"); }
//##################################
        if ($action=="")                   {
        echo "<div>";
        $page=$_GET["page"];
        if (!isset($page)) $page=1;
              $forstot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM forums"));
              $forstot[0]=$forstot[0];
              $forstot=ceil($forstot[0]/20);

              if ($forstot==0) $forstot=1;
        echo login($nick,$pass);                                          //Let's login!
        echo addvisitor();
        echo "<br/>";
        echo isadmin($nick,$pass);
	print "";
        global $administrator;
        if ($logged){                                                     //User zone!
        $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE unread='y' AND sentto='".$nick."'"));
        $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE sentto='".strtolower($nick)."'"));
        $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
        echo "<a href=\"index.php?action=login\"><font color=\"#FFFF00\">Войти заново</font></a><br/>";  //Maybe we want to change our user?..
        echo "<a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FF0000\">Входящие$unrd</font></a><br/>";
        echo "<a href=\"index.php?action=usercp&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FF00FF\">Изменить профиль</font></a><br/>";
        echo "<a href=\"index.php?action=viewuser&amp;nick=$nick&amp;pass=$pass&amp;who=$nick\"><font color=\"#00FF00\">Показать профиль</font></a><br/>";
                    }
        if (!$logged){                                                    //if login failed
           echo "<a href=\"index.php?action=register\"><font color=\"#00FFFF\">РегиCрация</font></a><br/>";//New here? Register!
           echo "<a href=\"index.php?action=login\"><font color=\"#FF0000\">Вход</font></a><br/>"; //Let us login the community
                     }
        if ($logged) {                                                    //If we are logged, get the permissions!
           $permissions1=mysql_fetch_array(
           mysql_query("SELECT status FROM users WHERE name='".$nick."'"));
           $permissions=$permissions1[0];
                     } else $permissions=0;
                     ismod2($nick,$pass);
                     global $moderator;
                     $kiekmodloge=mysql_fetch_array(mysql_query("SELECT MAX(id) FROM log"));
                     if ($moderator) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FFFF00\">ModLOG($kiekmodloge[0])</font></a><br/>";
////////////////////////////////////////////
//few empty lines...
        getforums($permissions,$nick,$pass,$page);                         //here are our forums...
        $pgnxt=$page+1;
///////////////////////////////////////
        if ($page<$forstot) echo "<a href=\"index.php?nick=$nick&amp;pass=$pass&amp;page=$pgnxt\"><font color=\"#FF00FF\">Next&gt;&gt;</font></a><br/>";
             // $page=$page-2;
             $pgpwz=$page-1;
              if ($page>1) echo "<a href=\"index.php?nick=$nick&amp;pass=$pass&amp;page=$pgpwz\"><font color=\"#FFFF00\">&lt;&lt;Back</font></a><br/>";
             // $page=$page+1;
        echo "";                                                //some breaks...
        echo "<a href=\"index.php?action=search&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FF0000\">Поиск</font></a><br/>";
        echo "<a href=\"index.php?action=statistics&amp;nick=$nick&amp;pass=$pass\"><font color=\"#00FFFF\">Статистика</font></a><br/>";
        echo "<a href=\"index.php?action=smilies&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#00FF00\">Смайлы</font></a><br/>";
        echo "<a href=\"index.php?action=faq&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FF00FF\">Помощь</font></a><br/>";
        echo "<a href=\"index.php?action=rules&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FFFF00\">Правила</font></a><br/><br/>";
      
	print "";
        echo onlineget($nick,$pass);
	print "";
        if ($administrator) {
                        echo "<br/><a href=\"index.php?action=admincp&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FF0000\">Админка</font></a><br/>";
                            }

        echo "<br/><br/><font color=\"#FF0000\">&#169; PIZDEC.RU</font></div></body></html>";                                                      //end of text
                                                   //end of main card
                                           }
//#########################################

        if ($action=="viewforum")           {                             //let's have a look @ forum
        $forumnameasasas=mysql_fetch_array(mysql_query("SELECT name FROM forums WHERE id='".$id."'"));
        global $timezone;
        $valandos=date("H")+$timezone;
        if ($valandos>23) $valandos=$valandos-24;
        $valandos=$valandos.":".date(i);
        $data=date("d.m.y");
        echo "<div>";

        echo "<font color=\"#FF0000\">Сегодня $data</font><br/>";
        echo ismod($nick,$pass,$id);
        global $moderator;
        if ($moderator) echo "<font color=\"#FFFFFF\">Hello moderator!</font><br/>";
              $letssee=false;
               $fperms=mysql_fetch_array(mysql_query("SELECT perms FROM forums WHERE id='".$id."'"));

                  if ($fperms[0]=="0") {$letssee=true;}
                  if ($fperms[0]=="1") {$letssee=true;}
                  if ($fperms[0]=="2") {
                          $forribdforums=mysql_query("SELECT forum FROM permissions WHERE name='".$nick."'");
                           while ($frumas=mysql_fetch_array($forribdforums)) {
                            if ($frumas[0]==$id or $frumas[0]=="*") {
                            $letssee=true;
                           }}
                          }

           if ($letssee) {
              echo "<a href=\"index.php?action=newthread&amp;id=$id&amp;nick=$nick&amp;pass=$pass\"><font color=\"#00FFFF\">[Новая тема]</font></a>";
              echo getposts($id,$nick,$pass,$page);
              $page=$page+1;
              $poststot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM posts WHERE forum='".$id."' AND thread='1'"));
              $poststot[0]=$poststot[0];
              $poststot=ceil($poststot[0]/15);
              if ($page<$poststot+1) echo "<a href=\"index.php?action=viewforum&amp;id=$id&amp;nick=$nick&amp;pass=$pass&amp;page=$page\"><font color=\"#00FFFF\">Далее &gt;&gt;</font></a><br/>";
              $page=$page-2;
              if ($page>0) echo "<a href=\"index.php?action=viewforum&amp;id=$id&amp;nick=$nick&amp;pass=$pass&amp;page=$page\"><font color=\"#FFFF00\">&lt;&lt; Назад</font></a><br/>";
$page=$page+1;
if ($poststot==0) $poststot=1;
              echo slogin($nick,$pass);
              echo "<font color=\"#FF0000\">Страница: $page/$poststot</font><br/>";
              if ($poststot>2){
              print "<font color=\"#00FF00\">Перйти на</font>";
              echo "<form method=\"post\" action=\"index.php?action=viewforum&amp;id=$id&amp;nick=$nick&amp;pass=$pass\">";
              print "<input type=\"text\" name=\"page\" value=\"$page\" maxlength=\"3\" size=\"3\"/> ";
              echo "<input type=\"submit\" value=\"Cтр\" /></form><br/>";

              }

       global $logged;
        if ($logged) {
                $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE unread='y' AND sentto='".$nick."'"));
                if ($unreadinbox[0]>0) {
        $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE sentto='".strtolower($nick)."'"));
        $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
        echo "<a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FF0000\">Входящие$unrd</font></a><br/>";
        }}

              
              echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#00FF00\">Хуерумы</font></a>";
            } else echo "Просмотр невозможен!<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#00FF00\">Хуерумы</font></a>";
        echo "<br/><br/><font color=\"#FF0000\">&#169; PIZDEC.RU</font></div></body></html>";


                                           }
   //#######################################
        if ($action=="register")           {                             //Time to register!
        echo "<div>";
        echo "<font color=\"#FF0000\">Регистрация</font><br/>";
        echo "<font color=\"#FF0000\">Спец-символы и пробелы автоматически удаляются из логина и пароля!<br/>В логине и пароле разрешены только знаки латинского алфавита</font>";
        echo"<form method=\"post\" action=\"register.php\">";
        
        echo"<font color=\"#FF00FF\">Логин:</font><br/><input name=\"userreg\" maxlength=\"50\" value=\"\"/><br/>";
        echo"<font color=\"#00FF00\">Пароль:</font><br/><input name=\"passreg\" maxlength=\"30\" value=\"\"/><br/>";
        echo"<font color=\"#FFFF00\">Повторить пароль:</font><br/><input name=\"passreg2\" maxlength=\"30\" value=\"\"/><br/>";
      echo"<font color=\"#FF00FF\">Введите число: "; include_once"brow.dat"; echo"</font><br/><input name=\"chis\" maxlength=\"6\" value=\"\"/><br/><br/><input value=\"Регистрация\" name=\"do\" type=\"submit\"/></form></div><div align=\"left\"><br/>";
        echo "<hr/><a href=\"index.php\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
        echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a>";
        
       
        echo "</div>";
        echo "</body></html>";
                                           }
//#############################################
       if ($action=="login")           {                                //This is how login done =]

        echo "<div>";
          echo "<font color=\"#FF0000\">Страничка авторизации</font>";
        echo "<form method=\"post\" action=\"login.php\">";
        echo "<font color=\"#00FF00\">Псевдонах:</font><br/><input name=\"userreg\" type=\"text\" value=\"\" maxlength=\"20\"/><br/>";
        echo "<font color=\"#00FFFF\">Шифр:</font><br/><input  name=\"passreg\" type=\"password\" value=\"\" maxlength=\"12\" /><br/><br/>";
        echo "<input type=\"submit\" value=\"Войти\"/>";
        echo "</form></div><div><hr/><a href=\"index.php\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
        echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
//##############################################
       if ($action=="newthread")           {                            //Some threads...
        echo "<div>";
        echo "Новая тема";
        
        $lastpostt=mysql_fetch_array(mysql_query("SELECT lastthread FROM users WHERE name='".$nick."'"));
              global $antiflood2;
              if (time() < $lastpostt[0]+$antiflood2) { echo "<font color=\"#FF0000\">FloodControl: "; echo $antiflood2-(time()-$lastpostt[0]); echo "</font><br/>";} else {
       echo "</div><div class=\"blue\"><form method=\"post\" action=\"newthread.php?nick=$nick&amp;pass=$pass&amp;forumas=$id\">";
        echo "<font color=\"#FF0000\">Заголовок:</font><br/>
        <input name=\"tname\" type=\"text\"  size=\"20\"  maxlength=\"40\" value=\"\"/><br/><br/>";
        echo "<font color=\"#00FF00\">Пиздеж:</font><br/><textarea name=\"ttext\" cols=\"20\" rows=\"5\"></textarea>";
        echo "<br/><br/><input type=\"submit\" value=\"Cоздать\"/></form></div><div>";
        }
        echo "<br/><hr/><a href=\"index.php\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
        echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
       //#######################################
                                           }
        if ($action=="viewpost")   {
        echo "<div>";
         $idp=htmlspecialchars($idp);
        $name=mysql_fetch_array(mysql_query("SELECT name FROM posts WHERE id='".$idp."' AND forum='".$forumas."'"));
        $name=$name[0];
        $namedec=$name;
        $names=base64_encode($name);
        $name=htmlspecialchars($name);
        $page=htmlspecialchars($page);
        $poststot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM posts WHERE name='".$namedec."'"));
        $poststot[0]=$poststot[0];
        $poststot=ceil($poststot[0]/10);
        $lastpostt=mysql_fetch_array(mysql_query("SELECT lastpost FROM users WHERE name='".$nick."'"));
              global $antiflood;
              if (time() < $lastpostt[0]+$antiflood) { echo "<font color=\"#FF0000\">FloodControl: "; echo $antiflood-(time()-$lastpostt[0]); echo "</font><br/>";}
        echo "<a href=\"index.php?action=postreply&amp;nick=$nick&amp;pass=$pass&amp;idp=$idp&amp;forumas=$forumas\"><font color=\"#00FF00\">Добавить</font></a><br/>";

        
        
        
        
        if ($read=="new") {echo "<a href=\"index.php?action=viewpost&amp;idp=$idp&amp;nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;read=old&amp;page=1\"><font color=\"#FFFF00\">С начала</font></a><br/><br/>";
              echo getpost($nick,$pass,$namedec,"new",$page,$id,$forumas,$poststot,$idp);
              echo "<br/><font color=\"#FF0000\">Страница: $page/$poststot</font><br/>";
              print "<font color=\"#FF00FF\">Перйти на</font>";
              echo "<form method=\"post\" action=\"index.php?action=viewpost&amp;idp=$idp&amp;nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;read=new&amp;page=$page\">";
              print "<input type=\"text\" name=\"page\" value=\"$page\" maxlength=\"3\" size=\"3\"/> ";
              echo "<input type=\"hidden\" name=\"idp\" value=\"$idp\"/>";
              echo "<input type=\"submit\" value=\"Стр\" /></form><br/>";
              }
        if ($read=="old") {echo "<a href=\"index.php?action=viewpost&amp;idp=$idp&amp;nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;read=new&amp;page=1\"><font color=\"#FFFF00\">С конца</font></a><br/><br/>"; echo getpost($nick,$pass,$namedec,"old",$page,$id,$forumas,$poststot,$idp);
              echo "<br/><font color=\"#FF00FF\">Страница: $page/$poststot</font><br/>";
              print "<font color=\"#FF0000\">Перейти на</font>";
              echo "<form method=\"post\" action=\"index.php?action=viewpost&amp;idp=$idp&amp;nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;read=old&amp;page=$page\">";
              print "<input type=\"text\" name=\"page\" value=\"$page\" maxlength=\"3\" size=\"3\"/> ";
              echo "<input type=\"hidden\" name=\"idp\" value=\"$idp\"/>";
              echo "<input type=\"submit\" value=\"Стр\"/></form><br/>";
        }
        if ($poststot==0) $poststot=1;
        ismod($nick,$pass,$forumas);
        global $moderator;
                echo slogin($nick,$pass);
        global $logged;
        if ($logged) {
                $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE unread='y' AND sentto='".$nick."'"));
                if ($unreadinbox[0]>0) {
        $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE sentto='".strtolower($nick)."'"));
        $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
        echo "<a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FF0000\">Входящие$unrd</font></a><br/>";
        }}
        if ($moderator) echo "<a href=\"index.php?action=modcp&amp;nick=$nick&amp;pass=$pass&amp;idp=$idp&amp;forumas=$forumas\"><font color=\"#FFFFFF\">[Модерка]</font></a>";
        echo "<br/><a href=\"index.php?action=viewforum&amp;nick=$nick&amp;pass=$pass&amp;id=$forumas&amp;page=1\"><font color=\"#00FF00\">Назад в хуерум</font></a><br/>";
        echo "<a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FF0000\">Хуерумы</font></a><br/>";
      echo "</div></body></html>";
                                           }
//############################################
                                           
        if ($action=="postreply")           {
        echo "<div>";
        $idp=htmlspecialchars($idp);
        $name=mysql_fetch_array(mysql_query("SELECT name FROM posts WHERE id='".$idp."' AND forum='".$forumas."'"));
        $name=$name[0];
       $lastpostt=mysql_fetch_array(mysql_query("SELECT lastpost FROM users WHERE name='".$nick."'"));
              global $antiflood;
              if (time() < $lastpostt[0]+$antiflood) { echo "<font color=\"#FF0000\">FloodControl: "; echo $antiflood-(time()-$lastpostt[0]); echo "</font><br/>";}
        echo "<form method=\"post\" action=\"newreply.php?nick=$nick&amp;pass=$pass&amp;forumas=$forumas\" ><div class=\"blue\">";

        echo "Текст<br/>";
        echo "<textarea name=\"ttext\" cols=\"20\" rows=\"5\"></textarea>";
         echo "<input type=\"hidden\" name=\"idp\" value=\"$idp\"/>";
        echo "<br/><br/><input type=\"submit\" value=\"Добавить\"/></div><div><br/>";

        echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FF0000\">Хуерумы</font></a>";
        echo "</div></form></div></body></html>";
                                           }
//########################################
        if ($action=="viewuser")           {                             //User stats & other info
        echo "<div>";
        echo viewuser($who,$nick,$pass);
        echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FF0000\">Хуерумы</font></a><br/>";
        echo "</div></body></html>";
        
                                           }
//########################################
        if ($action=="faq")
          {
 echo "<div>
<br/><font color=\"#FFFF00\">1)Чтобы написать жирный текст пишите </font><font color=\"#FF0000\">[b]Текст[/b]</font><font color=\"#FFFF00\">, чтобы добавить ссылку пишите </font><font color=\"#FF0000\">[a]http://ссылка[/a]</font><font color=\"#FFFF00\">, чтобы добавить изображение пишите </font><font color=\"#FF0000\">[img]ссылка[/img]</font><font color=\"#FFFF00\">.
<br/>2)После перехода по ссылке вы попадете на страничку с которой сможете перейти на указанный адрес.
<br/>3)Изображения при вставке масштабируется до высоты 40 пикселей, максимальная ширина 80 пикселей.
<br/>4)Чтоб добавить смайл просто надо написать текст который соответствует данному смайлу.
<br/>5)Для каждого раздела сайта существуют свои правила, рекомендуем почитать их, чтобы потом не возникало лишних вопросов.
<br/>6)Общие правила поведения на форуме можете почитать  </font><a href=\"index.php?action=rules&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FF0000\">здесь</font></a><font color=\"#FFFF00\">.
<br/> 7)Все возникщие у вас вопросы и пожелания пишите в разделе Администрация.</font>";
echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
        
        }
        
        
if ($action=="rules")
{
 echo "<div>
<font color=\"#00FF00\">Правила Хуерума</font><br/><br/>
<font color=\"#FF0000\">Только у нас, приветствуется:</font><font color=\"#FFFF00\">
<br/>1. Употребление ненормативной лексики в сообщениях и никах (именах).
<br/>2. Оскорбление участников форума, его создателей и мудераторов.
<br/>3. Плагиат ников (имен).
<br/>4. Пропаганда насилия, националистических и политических лозунгов, извращений, преднамеренное создание конфликтных ситуаций.
<br/>5. Размещение сообщений, соответствующих тематике подфорума.
<br/>6. Превращение форума в чат.</font>";
echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";}
//############################################
        if ($action=="usercp")           {
        echo "<div>";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged) {
          echo usercpget($nick,$pass);
        } else echo "<font color=\"#FF0000\">Войдите в систему, прежде чем получать доступ к изменению профиля!</font>";
      echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
//############################################
        if ($action=="private")           {                             //Inbox
        echo "<div><font color=\"#00FFFF\">Внутренняя почта</font><br/><br/>";
        $pmtot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM private WHERE sentto='".strtolower($nick)."'"));
        $pmtot[0]=$pmtot[0]-1;
        $pmtot=ceil($pmtot[0]/5);
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged)
                  {
        echo private($nick,$pass,$page);
        echo "<br/>";
        $pagefrw=$page+1;
        $pagepws=$page-1;
        if ($page<$pmtot+1) echo "<a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\"><font color=\"#00FFFF\">Вперед</font></a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\"><font color=\"#00FF00\">Назад</font></a><br/>";
        $page=$page+2;
        $pmtot=$pmtot+1;
       // if ($pmtot==0) $pmtot=1;
        echo "<font color=\"#FF00FF\">Страница: $page/$pmtot</font>";
       
        echo "<form method=\"post\" action=\"index.php?action=sendpmcst&amp;nick=$nick&amp;pass=$pass\" >";
        echo "<font color=\"#FFFF00\">Кому:</font><br/>
        <input name=\"who\" type=\"text\"  size=\"20\"  maxlength=\"40\" value=\"\"/><br/>";
        echo "<br/><input type=\"submit\" value=\"Написать\"/>";
        echo "</form>";
                  } else echo "<font color=\"#FF0000\">Пройдите авторизацию!</font>";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
       
                                           }
//######################################
        if ($action=="sendpm")           {                             //Send the PM!
        echo "<div>";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged)
                  {
               $lastpostt=mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM private WHERE sentby='".$nick."'"));
              global $pmantiflood;
             if (time() < $lastpostt[0]+$pmantiflood) { echo "<font color=\"#FF0000\">FloodControl: "; echo $pmantiflood-(time()-$lastpostt[0]); echo "</font><br/>";}
        echo "<font color=\"#00FF00\">Кому: $who</font><br/>";


         echo "<form method=\"post\" action=\"sendpm.php?nick=$nick&amp;pass=$pass&amp;who=$who\">";
        echo "<font color=\"#FFFF00\">Сообщение:</font><br/>
        <input name=\"ttextas\" value=\"\" type=\"text\"  size=\"20\"  maxlength=\"200\" /><br/>";
        echo "<br/><input type=\"submit\" value=\"Написать\"/>";
        echo "</form>";
                  } else echo "<font color=\"#FF0000\">Пройдите авторизацию!</font>";
       echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
        
                                           }
//######################################
        if ($action=="readpm")           {                             //Read PM
        echo "<div>";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged)
                  {
                   echo readpm($nick,$pass,$pm);
                  } else echo "<font color=\"#FF0000\">Войдите на форум до чтения ваших приватных сообщений!</font>";
        echo "<br/><br/><a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#00FF00\">: Входящие</font></a><br/>";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
//#####################################
        if ($action=="statistics")           {                         //forum stats
        $baninfo=mysql_query("SELECT banto, name FROM users WHERE banned='1'");
        while ($unbanazz=mysql_fetch_array($baninfo))
        {
        if ($unbanazz[0]-time()<0) mysql_query("UPDATE users SET banned='0' WHERE name='".$unbanazz[1]."'");
        };
        echo "<div>";
        echo stats($nick,$pass);
        $numeriukas=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users"));
        echo "<br/><a href=\"index.php?action=memberlist&amp;nick=$nick&amp;pass=$pass&amp;whattoget=id&amp;page=1\"><font color=\"#FFFF00\">Хуеплеты($numeriukas[0])</font></a><br/>";
         isadmin($nick,$pass);
        global $administrator;
        $numeriukas=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM moderators"));
        echo "<a href=\"index.php?action=listmods&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#00FF00\">Мудераторы($numeriukas[0])</font></a><br/>";
        $numeriukas=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM administrators"));
        echo "<a href=\"index.php?action=listadmins&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FF0000\">Батьки($numeriukas[0])</font></a><br/>";
        $numeriukas=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users WHERE banned='1'"));
        echo "<a href=\"index.php?action=listbanned&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#00FFFF\">Заебанные($numeriukas[0])</font></a><br/>";
        echo "<a href=\"index.php?action=listtop&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FF00FF\">Топ хуеплетов</font></a><br/>";
        $numeriukas=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM permissions"));
        if ($administrator) echo "<a href=\"index.php?action=listperms&amp;nick=$nick&amp;pass=$pass&amp;page=1\"><font color=\"#FFFFFF\">Permissions($numeriukas[0])</font></a><br/>";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";


                                           }
//######################################
        if ($action=="memberlist")           {                         //forum stats
        echo "<div>";
        $memtot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users"));
        $memtot[0]=$memtot[0]-1;
        $memtot=ceil($memtot[0]/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo "<a href=\"index.php?action=memberlist&amp;nick=$nick&amp;pass=$pass&amp;whattoget=id&amp;page=1\">Сортировка по дате регистрации</a><br/>";
        echo "<a href=\"index.php?action=memberlist&amp;nick=$nick&amp;pass=$pass&amp;whattoget=name&amp;page=1\">Сортировка по имени</a><br/>";
        echo "<br/>";
        echo membersget($nick,$pass,$whattoget,$page);
        if ($page<$memtot) echo "<a href=\"index.php?action=memberlist&amp;nick=$nick&amp;pass=$pass&amp;whattoget=$whattoget&amp;page=$pagefrw\">Вперед</a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=memberlist&amp;nick=$nick&amp;pass=$pass&amp;whattoget=$whattoget&amp;page=$pagepws\">Назад</a><br/>";
        $page=$page+2;
        echo "Страница: $page/$memtot<br/>";
        if ($memtot==0) $memtot=1;
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
//##################################
        if ($action=="search")           {                         //search posts and threads
        echo "<div>";
        echo "<form method=\"post\" action=\"search.php?nick=$nick&amp;pass=$pass&amp;page=1\" >";
        echo "<font color=\"#FF0000\">Поиск по ключевому слову</font><br/><br/><font color=\"#FFFF00\">Введите слово:</font><br/>
        <input name=\"ttextas\" type=\"text\"  size=\"20\"  maxlength=\"40\" value=\"\"/><br/>";
        echo "<input type=\"hidden\" name=\"idp\" value=\"$idp\"/>";
        echo "<br/><input type=\"submit\" value=\"Найти\"/>";
        echo "</form>";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
        echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
//#################################
        if ($action=="online")           {
        echo "<div><font color=\"#FFFF00\">Кто в Хуеруме</font><br/><br/>";
        $onlinetot=mysql_fetch_array(mysql_query("SELECT DISTINCT COUNT(*) FROM online WHERE username IS NOT NULL"));
        $onlinetot[0]=$onlinetot[0]-1;
        $onlinetot=ceil($onlinetot[0]/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo onlinelist($nick,$pass,$page);
        echo "<br/>";
        if ($page<$onlinetot) echo "<a href=\"index.php?action=online&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\"><font color=\"#FF0000\">Вперед</font></a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=online&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\"><font color=\"#00FF00\">Назад</font></a><br/>";
        $page=$page+2;
        if ($onlinetot==0) $onlinetot=1;
        echo "<font color=\"#FF00FF\">Страницы: $page/$onlinetot</font><br/>";
       echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="modcp")              {
        echo "<div style=\"text-align: left\">";
        ismod($nick,$pass,$forumas);
        global $moderator;
        if ($moderator)
           {
           $name=mysql_fetch_array(mysql_query("SELECT name FROM posts WHERE id='".$idp."' AND forum='".$forumas."'"));
           $text=mysql_fetch_array(mysql_query("SELECT text FROM posts WHERE id='".$idp."' AND forum='".$forumas."'"));
            echo "Модерирование <b>".htmlspecialchars(base64_decode($name));
            echo "</b> в форуме <b>$forumas</b><br/>";
            echo "<a href=\"close.php?nick=$nick&amp;pass=$pass&amp;idp=$idp;&amp;forumas=$forumas\">Закрыть</a><br/>";
            echo "<a href=\"open.php?nick=$nick&amp;pass=$pass&amp;idp=$idp;&amp;forumas=$forumas\">Открыть</a><br/>";
            echo "<a href=\"pin.php?nick=$nick&amp;pass=$pass&amp;idp=$idp;&amp;forumas=$forumas\">Заблокировать</a><br/>";
            echo "<a href=\"unpin.php?nick=$nick&amp;pass=$pass&amp;idp=$idp;&amp;forumas=$forumas\">Разблокировать</a><br/>";
            echo "<a href=\"delete.php?nick=$nick&amp;pass=$pass&amp;idp=$idp;&amp;forumas=$forumas\">Удалить</a><br/>";
            echo "Переименовать:<br/>";
           echo "<form method=\"post\" action=\"rename.php?nick=$nick&amp;pass=$pass&amp;idp=$idp;&amp;forumas=$forumas\" ><div class=\"d0\">";
        echo "Заголовок:<br/>
        <input name=\"rnm\" type=\"text\"  size=\"20\"  maxlength=\"40\" value=\"$name[0]\"/><br/>";
        echo "Сообщение<br/>";
        echo "<textarea name=\"rnm2\" cols=\"20\" rows=\"5\">$text[0]
        </textarea>";
        echo "<br/><br/><input type=\"submit\" value=\"Изменить\"/>";
        echo "</div></form>";
        } else echo "Нет прав для просмотра панели модера!";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                              }
//#######################################
        if ($action=="modlinks")              {
         echo "<div>";
        ismod($nick,$pass,$forumas);
        global $moderator;
        if ($moderator)
           {
           $msg=htmlspecialchars($msg);
        $post=mysql_fetch_array(mysql_query("SELECT name FROM posts WHERE id='".$msg."' AND forum='".$forumas."'"));
           $post=$post[0];
           
           
            echo "Moderating <b>$post";
            echo "</b> post number <b>$msg</b> at forum <b>$forumas</b><br/><br/>";
            echo "<a href=\"deletep.php?nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;id=$msg\">Delete</a><br/>";
             $postasss=mysql_fetch_array(mysql_query("SELECT text FROM posts WHERE id='".$msg."'"));
             echo "<form method=\"post\" action=\"edit.php?nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;id=$msg\" ><div class=\"d0\">";
             echo "<textarea name=\"rnm\" cols=\"20\" rows=\"5\">".htmlspecialchars($postasss[0])."
        </textarea>";
             
             
             echo "<br/><input type=\"submit\" value=\"Изменить\"/>";
        echo "</div></form>";
             
           } else echo "You are not allowed to view ModCP!";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
//########################################
        if ($action=="banuser")              {
         echo "<div>";
        ismod2($nick,$pass);
        global $moderator;
        if ($moderator)
           {
             echo "<font color=\"#FF0000\">BanCP for $who</font><br/><br/>";
             ismod3($who);
             global $moderator;
             if ($moderator) echo "<font color=\"#FF0000\">You cannot ban another moderator!</font>"; else {
             echo "<form action=\"ban.php?nick=$nick&amp;pass=$pass&amp;who=$who\" method=\"post\" ><div class=\"blue\">";
            

             echo "<font color=\"#FFFF00\">Забанить на:</font><br/>Дней:<input name=\"days\" maxlength=\"20\" value=\"0\" /><br/>";
             echo "<font color=\"#FF00FF\">Часов:</font><input name=\"hours\" maxlength=\"20\" value=\"2\" /><br/>";
             echo "<font color=\"#00FF00\">Минут:</font><input name=\"minutes\" maxlength=\"20\" value=\"0\" /><br/>";
             echo "<font color=\"#00FFFF\">Секунд:</font><input name=\"seconds\" maxlength=\"20\" value=\"0\" /><br/>";
             echo "<font color=\"#FF0000\">Причина:</font><input name=\"reason\" maxlength=\"255\" value=\"\"/><br/>";
              echo "<br/><input type=\"submit\" value=\"Забанить\" />";
        echo "</div></form>";
             }
           } else echo "<font color=\"#FF0000\">You are not allowed to view ModCP!</font>";
        echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="pluses")              {
        echo "<div>";
        ismod2($nick,$pass);
        global $moderator;
        if ($moderator)
           {
              echo "<font color=\"#FFFF00\">Добавить плюсов  $who</font><br/><br/>";
              echo "<form action=\"pluses.php?nick=$nick&amp;pass=$pass&amp;who=$who\" method=\"post\"  ><div class=\"blue\">";
              echo "<font color=\"#FF00FF\">Плюсов:</font><input name=\"pluses\" maxlength=\"20\"  value=\"".$pluses."\"/><br/>";
              echo "<font color=\"#00FF00\">Причина:</font><input name=\"reason\" maxlength=\"255\" value=\"\"/><br/>";
              
              echo "<br/><input type=\"submit\" value=\"OK\" />";
        echo "</div></form>";
         } else echo "<font color=\"#FF0000\">You are not allowed to view ModCP!</font>";
       echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="admincp")              {
        echo "<div>";
        isadmin($nick,$pass);
        global $administrator;
        if ($administrator)
           {
           echo "<font color=\"#FFFF00\">Панель админа для $nick</font><br/><br/>";
           echo "<a href=\"admin.php?action=addforum&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FF00FF\">Создать форум</font></a><br/>";
           echo "<a href=\"admin.php?action=delforum&amp;nick=$nick&amp;pass=$pass\"><font color=\"#00FF00\">Удалить форум</font></a><br/>";
           echo "<a href=\"admin.php?action=editforum&amp;nick=$nick&amp;pass=$pass\"><font color=\"#00FFFF\">Редактировать форум</font></a><br/>";
           echo "<a href=\"admin.php?action=reforum&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">Положения форумов</font></a><br/>";
           echo "<a href=\"admin.php?action=edituser&amp;nick=$nick&amp;pass=$pass\"><font color=\"#FF00FF\">Редактировать пользователя</font></a><br/>";
           echo "<a href=\"admin.php?action=bbcode&amp;nick=$nick&amp;pass=$pass\"><font color=\"#00FF00\">Добавить смайлы</font></a><br/>";
           } else echo "<font color=\"#FF0000\">Нет прав для просмотра панели админа!</font>";
             echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="smilies")              {
        echo "<div>";
        $bbtotal=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM smilies"));
        $bbtotal=$bbtotal[0]-1;
        $bbtotal=ceil($bbtotal/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo getbb($nick,$pass,$page);
        echo "<br/>";
        if ($page<$bbtotal) echo "<a href=\"index.php?action=smilies&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\"><font color=\"#00FFFF\">Вперед</font></a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=smilies&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\"><font color=\"#FFFF00\">Назад</font></a><br/>";
        $page=$page+2;
        if ($bbtotal==0) $bbtotal=1;
        echo "<font color=\"#FF00FF\">Страницы: $page/$bbtotal</font><br/>";
       echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="listmods")              {
        echo "<div>";
        echo "<font color=\"#00FF00\">Мудераторы:</font><br/>";
        $modtotal=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM moderators"));
        $modtotal=$modtotal[0]-1;
        $modtotal=ceil($modtotal/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo listmods($nick,$pass,$page);
        echo "<br/>";
        if ($modtotal==0) $modtotal=1;
          if ($page<$modtotal+1) echo "<a href=\"index.php?action=listmods&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\"><font color=\"#00FFFF\">Вперед</font></a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=listmods&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\"><font color=\"#FFFF00\">Назад</font></a><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "<font color=\"#FF00FF\">Страницы: $page/$modtotal</font><br/>";
            echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="listadmins")              {
        echo "<div>";
        echo "<font color=\"#00FF00\">Админы:</font><br/>";
        $modtotal=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM administrators"));
        $modtotal=$modtotal[0]-1;
        $modtotal=ceil($modtotal/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo listadmins($nick,$pass,$page);
        echo "<br/>";
        if ($modtotal==0) $modtotal=1;
          if ($page<$modtotal+1) echo "<a href=\"index.php?action=listadmins&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\"><font color=\"#00FFFF\">Вперед</font></a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=listadmins&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\"><font color=\"#FFFF00\">Назад</font></a><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "<font color=\"#FF00FF\">Страницы: $page/$modtotal</font><br/>";
              echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="listbanned")              {
        echo "<div>";
        echo "<font color=\"#00FF00\">Заебанные:</font><br/>";
        $modtotal=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users WHERE banned='1'"));
        $modtotal=$modtotal[0]-1;
        $modtotal=ceil($modtotal/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo listbanned($nick,$pass,$page);
        echo "<br/>";
                if ($modtotal==0) $modtotal=1;
          if ($page<$modtotal+1) echo "<a href=\"index.php?action=listbanned&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\"><font color=\"#00FFFF\">Вперед</font></a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=listbanned&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\"><font color=\"#FFFF00\">Назад</font></a><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "<font color=\"#FF00FF\">Страницы: $page/$modtotal</font><br/>";
              echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="listtop")              {
       echo "<div style=\"text-align: left\">";
       echo "Лучшие Юзеры:<br/>";
        $modtotal=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users"));
        $modtotal=$modtotal[0]-1;
        $modtotal=ceil($modtotal/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo listtop($nick,$pass,$page);
        echo "<br/>";
        if ($modtotal==0) $modtotal=1;
          if ($page<$modtotal+1) echo "<a href=\"index.php?action=listtop&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=listtop&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "Страница: $page/$modtotal<br/>";
             echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="listperms")              {
        echo "<div>";
        isadmin($nick,$pass);
        global $administrator;
        if ($administrator) {
        $modtotal=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM permissions"));
        $modtotal=$modtotal[0]-1;
        $modtotal=ceil($modtotal/5);
        $pagefrw=$page+1;
        $pagepws=$page-1;
        echo listperms($nick,$pass,$page);
        echo "<br/>";
                if ($modtotal==0) $modtotal=1;
          if ($page<$modtotal+1) echo "<a href=\"index.php?action=listperms&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=listperms&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "Страница: $page/$modtotal<br/>"; } else echo "Просмотр недоступен!";
              echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                           }
        if ($action=="sendpmcst")           {                             //Send the PM!
        echo "<div>";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged)
                  {
                                 $lastpostt=mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM private WHERE sentby='".$nick."'"));
              global $pmantiflood;
             if (time() < $lastpostt[0]+$pmantiflood) { echo "<font color=\"#FF0000\">Контроль флуда: "; echo $pmantiflood-(time()-$lastpostt[0]); echo "</font><br/>";}
                  $who=$_POST["who"];
        echo "<font color=\"#FF00FF\">Кому: $who</font><br/>";
        

         echo "<form method=\"post\" action=\"sendpm.php?nick=$nick&amp;pass=$pass&amp;who=$who\">";
        echo "<font color=\"#00FF00\">Сообщение:</font><br/>
        <input name=\"ttextas\" value=\"\" type=\"text\"  size=\"20\"  maxlength=\"200\" /><br/>";
        echo "<br/><input type=\"submit\" value=\"Отослать\"/>";
        echo "</form>";
        
        
        
        
        
                  } else echo "<font color=\"#FF0000\">Пройдите авторизацию!</font>";
               echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
       
                                           }
        if ($action=="log")               {
        echo "<div>";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged)
                  {
                  ismod2($nick,$pass);
                  global $moderator;
                  if ($moderator)
                   {
                     $forstot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM log"));
                     $forstot[0]=$forstot[0];
                     $forstot=ceil($forstot[0]/5);
                     if ($forstot==0) $forstot=1;
                     getlog($nick,$pass,$page);

              $pgnxt=$page+1;
              echo "<br/>";
              if ($page<$forstot) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=$pgnxt\"><font color=\"#FFFF00\">Вперед</font></a><br/>";
             // $page=$page-2;
             $pgpwz=$page-1;
              if ($page>1) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=$pgpwz\"><font color=\"#00FF00\">Назад</font></a><br/>";
             // $page=$page+1;
        echo "<br/>";
                   } else echo "You are not allowed to view LOG!";
                  } else echo "Please login before accessing LOG!";
      echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
        
                                           }
        if ($action=="unbanuser")              {
        echo "<div style=\"text-align: left\">";
        ismod2($nick,$pass);
        global $moderator;
        if ($moderator)
           {
           echo "<form action=\"unban.php?nick=$nick&amp;pass=$pass\" method=\"post\">";
             
             
             echo "<input type=\"hidden\" name=\"who\" value=\"$who\" />";
             echo "<br/><input type=\"submit\" value=\"Разбанить\"/></form>";
             
           } else echo "Доступ закрыт к панели модератора!";
               echo "<br/><hr/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><font color=\"#FFFF00\">: Хуерумы</font></a>";
echo "<br/><a href=\"$ssite\"><font color=\"#FF0000\">$coppy</font></a></div></body></html>";
                                               }
//mysql_close($conn);
?>