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

Размер файла: 44.68Kb
<?php
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<?php
//preparations (do not modify!)
include("core.php"); //load main functions
include("conf.php"); //load config
//global $conn;
echo connect($dbuser,$dbpass,$dbserver,$dbname);
$action=$_GET["action"];
$id=$_GET["id"];
$nick=$_GET["nick"];
$pass=$_GET["pass"];
//global $banned;
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."'"); }
//end of preparations
        if ($action=="")                   {
        echo "<card id=\"main\" title=\"Форумы Mobilka.Us\">";                   //start of main card
        echo "<p><small>";                                      //start of text && coding (align = center)
        echo "<u><b>$title</b></u><br/>";
        $page=$_GET["page"];
        if (!isset($page)) $page=1;
       // $page=$page+1;
              $forstot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM forums"));
              $forstot[0]=$forstot[0];
              $forstot=ceil($forstot[0]/15);

              if ($forstot==0) $forstot=1;
        echo login($nick,$pass);                                          //Let's login!
        echo addvisitor();
        echo "<br/>";
        echo isadmin($nick,$pass);
	print "</small>";
        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 "<small><a href=\"index.php?action=login\">Войти заново</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\">Входящие$unrd</a><br/>";
        echo "<a href=\"index.php?action=usercp&amp;nick=$nick&amp;pass=$pass\">Изменить профиль</a><br/>";
        echo "<a href=\"index.php?action=viewuser&amp;nick=$nick&amp;pass=$pass&amp;who=$nick\">Показать профиль</a></small><br/>";
                    }
        if (!$logged){                                                    //if login failed
           echo "<small><a href=\"index.php?action=register\">Регистрация</a><br/>";//New here? Register!
           echo "<a href=\"index.php?action=login\">Вход</a></small><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 "<small><a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=1\">ModLOG($kiekmodloge[0])</a></small>";
////////////////////////////////////////////
//few empty lines...
        getforums($permissions,$nick,$pass,$page);                         //here are our forums...
        $pgnxt=$page+1;
///////////////////////////////////////
        if ($page<$forstot) echo "<small><a href=\"index.php?nick=$nick&amp;pass=$pass&amp;page=$pgnxt\">Вперед</a></small><br/>";
             // $page=$page-2;
             $pgpwz=$page-1;
              if ($page>1) echo "<small><a href=\"index.php?nick=$nick&amp;pass=$pass&amp;page=$pgpwz\">Назад</a></small><br/>";
             // $page=$page+1;
        echo "<small>";                                                //some breaks...
        echo "<a href=\"index.php?action=search&amp;nick=$nick&amp;pass=$pass\">Поиск</a><br/>";
        echo "<a href=\"index.php?action=statistics&amp;nick=$nick&amp;pass=$pass\">Статистика</a><br/>";
        echo "<a href=\"index.php?action=smilies&amp;nick=$nick&amp;pass=$pass&amp;page=1\">Смайлы</a><br/>";
        echo "<a href=\"http://mobilka.us\">На гланвую</a></small><br/>";
	print "<small>";
        echo onlineget($nick,$pass);
	print "</small>";
        if ($administrator) {
                        echo "<br/><small><a href=\"index.php?action=admincp&amp;nick=$nick&amp;pass=$pass\">Админка</a></small><br/>";
                            }
	print '<br/><img src="http://pslink.ru/b.php?id=780" alt="PSLink"/><br/>';
        echo "</p>";                                                      //end of text
        echo "</card>";                                                   //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."'"));
        echo "<card id=\"viewforum\" title=\"$forumnameasasas[0]\">";
        echo "<p align=\"center\">";
        global $timezone;
        $valandos=date("H")+$timezone;
        if ($valandos>23) $valandos=$valandos-24;
        $data=date("y m d - ".$valandos.":i");
        echo "$data<br/>";
        echo ismod($nick,$pass,$id);
        global $moderator;
        if ($moderator) echo "Hello moderator!<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 "<small><a href=\"index.php?action=newthread&amp;id=$id&amp;nick=$nick&amp;pass=$pass\">[Новая тема]</a></small>";
              //echo "<br/>";
              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];
              //echo "<br/>";
              $poststot=ceil($poststot[0]/10);
              if ($page<$poststot+1) echo "<small><a href=\"index.php?action=viewforum&amp;id=$id&amp;nick=$nick&amp;pass=$pass&amp;page=$page\">Вперед</a></small><br/>";
              $page=$page-2;
              if ($page>0) echo "<small><a href=\"index.php?action=viewforum&amp;id=$id&amp;nick=$nick&amp;pass=$pass&amp;page=$page\">Назад</a></small><br/>";
              $page=$page+1;
              if ($poststot==0) $poststot=1;
              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 "<small><a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\">Входящие$unrd</a></small><br/>";
        }}
              echo "<small>Страница: $page/$poststot</small><br/>";
              echo "<small><a href=\"index.php?action=newthread&amp;id=$id&amp;nick=$nick&amp;pass=$pass\">[Новая тема]</a></small>";
              echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small>";
            } else echo "Просмотр невозможен!<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="register")           {                             //Time to register!
        echo "<card id=\"viewforum\" title=\"Register\">";
        echo "<p align=\"center\">";
        echo "<small>Спец-символы и пробелы автоматически удаляются из логина и пароля!</small><br/>";
        echo "<small>Логин:</small><br/><input name=\"us\" maxlength=\"30\"/><br/>";
        echo "<small>Пароль:</small><br/><input type=\"password\" name=\"pa\" maxlength=\"30\"/><br/>";
        echo "<small>Повторить пароль:</small><br/><input type=\"password\" name=\"pa2\" maxlength=\"30\"/><br/>";
        echo "<small><anchor title=\"REGISTER\">Ok";
        echo "<go href=\"register.php\" method=\"post\">";
        echo "<postfield name=\"userreg\" value=\"\$us\"/>";
        echo "<postfield name=\"passreg\" value=\"\$pa\"/>";
        echo "<postfield name=\"passreg2\" value=\"\$pa2\"/>";
        echo "</go>";
        echo "</anchor></small>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="login")           {                                //This is how login done =]
        echo "<card id=\"viewforum\" title=\"Вход\">";
        echo "<p align=\"center\">";
        echo "<small>Сделайте закладку на страницу после входа в систему.</small><br/>";
        echo "<small>Ник:</small><br/><input name=\"us\" maxlength=\"30\"/><br/>";
        echo "<small>Пароль:</small><br/><input type=\"password\" name=\"pa\" maxlength=\"30\"/><br/>";
        echo "<anchor title=\"Login\">Ok";
        echo "<go href=\"login.php\" method=\"post\">";
        echo "<postfield name=\"userreg\" value=\"\$us\"/>";
        echo "<postfield name=\"passreg\" value=\"\$pa\"/>";
        echo "</go>";
        echo "</anchor>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="newthread")           {                            //Some threads...
        echo "<card id=\"viewforum\" title=\"Новая тема\">";
        echo "<p align=\"center\">";
        $lastpostt=mysql_fetch_array(mysql_query("SELECT lastthread FROM users WHERE name='".$nick."'"));
              global $antiflood2;
              if (time() < $lastpostt[0]+$antiflood2) { echo "FloodControl: "; echo $antiflood2-(time()-$lastpostt[0]); echo "<br/>";} else {
       // echo "<refresh><setvar name=\"tname\" value=\"\"/><setvar name=\"ttext\" value=\"\"/></refresh>";
        echo "<small>Заголовок:</small><br/><input name=\"tname\" maxlength=\"30\" value=\"\"/><br/>";
        echo "<small>Текст:</small><br/><input name=\"ttext\" maxlength=\"200\" value=\"\"/><br/>";
        echo "<small><anchor title=\"Send!\">Ok";
        echo "<go href=\"newthread.php?nick=$nick&amp;pass=$pass&amp;forumas=$id\" method=\"post\">";
        echo "<postfield name=\"tname\" value=\"\$tname\"/>";
        echo "<postfield name=\"ttext\" value=\"\$ttext\"/>";
        echo "</go>";
        echo "</anchor></small>";   };
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="viewpost")           {                            //What do people write?
        echo "<card id=\"viewforum\" title=\"".base64_decode($name)."\">";
        echo "<p align=\"center\">";
        $namedec=base64_decode($name);
        $name=htmlspecialchars($name);
        $poststot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM posts WHERE name='".$namedec."'"));
        $poststot[0]=$poststot[0];
        $poststot=ceil($poststot[0]/5);
        $lastpostt=mysql_fetch_array(mysql_query("SELECT lastpost FROM users WHERE name='".$nick."'"));
              global $antiflood;
              if (time() < $lastpostt[0]+$antiflood) { echo "FloodControl: "; echo $antiflood-(time()-$lastpostt[0]); echo "<br/>";}
        echo "<small><a href=\"index.php?action=postreply&amp;nick=$nick&amp;pass=$pass&amp;name=$name&amp;forumas=$forumas\">Ответить</a></small><br/>";
        if ($read=="new") {echo "<small><a href=\"index.php?action=viewpost&amp;name=$name&amp;nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;read=old&amp;page=1\">С начала</a></small><br/><br/></p><p align=\"left\">"; echo getpost($nick,$pass,$namedec,"new",$page,$id,$forumas,$poststot); echo "</p><p align=\"center\">";}
        if ($read=="old") {echo "<small><a href=\"index.php?action=viewpost&amp;name=$name&amp;nick=$nick&amp;pass=$pass&amp;forumas=$forumas&amp;read=new&amp;page=1\">С конца</a></small><br/><br/></p><p align=\"left\">"; echo getpost($nick,$pass,$namedec,"old",$page,$id,$forumas,$poststot); echo "</p><p align=\"center\">";}
        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 "<small><a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\">Входящие$unrd</a></small><br/>";
        }}
        if ($moderator) echo "<small><a href=\"index.php?action=modcp&amp;nick=$nick&amp;pass=$pass&amp;name=$name&amp;forumas=$forumas\">[Модерка]</a></small><br/>";
        echo "<small>Страница: $page/$poststot</small><br/>";
        echo "<small><a href=\"index.php?action=postreply&amp;nick=$nick&amp;pass=$pass&amp;name=$name&amp;forumas=$forumas\">Ответить</a></small>";
        echo "<br/><small><a href=\"index.php?action=viewforum&amp;nick=$nick&amp;pass=$pass&amp;id=$forumas&amp;page=1\">Назад в форум</a></small><br/>";
        echo "<small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="postreply")           {                            //Tell community your opinion
        echo "<card id=\"viewforum\" title=\"Ответить\">";
        echo "<p align=\"center\">";
        $name=base64_decode($name);
       $lastpostt=mysql_fetch_array(mysql_query("SELECT lastpost FROM users WHERE name='".$nick."'"));
              global $antiflood;
              if (time() < $lastpostt[0]+$antiflood) { echo "FloodControl: "; echo $antiflood-(time()-$lastpostt[0]); echo "<br/>";}
        echo "<small>Текст:</small><br/><input name=\"ttext\" maxlength=\"200\" value=\"\"/><br/>";
        echo "<small><anchor title=\"Send!\">Ok";
        echo "<go href=\"newreply.php?nick=$nick&amp;pass=$pass&amp;forumas=$forumas\" method=\"post\">";
        echo "<postfield name=\"ttext\" value=\"\$ttext\"/>";
        echo "<postfield name=\"name\" value=\"$name\"/>";
        echo "</go>";
        echo "</anchor></small>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="viewuser")           {                             //User stats & other info
        echo "<card id=\"viewforum\" title=\"Инфа\">";
        echo "<p align=\"center\"><small>";
        echo viewuser($who,$nick,$pass);
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="usercp")           {                             //UserCP
        echo "<card id=\"viewforum\" title=\"Изменить профиль\">";
        echo "<p align=\"center\">";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged) {
          echo usercpget($nick,$pass);
        } else echo "Войдите в систему, прежде чем получать доступ к изменению профиля!";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="private")           {                             //Inbox
        echo "<card id=\"viewforum\" title=\"Входящие\">";
        echo "<p align=\"center\">";
        $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 "<small><a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a></small><br/>";
        $page=$page-2;
        if ($page>-1) echo "<small><a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a></small><br/>";
        $page=$page+2;
        $pmtot=$pmtot+1;
       // if ($pmtot==0) $pmtot=1;
        echo "<small>Страница: $page/$pmtot</small>";
        echo "<br/>";
        echo "<small><a href=\"delall.php?nick=$nick&amp;pass=$pass\">Удалить все</a></small><br/>";
        echo "<small>Кому:</small><br/><input name=\"kam\" value=\"\"/><br/>";
         echo "<small><anchor title=\"Send!\">Написать";
        echo "<go href=\"index.php?action=sendpmcst&amp;nick=$nick&amp;pass=$pass\" method=\"post\">";
        echo "<postfield name=\"who\" value=\"\$kam\"/>";
        echo "</go>";
        echo "</anchor></small>";
                  } else echo "<small>Пройдите авторизацию!</small>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="sendpm")           {                             //Send the PM!
        echo "<card id=\"viewforum\" title=\"Написать\">";
        echo "<p align=\"center\">";
        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 "FloodControl: "; echo $pmantiflood-(time()-$lastpostt[0]); echo "<br/>";}
        echo "<small>Кому:</small><br/><small>$who</small><br/>";
        echo "<small>Сообщение:</small><br/><input name=\"ttextas\" maxlength=\"255\" value=\"\"/><br/>";
        echo "<small><anchor title=\"Send!\">Ok";
        echo "<go href=\"sendpm.php?nick=$nick&amp;pass=$pass&amp;who=$who\" method=\"post\">";
        echo "<postfield name=\"ttextas\" value=\"\$ttextas\"/>";
        echo "</go>";
        echo "</anchor></small>";
                  } else echo "<small>Пройдите авторизацию!</small>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="readpm")           {                             //Read PM
        echo "<card id=\"viewforum\" title=\"Просмотр\">";
        echo "<p align=\"center\">";
        echo login($nick,$pass);
        echo "<br/>";
        if ($logged)
                  {
                   echo readpm($nick,$pass,$pm);
                  } else echo "Войдите на форум до чтения ваших приватных сообщений!";
        echo "<br/><small><a href=\"index.php?action=private&amp;nick=$nick&amp;pass=$pass&amp;page=1\">Назад в входящие</a></small><br/>";
        echo "<small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        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 "<card id=\"viewforum\" title=\"Статистика\">";
        echo "<p align=\"center\"><small>";
        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\">Пользователи($numeriukas[0])</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\">Модераторы($numeriukas[0])</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\">Администраторы($numeriukas[0])</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\">Забаненные($numeriukas[0])</a><br/>";
        echo "<a href=\"index.php?action=listtop&amp;nick=$nick&amp;pass=$pass&amp;page=1\">Топ пользователей</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\">Permissions($numeriukas[0])</a><br/>";
        echo "<br/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="memberlist")           {                         //forum stats
        echo "<card id=\"viewforum\" title=\"Пользователи\">";
        echo "<p align=\"center\"><small>";
        $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 "<a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форум]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="search")           {                         //search posts and threads
        echo "<card id=\"viewforum\" title=\"Поиск\">";
        echo "<p align=\"center\"><small>";
        echo "Искать: <input name=\"ttextas\" maxlength=\"255\"/><br/>";
        echo "<anchor title=\"Search\">Ok";
        echo "<go href=\"search.php?nick=$nick&amp;pass=$pass&amp;page=1\" method=\"post\">";
        echo "<postfield name=\"ttextas\" value=\"\$ttextas\"/>";
        echo "</go>";
        echo "</anchor>";
        echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="online")           {
        echo "<card id=\"viewforum\" title=\"Кто на форуме\">";
        echo "<p align=\"center\"><small>";
        $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\">Forward</a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=online&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Backward</a><br/>";
        $page=$page+2;
        if ($onlinetot==0) $onlinetot=1;
        echo "Страницы: $page/$onlinetot<br/>";
        echo "<a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="modcp")              {
        echo "<card id=\"viewforum\" title=\"Панель модера\">";
        echo "<p align=\"center\">";
        ismod($nick,$pass,$forumas);
        global $moderator;
        if ($moderator)
           {
            echo "Модерирование <b>".htmlspecialchars(base64_decode($name));
            echo "</b> в форуме <b>$forumas</b><br/>";
            echo "<a href=\"close.php?nick=$nick&amp;pass=$pass&amp;name=$name;&amp;forumas=$forumas\">Закрыть</a><br/>";
            echo "<a href=\"open.php?nick=$nick&amp;pass=$pass&amp;name=$name;&amp;forumas=$forumas\">Открыть</a><br/>";
            echo "<a href=\"pin.php?nick=$nick&amp;pass=$pass&amp;name=$name;&amp;forumas=$forumas\">Заблокировать</a><br/>";
            echo "<a href=\"unpin.php?nick=$nick&amp;pass=$pass&amp;name=$name;&amp;forumas=$forumas\">Разблокировать</a><br/>";
            echo "<a href=\"delete.php?nick=$nick&amp;pass=$pass&amp;name=$name;&amp;forumas=$forumas\">Удалить</a><br/>";
             echo "Переименовать: <input name=\"rnm\" maxlength=\"20\" value=\"".htmlspecialchars(base64_decode($name))."\"/><br/>";
              $textasss=mysql_fetch_array(mysql_query("SELECT text FROM posts WHERE name='".base64_decode($name)."' AND thread='1'"));
              echo "Текст: <input name=\"rnm2\" maxlength=\"200\" value=\"".$textasss[0]."\"/><br/>";
              $textasss[0]=htmlspecialchars($textasss[0]);
              echo "<anchor title=\"Rename\">Ok";
              echo "<go href=\"rename.php?nick=$nick&amp;pass=$pass&amp;name=$name;&amp;forumas=$forumas\" method=\"post\">";
              echo "<postfield name=\"rnm\" value=\"\$rnm\"/>";
                echo "<postfield name=\"rnm2\" value=\"\$rnm2\"/>";
              echo "</go>";
              echo "</anchor>";
           } else echo "Нет прав для просмотра панели модера!";
        echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="modlinks")              {
        echo "<card id=\"viewforum\" title=\"ModCP\">";
        echo "<p align=\"center\">";
        ismod($nick,$pass,$forumas);
        global $moderator;
        if ($moderator)
           {
            echo "Moderating <b>".htmlspecialchars(base64_decode($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;name=$post;&amp;forumas=$forumas&amp;id=$msg\">Delete</a><br/>";
             $postasss=mysql_fetch_array(mysql_query("SELECT text FROM posts WHERE id='".$msg."'"));
             echo "Edit: <input name=\"rnm\" maxlength=\"200\" value=\"".$postasss[0]."\"/><br/>";
             echo "<anchor title=\"Edit\">Edit";
             echo "<go href=\"edit.php?nick=$nick&amp;pass=$pass&amp;name=$post;&amp;forumas=$forumas&amp;id=$msg\" method=\"post\">";
             echo "<postfield name=\"rnm\" value=\"\$rnm\"/>";
             echo "</go>";
             echo "</anchor>";
           } else echo "You are not allowed to view ModCP!";
        echo "<br/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">Back</a><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="banuser")              {
        echo "<card id=\"viewforum\" title=\"BanCP\">";
        echo "<p align=\"center\">";
        ismod2($nick,$pass);
        global $moderator;
        if ($moderator)
           {
             echo "BanCP for $who<br/><br/>";
             ismod3($who);
             global $moderator;
             if ($moderator) echo "You cannot ban another moderator!"; else {
             echo "Ban for:<br/>Days:<input name=\"days\" maxlength=\"20\" value=\"2\" format=\"*N\"/><br/>";
             echo "Hours:<input name=\"hours\" maxlength=\"20\" value=\"0\" format=\"*N\"/><br/>";
             echo "Minutes:<input name=\"minutes\" maxlength=\"20\" value=\"0\" format=\"*N\"/><br/>";
             echo "Seconds:<input name=\"seconds\" maxlength=\"20\" value=\"0\" format=\"*N\"/><br/>";
             echo "Reason:<input name=\"reason\" maxlength=\"255\" value=\"\"/><br/>";
             echo "<anchor title=\"Ban\">Ban";
             echo "<go href=\"ban.php?nick=$nick&amp;pass=$pass&amp;who=$who\" method=\"post\">";
             echo "<postfield name=\"days\" value=\"\$days\"/>";
             echo "<postfield name=\"hours\" value=\"\$hours\"/>";
             echo "<postfield name=\"minutes\" value=\"\$minutes\"/>";
             echo "<postfield name=\"seconds\" value=\"\$seconds\"/>";
             echo "<postfield name=\"reason\" value=\"\$reason\"/>";
             echo "</go>";
             echo "</anchor>";
             }
           } else echo "You are not allowed to view ModCP!";
        echo "<br/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">Back</a><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="pluses")              {
        echo "<card id=\"viewforum\" title=\"PlusesCP\">";
        echo "<p align=\"center\">";
        ismod2($nick,$pass);
        global $moderator;
        if ($moderator)
           {
              echo "PlusesCP for $who<br/><br/>";
             echo "<br/>Pluses:<input name=\"pluses\" maxlength=\"20\" value=\"".$pluses."\" format=\"*N\"/><br/>";
             echo "Reason:<input name=\"reason\" maxlength=\"255\" value=\"\"/><br/>";
             echo "<anchor title=\"update\">update!";
             echo "<go href=\"pluses.php?nick=$nick&amp;pass=$pass&amp;who=$who\" method=\"post\">";
             echo "<postfield name=\"pluses\" value=\"\$pluses\"/>";
             echo "<postfield name=\"reason\" value=\"\$reason\"/>";
             echo "</go>";
             echo "</anchor>";
           } else echo "You are not allowed to view ModCP!";
        echo "<br/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">Back</a><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="admincp")              {
        echo "<card id=\"viewforum\" title=\"Админка\">";
        echo "<p align=\"center\"><small>";
        isadmin($nick,$pass);
        global $administrator;
        if ($administrator)
           {
           echo "Панель админа для $nick<br/><br/>";
           echo "<a href=\"admin.php?action=addforum&amp;nick=$nick&amp;pass=$pass\">Создать форум</a><br/>";
           echo "<a href=\"admin.php?action=delforum&amp;nick=$nick&amp;pass=$pass\">Удалить форум</a><br/>";
           echo "<a href=\"admin.php?action=editforum&amp;nick=$nick&amp;pass=$pass\">Редактировать форум</a><br/>";
           echo "<a href=\"admin.php?action=reforum&amp;nick=$nick&amp;pass=$pass\">Положения форумов</a><br/>";
           echo "<a href=\"admin.php?action=edituser&amp;nick=$nick&amp;pass=$pass\">Редактировать пользователя</a><br/>";
           echo "<a href=\"admin.php?action=bbcode&amp;nick=$nick&amp;pass=$pass\">Добавить смайлы</a><br/>";
           } else echo "Нет прав для просмотра панели админа!";
        echo "<a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="smilies")              {
        echo "<card id=\"viewforum\" title=\"Smiles\">";
        echo "<p align=\"center\">";
        $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 "<small><a href=\"index.php?action=smilies&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a></small><br/>";
        $page=$page-2;
        if ($page>-1) echo "<small><a href=\"index.php?action=smilies&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a></small><br/>";
        $page=$page+2;
        if ($bbtotal==0) $bbtotal=1;
        echo "<small>Страницы: $page/$bbtotal</small><br/>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="listmods")              {
        echo "<card id=\"viewforum\" title=\"Модераторы\">";
        echo "<p align=\"center\">";
        $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 "<small><a href=\"index.php?action=listmods&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a></small><br/>";
        $page=$page-2;
        if ($page>-1) echo "<small><a href=\"index.php?action=listmods&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a></small><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "<small>Страницы: $page/$modtotal</small><br/>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="listadmins")              {
        echo "<card id=\"viewforum\" title=\"Администраторы\">";
        echo "<p align=\"center\">";
        $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 "<small><a href=\"index.php?action=listadmins&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a></small><br/>";
        $page=$page-2;
        if ($page>-1) echo "<small><a href=\"index.php?action=listadmins&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a></small><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "<small>Страницы: $page/$modtotal</small><br/>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="listbanned")              {
        echo "<card id=\"viewforum\" title=\"Забаненные\">";
        echo "<p align=\"center\">";
        $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 "<small><a href=\"index.php?action=listbanned&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Вперед</a></small><br/>";
        $page=$page-2;
        if ($page>-1) echo "<small><a href=\"index.php?action=listbanned&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">Назад</a></small><br/>";
        $page=$page+2;
        $modtotal=$modtotal+1;
        echo "<small>Страницы: $page/$modtotal</small><br/>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="listtop")              {
        echo "<card id=\"viewforum\" title=\"Топ пользователей\">";
        echo "<p align=\"center\"><small>";
        $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/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="listperms")              {
        echo "<card id=\"viewforum\" title=\"Права доступа\">";
        echo "<p align=\"center\"><small>";
        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/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a><br/>";
        echo "</small></p>";
        echo "</card>";
                                           }
        if ($action=="sendpmcst")           {                             //Send the PM!
        echo "<card id=\"viewforum\" title=\"Написать\">";
        echo "<p align=\"center\">";
        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 "Контроль флуда: "; echo $pmantiflood-(time()-$lastpostt[0]); echo "<br/>";}
                  $who=$_POST["who"];
        echo "<small>Кому: $who</small><br/>";
        echo "<small>Сообщение:</small><br/><input name=\"ttextas\" maxlength=\"255\" value=\"\"/><br/>";
        echo "<small><anchor title=\"Послать\">Ok";
        echo "<go href=\"sendpm.php?nick=$nick&amp;pass=$pass&amp;who=$who\" method=\"post\">";
        echo "<postfield name=\"ttextas\" value=\"\$ttextas\"/>";
        echo "</go>";
        echo "</anchor></small>";
                  } else echo "<small>Пройдите авторизацию!</small>";
        echo "<br/><small><a href=\"index.php?nick=$nick&amp;pass=$pass\">[Форумы]</a></small><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="log")               {
        echo "<card id=\"viewforum\" title=\"LOG\">";
        echo "<p align=\"center\">";
        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\">Forward</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\">Backward</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/><a href=\"index.php?nick=$nick&amp;pass=$pass\">Back</a><br/>";
        echo "</p>";
        echo "</card>";
                                           }
        if ($action=="unbanuser")              {
        echo "<card id=\"viewforum\" title=\"Разбан\">";
        echo "<p align=\"center\">";
        ismod2($nick,$pass);
        global $moderator;
        if ($moderator)
           {
             echo "Разбан-панель для $who<br/><br/>";
             echo "<anchor title=\"Разбан\">Разбан";
             echo "<go href=\"unban.php?nick=$nick&amp;pass=$pass\" method=\"post\">";
             echo "<postfield name=\"who\" value=\"$who\"/>";
             echo "</go>";
             echo "</anchor>";
           } else echo "Доступ закрыт к панели модератора!";
        echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">Назад</a><br/>";
        echo "</p>";
        echo "</card>";
                                               }
//mysql_close($conn);
?>
</wml>