index.php no output show

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    index.php no output show

    help can some one fix this to me
    PHP Code:
    <?php
    include("../blocked.php");
    include(
    "config.php");
    include(
    "core.php");
    header("Cache-Control: no-cache, must-revalidate");            // Prevent caching, HTTP/1.1
    header("Pragma: no-cache");
    //header('Content-type: application/vnd.wap.xhtml+xml'); 
    echo "<?xml version=\"1.0\"?>";
    echo 
    "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    $bcon 
    connectdb();
    if (!
    $bcon)
    {
        echo 
    "<head>";
        echo 
    "<title>Error!!!</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
        echo 
    "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
        echo 
    "This error happens usually when backing up the database, please be patient...";
        echo 
    "</p>";
        echo 
    "</body>";
        echo 
    "</html>";
        exit();
    }

    $brws explode("/",$HTTP_USER_AGENT);
    $ubr $brws[0];
    $uip getip();
    $action $_GET["action"];
    $sid $_GET["sid"];
    $page $_GET["page"];
    $who $_GET["who"];
    $uid getuid_sid($sid);
    $theme mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
    $sitename mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
    $sitename $sitename[0];
    cleardata();

    if(
    isipbanned($uip,$ubr))
      {
    if(!
    isshield(getuid_sid($sid)))
      {
      echo 
    "<head>";
      echo 
    "<title>Ip Block!</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<div><img src=\"../images/notok.gif\" alt=\"!\"/></div>";
      echo 
    "<b>This IP address is blocked!!!</b><br/>";
      echo 
    "<br/>";
      echo 
    "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
      
    $banto mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      
    $remain =  $banto[0] - time();
      
    $rmsg gettimemsg($remain);
      echo 
    "<b>Time Left: </b>$rmsg<br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\"><form action=\"login.php\" method=\"get\">";
      echo 
    "<b>Username:</b><br/><input align=\"center\" name=\"loguid\" style=\"-wap-input-format: '*x'\" size=\"12\" maxlength=\"12\"/><br/>";
      echo 
    "<b>Password:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
      echo 
    "<input name=\"LOGIN\" type=\"submit\" value=\"Login!\"></form></p>";
      echo 
    "<p align=\"center\"><br/>Not registered yet? <br/><a href=\"register.php\">Sign-Up</a><br/>";
      echo 
    "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      
    $onu getnumonline();
      echo 
    "Members Inside: $onu<br/><br/>";
      echo 
    "<a href=\"../wap/index.php\">Wap 1.0(wml) Version</a></p>";
      echo 
    mobads();
      echo 
    "<div><b>©2006-2007<br/>$sitename</b></div>";
      echo 
    "</body>";
      echo 
    "</html>";
      exit();
      }
    }

    if((
    $action != "") && ($action!="terms"))
      {
        
    $uid getuid_sid($sid);
        if((
    islogged($sid)==false)||($uid==0))
        {
          echo 
    "<head>";
          echo 
    "<title>Error!!!</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
          echo 
    "</head>";
          echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You are not logged in<br/>";
          echo 
    "Or Your session has been expired<br/><br/>";
          echo 
    "<a href=\"index.php\">Login</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }            
     }

    //echo isbanned($uid);
    if(isbanned($uid))
        {
          echo 
    "<head>";
          echo 
    "<title>Error!!!</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo 
    "</head>";
          echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
          echo 
    "<b>You are Banned</b><br/><br/>";
          
    $banto mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
        
    $banres mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
          
    $remain $banto[0]- time();
          
    $rmsg gettimemsg($remain);
          echo 
    "<b>Time Left: </b>$rmsg<br/>";
          
    $nick getnick_uid($banto[2]);
        echo 
    "<b>By: </b>$nick<br/>";
        echo 
    "<b>Reason: </b>$banto[1]";
          
    //echo "<a href=\"index.php\">Login</a>";
          
    echo "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
    $res mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

    ////////////////////////////////////////MAIN PAGE
    if($action=="main")
    {
      
    addvisitor();
      
    addonline(getuid_sid($sid),"Main Menu","index.php?action=$action");
      
    //saveuinfo($sid);
      
    $nick getnick_sid($sid);
      echo 
    "<head>";
      echo 
    "<title>$sitename</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      
    $time time() - (60 60);
      
    $newtime date("H:i",$time);
      
    $date strtotime('-9 hours');
      
    $newdate date('D jS M y',$date);

      echo 
    "<div><img src=\"../images/logo.gif\" alt=\"logo\"/><br/>";
      echo 
    "".$newtime." - ".$newdate."</div>";
      echo 
    popup($sid);
      
    $nick getnick_sid($sid);
      echo 
    "<p align=\"center\">You are logged in as $nick <a accesskey=\"0\" href=\"index.php?action=logout&amp;sid=$sid&amp;who=$uid\">Logout</a></p>";
      
    $fmsg getbbcode(getfmsg(), $sid0);
      echo 
    "<b>Site News"
      
    echo "<p align=\"center\">$fmsg</p>";
      echo 
    "<p align=\"center\">";  
      echo 
    getshoutbox($sid);
      echo 
    "</p>";

      echo 
    "<p align=\"center\">";
      
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
      
    $memid mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
      echo 
    "We Have $norm[0]<br/>Registered Members<br/><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a><br/>has now joined<br/>$sitename :o)<br/><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
      if(
    $noi[0]!=0){
      
    $sql mysql_fetch_array(mysql_query("SELECT id, name, birthday  FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate()) ORDER BY RAND() LIMIT 1"));
      
    $uage getage($sql[2]);
      
    $lnk "Happy Birthday<br/><a href=\"index.php?action=viewuser&amp;who=$sql[0]&amp;sid=$sid\">$sql[1]</a>";
      echo 
    "$lnk<br/>Hope U have A Wonderful Day<br/><br/>";
      }
    if(
    isowner(getuid_sid($sid)))
      {
      echo 
    "<a href=\"ownercp.php?action=ownercp&amp;sid=$sid\">Owner Tools</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE validated='0'"));
    if(
    $noi[0]>0)
      {
      echo 
    "<a href=\"ownercp.php?action=validatelist&amp;sid=$sid\">Validate List($noi[0])</a><br/>";
      }
      }
    if(
    isheadadmin(getuid_sid($sid)))
      {
      echo 
    "<a href=\"headadmincp.php?action=headadmincp&amp;sid=$sid\">Head Admin Tools</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE validated='0'"));
    if(
    $noi[0]>0)
      {
      echo 
    "<a href=\"headadmincp.php?action=validatelist&amp;sid=$sid\">Validate List($noi[0])</a><br/>";
      }
      }
      if(
    ismod($uid))
      {
      if(!
    isowner(getuid_sid($sid)))
      {
    if(!
    isheadadmin(getuid_sid($sid)))
      {
      echo 
    "<a href=\"admincp.php?action=admincp&amp;sid=$sid\">Admin Tools</a><br/>";
      }
      }
      }
      if(
    ismod($uid))
      {
      
    $adminclub "1";
      
    $ismem mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND uid='".$uid."'"));
      if(
    $ismem[0]==0)
      {
      echo 
    "<a href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$adminclub\">Join Admin Club Now!</a><br/>";
      }else{
      
    $clinfo mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$adminclub."'"));
      
    $clnm htmlspecialchars($clinfo[0]);
      
    $fid mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$adminclub."'"));
      
    $rid mysql_fetch_array(mysql_query("SELECT id FROM ibwf_rooms WHERE clubid='".$adminclub."'"));
      
    $tps mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid[0]."'"));
      
    $pss mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$fid[0]."'"));
      
    $cango mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND uid='".$uid."' AND accepted='1'"));
      if((
    $cango[0]>0)||(isheadadmin($uid))||(isowner($uid)))
      {
      
    $noa mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE clid='".$adminclub."'"));
      echo 
    "<a href=\"lists.php?action=annc&amp;sid=$sid&amp;clid=$adminclub\">Announcements($noa[0])</a><br/>";
      
    $noa mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE rid='".$rid[0]."'"));
      
    $chs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$rid[0]."'"));
      echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid[0]\">$clnm Chat($chs[0])</a><br/>";
      echo 
    "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid[0]\">$clnm Forum($tps[0]/$pss[0])</a><br/>";
      if(
    $clinfo[1]==$uid)
      {
      
    $mems mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND accepted='0'"));
      if(
    $mems[0]>0)
      {
      echo 
    "<a href=\"lists.php?action=clreq&amp;sid=$sid&amp;clid=$adminclub\">Requests($mems[0])</a><br/>";
      }
      }
      }
      }
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE reported='1'"));
        
    $tot $tnor[0];
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups WHERE reported='1'"));
        
    $tot += $tnor[0];
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE reported='1'"));
        
    $tot += $tnor[0];
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE reported='1'"));
        
    $tot += $tnor[0];
        
    $tnol mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog"));
        
    $tol $tnol[0];
        if(
    $tol+$tot>0)
        {
        echo 
    "<a href=\"modcp.php?action=main&amp;sid=$sid\">Reports/Logs($tot/$tol)</a><br/><br/>";
        }
      }

    echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=online&amp;sid=$sid\">Online Users(".getnumonline().")</a><br/>";
      
    $tmsg getpmcount(getuid_sid($sid));
      
    $umsg getunreadpm(getuid_sid($sid));
      echo 
    "<b>2 </b><a accesskey=\"2\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
      
    $reqs getnreqs($uid);
      if(
    $reqs>0)
      {

        
    $request "! <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
      }
      
    $uid getuid_sid($sid);
      
    $mybuds getnbuds($uid);
      
    $onbuds getonbuds($uid);
      echo 
    "<b>3 </b><a accesskey=\"3\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist($onbuds/$mybuds)</a>$request<br/>";
      
    $chs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
      echo 
    "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=clmenu&amp;sid=$sid\">Clubs($chs[0])</a><br/>";
      if(
    getfview()==0)
      {
      
    $topics mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      
    $posts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=forumindx&amp;sid=$sid\">Forums($topics[0]/$posts[0])</a><br/>";
      }
      
    $fcats mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id");
      while(
    $fcat=mysql_fetch_array($fcats))
      {
        
    $forums mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$fcat[0]."' AND clubid='0' ORDER BY position, id, name");

        if(
    getfview()==1)
        {
        echo 
    "<b>$fcat[1]</b><br/>";
        while(
    $forum=mysql_fetch_array($forums))
            {
          if(
    canaccess(getuid_sid($sid),$forum[0]))
          {
          echo 
    "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$forum[1]</a><br/>";
          }
        }
        }else if(
    getfview()==2)
        {
        
    $topics mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics a INNER JOIN ibwf_forums b ON a.fid = b.id WHERE b.cid='".$fcat[0]."'"));
        
    $posts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id INNER JOIN ibwf_forums c ON b.fid = c.id WHERE c.cid='".$fcat[0]."'"));
        echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$fcat[0]\">$fcat[1]($topics[0]/$posts[0])</a><br/>";
        }else if(
    getfview()==3)
        {
      echo 
    "<form action=\"index.php\" method=\"get\">";
      echo 
    "<b>$fcat[1]</b><br/><select name=\"fid\">";
      while(
    $forum=mysql_fetch_array($forums))
      {
    if(
    canaccess(getuid_sid($sid),$forum[0]))
      {
      
    $topics mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      
    $posts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
      echo 
    "<option value=\"$forum[0]\">$forum[1]($topics[0]/$posts[0])</option>";
      }
      }
      echo 
    "</select><br/>";
      echo 
    "<input type=\"hidden\" name=\"action\" value=\"viewfrm\"/>";
      echo 
    "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
      echo 
    "<input type=\"hidden\" name=\"fid\" value=\"$(fid)\"/>";
      echo 
    "<input type=\"submit\" value=\"[view]\"/>";
      echo 
    "</form>";
        }
      }
      
    $chs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"index.php?action=chat&amp;sid=$sid\">Chat($chs[0])</a><br/>";

    if(!(
    $dp opendir("../pics/"))) die ("Cannot open ./");
    $files = array(); 
    while (
    $pics readdir ($dp))
        {
        if(
    substr($pics,0,1) != '.' and $pics!= "index.php")
            {
            
    $files[] =  $pics;
            }
        }
    $file_count count ($files);
    sort ($files);
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"../pics/index.php?action=pics&amp;sid=$sid&amp;script=xhtml\">Gallery($file_count)</a><br/>";
      
    //echo "<a href=\"shop.php?action=shop&amp;sid=$sid\">»Plusses Shop</a><br/>";
      
    echo "<b>8 </b><a accesskey=\"8\" href=\"linksites.php?sid=$sid\">Links</a><br/>";
      echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=logout&amp;sid=$sid&amp;who=$uid\">Logout</a>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<a href=\"quiz.php?action=quiz&amp;sid=$sid\">Quiz</a><br/>";
      echo 
    "<a href=\"index.php?action=search&amp;sid=$sid\">Search</a><br/>";
      echo 
    "<a href=\"lists.php?action=smilies&amp;sid=$sid\">Smilies List</a><br/>";
      
    $downloads mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_uploads"));
      echo 
    "<a href=\"../uploaded/index.php?sid=$sid&amp;site=web\">Downloads($downloads[0])</a><br/>";
      echo 
    "<a href=\"index.php?action=funm&amp;sid=$sid\">Fun n Games</a><br/>";
      
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
      echo 
    "Members:<a href=\"lists.php?action=members&amp;sid=$sid\">$norm[0]</a><br/>";
      
    $noi2 mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE perm>'0'"));
      
    $timeout 300;
      
    $timeon time()-$timeout;
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'"));
      echo 
    "Staff List: <a href=\"index.php?action=stfol&amp;sid=$sid\">".$noi[0]."/$noi2[0]</a></p>";
      echo 
    "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"banner\"/></p>";
      echo 
    "<p align=\"center\">";  
    if(
    ismod($uid))
      {
      echo 
    "<p align=\"center\"><a href=\"staffinfo.php?sid=$sid\">Staff Rules and Info</a><br/>";
      }
      echo 
    "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo 
    "<a href=\"index.php?action=stats&amp;sid=$sid\">Site Stats</a></p>";
      echo 
    mobads();
      echo 
    "<center><a href=\"hosting.php?sid=$sid\">Hosting</a></center>";
      echo 
    "<div><b>©2007<br/>$sitename</b></div>";
      echo 
    "</body>";
    }
    ///////////////////////////Logout///////////////////////////////

    else if($action=="logout")
    {
      
    $who $_GET["who"];
      
    $user getnick_uid($who);
      echo 
    "<head>";
      echo 
    "<title>Logout</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      
    $uid getuid_sid($sid);
      if(
    $who!=$uid){ 
      echo 
    "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
      echo 
    "<br/>$user, U Cannot Log Someone Out<br/>This Is An Attempt To Breach Site Security<br/>If U Are Caught Trying This Again U Will Be Banned<br/>";
      echo 
    "<br/><a accesskey=\"1\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Ok!</a>";
      echo 
    "</p>";
      }else{
      echo 
    "<br/>";
      
    $res mysql_query("DELETE FROM ibwf_ses WHERE uid='".$who."'");
      if(
    $res)
      {
      
    addonline($who,"Logging Out","");
      echo 
    "<img src=\"../images/ok.gif\" alt=\"O\"/><b>$user</b><br/>U Hav Successfully Logged Out Pls Come Back Soon :o)<br/>";
      }else{
      echo 
    "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Logging Out";
      }
      echo 
    "<br/><a accesskey=\"1\" href=\"index.php\"><img src=\"../images/home.gif\" alt=\"\"/>ok!</a>";
      echo 
    "</p>";
      }
      echo 
    "</body>";
    }
    ///////////////////////////////////

    else if($action=="forumindx")
    {
      
    addonline(getuid_sid($sid),"Forum Index","index.php?action=$action");
      
    $sid $_GET["sid"];
      
    $uid getuid_sid($sid);
      echo 
    "<head>";
      echo 
    "<title>Forum Index</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p>";
      echo 
    "<b>Our Forum Categories</b><br/>";
      
    $fcats mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id");
      
    $iml "<img src=\"../images/1.gif\" alt=\"\"/>";
      while(
    $fcat=mysql_fetch_array($fcats))
      {
        
    $catlink "<a href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$fcat[0]\">$iml$fcat[1]</a>";
        echo 
    "<br/>$catlink";
        
    $forums mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$fcat[0]."' AND clubid='0' ORDER BY position, id, name");
        if(
    getfview()==0)
        {
        echo 
    "<br/>";
        while(
    $forum=mysql_fetch_array($forums))
            {
      
    $notp mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      
    $nops mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
          echo 
    "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$forum[1]($notp[0]/$nops[0])</a><br/>";
          }
        }
      }
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    ///////////////////////////////////

    else if($action=="clmop")
    {
        
    $clid $_GET["clid"];
        
    $who $_GET["who"];
        
    addonline(getuid_sid($sid),"Moderating Club Member","");
          echo 
    "<head>";
          echo 
    "<title>Moderate Member</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo 
    "</head>";
          echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $whnick getnick_uid($who);
        echo 
    "<b>$whnick</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        
    $exs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
    $cow mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
    if(
    $exs[0]>&& $cow[0]>0)
    {
        echo 
    "<b>7 </b><a accesskey=\"7\" href=\"genproc.php?action=dcm&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">»Kick $whnick out</a><br/>";
        echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gcp&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">»$whnick's Club Points</a><br/>";
        echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=gpl&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">»Give $whnick Plusses</a><br/>";
        }else{
          echo 
    "<img src=\"../images/notok.gif\" alt=\"X\"/>Missing Info!";
        }
        echo 
    "</p>";

        echo 
    "<p align=\"center\">";

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="gcp")
    {
        
    $clid $_GET["clid"];
        
    $who $_GET["who"];
        
    addonline(getuid_sid($sid),"Moderating Club Member","");
          echo 
    "<head>";
          echo 
    "<title>Moderate Member</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo 
    "</head>";
          echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $whnick getnick_uid($who);
        echo 
    "<b>$whnick</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        
    $exs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
    $cow mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
    if(
    $exs[0]>&& $cow[0]>0)
    {
        echo 
    "<form action=\"genproc.php?action=gcp&amp;sid=$sid&amp;who=$who&amp;clid=$clid\" method=\"post\">";
        echo 
    "Action: <select name=\"giv\">";
        echo 
    "<option value=\"1\">Add</option>";
        echo 
    "<option value=\"0\">Subtract</option>";
        echo 
    "</select><br/>";
        echo 
    "Points: <input name=\"pnt\" style=\"-wap-input-format: '*N'\" size=\"2\" maxlength=\"2\"/><br/>";
        echo 
    "<input type=\"submit\" value=\"GO\"/>";
        echo 
    "</form>";
        }else{
        echo 
    "<img src=\"../images/notok.gif\" alt=\"X\"/>Missing Info!";
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="gpl")
    {
        
    $clid $_GET["clid"];
        
    $who $_GET["who"];
        
    addonline(getuid_sid($sid),"Moderating Club Member","");
          echo 
    "<head>";
          echo 
    "<title>Moderate Member</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo 
    "</head>";
          echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $whnick getnick_uid($who);
        echo 
    "<b>$whnick</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        
    $exs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
    $cow mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
    if(
    $exs[0]>&& $cow[0]>0)
    {
        echo 
    "<small><img src=\"../images/point.gif\" alt=\"!\"/>You can only give plusses, these are real plusses, you can't subtract plusses<br/>";
        
    $cpl mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_clubs WHERE id='".$clid."'"));
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Your club plusses credit is $cpl[0]<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Do not abuse giving of plusses to users, your club could be deleted<br/></small><br/>";
        echo 
    "<form action=\"genproc.php?action=gpl&amp;sid=$sid&amp;who=$who&amp;clid=$clid\" method=\"post\">";
        echo 
    "Plusses: <input name=\"pnt\" style=\"-wap-input-format: '*N'\" size=\"2\" maxlength=\"2\"/><br/>";
        echo 
    "<input type=\"submit\" value=\"GO\"/>";    
        echo 
    "</form>";
        }else{
          echo 
    "<img src=\"../images/notok.gif\" alt=\"X\"/>Missing Info!";
        }
        echo 
    "</p>";

        echo 
    "<p align=\"center\">";

        echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    ///////////////////////////////////Control Panel

    else if($action=="cpanel")
    {
      
    addonline(getuid_sid($sid),"User Settings","index.php?action=cpanel");
      echo 
    "<head>";
      echo 
    "<title>Settings</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<img src=\"../images/cpanel.gif\" alt=\"CPanel\"/><br/>";
      echo 
    "<b>Control Panel</b>";
      echo 
    "</p>";
      echo 
    "<p>";
      echo 
    "<br/><b>---General Options---</b><br/>";
      echo 
    "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$uid\">»View Your Profile</a><br/>";
      echo 
    "<a href=\"index.php?action=uset&amp;sid=$sid\">»Update Profile</a><br/>";
      echo 
    "<a href=\"index.php?action=chngpass&amp;sid=$sid\">»Change Password</a><br/>";
      echo 
    "<a href=\"index.php?action=uxset&amp;sid=$sid\">»Extended Settings</a><br/>";
      echo 
    "<a href=\"index.php?action=pws&amp;sid=$sid\">»Personal Wap site</a><br/>";
      
    $popmsgs mysql_fetch_array(mysql_query("SELECT popmsg FROM ibwf_users WHERE id='".$uid."'"));
      if(
    $popmsgs[0]==0){
      echo 
    "<a href=\"index.php?action=popenable&amp;sid=$sid\">»Enable Pop-ups</a><br/>";
      }else{
      echo 
    "<a href=\"index.php?action=popdisable&amp;sid=$sid\">»Disable Pop-ups</a><br/>";
      }
      if(
    automsgs($uid)){
      echo 
    "<a href=\"index.php?action=automsgsoff&amp;sid=$sid\">»Disable Automsgs</a><br/>";
      }else{
      echo 
    "<a href=\"index.php?action=automsgson&amp;sid=$sid\">»Enable Automsgs</a><br/>";
      }
      
    $sml mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".$uid."'"));
      if(
    $sml[0]=="1")
      {
      echo 
    "<a href=\"genproc.php?action=shsml&amp;sid=$sid&amp;act=dis\">»Disable Smilies</a><br/>";
      }else{
      echo 
    "<a href=\"genproc.php?action=shsml&amp;sid=$sid&amp;act=enb\">»Enable Smilies</a><br/>";
      }
      echo 
    "<a href=\"index.php?action=sitethms&amp;sid=$sid\">»Change Theme</a><br/>";
      echo 
    "<br/><b>---Other Options---</b><br/>";
      echo 
    "<a href=\"index.php?action=rwidc&amp;sid=$sid\">»$sitename ID card.</a><br/>";
      echo 
    "<a href=\"index.php?action=myclub&amp;sid=$sid\">»My Clubs</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$uid."'"));
      echo 
    "<a href=\"lists.php?action=vault&amp;sid=$sid&amp;who=$uid\">»My Download Links($noi[0])</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ignore WHERE name='".$uid."'"));
      echo 
    "<a href=\"lists.php?action=ignl&amp;sid=$sid\">»Ignore List($noi[0])</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$uid."'"));
      echo 
    "<a href=\"lists.php?action=gbook&amp;sid=$sid&amp;who=$uid\">»Guestbook($noi[0])</a><br/>";
      echo 
    "<a href=\"index.php?action=poll&amp;sid=$sid\">»My Poll</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$uid."'"));
      echo 
    "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$uid\">»Blogs($noi[0])</a><br/>";
      echo 
    "<a href=\"lists.php?action=chmood&amp;sid=$sid\">»Chatmood</a><br/>";
      echo 
    "<a href=\"lists.php?action=bbcode&amp;sid=$sid\">»BBCode</a><br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";  
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    else if(
    $action=="sitethms")
    {
      
    addonline(getuid_sid($sid),"Site Themes","");
      echo 
    "<head>";
      echo 
    "<title>Site Themes</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>Site Themes</b></p>";
      echo 
    "<p>changing ur site theme will change all the colors of the site eg:<br/>backround, text, links, typing fields etc..<br/>";
      echo 
    "<form action=\"genproc.php?action=updtthme&amp;sid=$sid\" method=\"post\">";
      echo 
    "<select name=\"thms\">";
      echo 
    "<option value=\"white\">White</option>";
      echo 
    "<option value=\"black\">Black</option>";
      echo 
    "<option value=\"red\">Red</option>";
      echo 
    "<option value=\"blue\">Blue</option>";
      echo 
    "<option value=\"green\">Green</option>";
      echo 
    "<option value=\"pink\">Pink</option>";
      echo 
    "</select>";
      echo 
    "<select name=\"size\">";
      echo 
    "<option value=\"small\">Small</option>";
      echo 
    "<option value=\"medium\">Medium</option>";
      echo 
    "<option value=\"large\">Large</option>";
      echo 
    "</select>";
      echo 
    "<input type=\"Submit\" name=\"submit\" Value=\"Save\"></form>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    ///////////////////////////////////Clubs Menu

    else if($action=="clmenu")
    {
        
    addonline(getuid_sid($sid),"Clubs Menu","");
        echo 
    "<head>";
        echo 
    "<title>Clubs Menu</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>Clubs Menu</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        
    $myid getuid_sid($sid);
      echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=clubs&amp;sid=$sid\">»All Clubs</a><br/>";
      echo 
    "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=myclub&amp;sid=$sid\">»My Clubs</a><br/>";
      echo 
    "<b>3 </b><a accesskey=\"3\" href=\"lists.php?action=clm&amp;who=$myid&amp;sid=$sid&amp;who=$uid\">»Clubs I'm a member of</a><br/>";
      echo 
    "<b>4 </b><a accesskey=\"4\" href=\"lists.php?action=pclb&amp;sid=$sid&amp;who=$uid\">»Clubs By popularity</a><br/>";
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"lists.php?action=aclb&amp;sid=$sid&amp;who=$uid\">»Clubs By Activity</a><br/>";
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=rclb&amp;sid=$sid&amp;who=$uid\">»5 Random Clubs</a><br/><br/>";
      
    $ncl mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_clubs ORDER BY created DESC LIMIT 1"));
      echo 
    "The Newest Club Is: <b>* </b><a accesskey=\"*\" href=\"index.php?action=gocl&amp;clid=$ncl[0]&amp;sid=$sid\">".htmlspecialchars($ncl[1])."</a><br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    else if(
    $action=="popread")
    {
        echo 
    "<head>";
        echo 
    "<title>Pop-Up Read</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $lastloc=$_GET["lastloc"];
        
    $pmid=$_GET["pmid"];
       
    $ncl mysql_query("UPDATE ibwf_private SET read='1' WHERE id='".$pmid."'");
      echo 
    "Pm Now Marked As Read Visit Your Inbox To Reply Or delete the message.<br/>";
        echo 
    "</p>";

        echo 
    "<p align=\"center\">";
        if(
    $lastloc=="indxmain"){
        echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">";
        }else if(
    $lastloc=="cht"){
        
    $rid=$_GET["rid"];
        echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid\">";
        }
        echo 
    "Back To Where You Where Before</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="popenable")
    {
        echo 
    "<head>";
        echo 
    "<title>Enable Pop-Up Msgs</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
       
    $ncl mysql_query("UPDATE ibwf_users SET popmsg='1' WHERE id='".$uid."'");
      echo 
    "Pop-Up PMs Have Now Been Enabled On your Profile.<br/>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    else if(
    $action=="popdisable")
    {
        echo 
    "<head>";
        echo 
    "<title>Disable Pop-Up Msgs</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $ncl mysql_query("UPDATE ibwf_users SET popmsg='0' WHERE id='".$uid."'");
        echo 
    "Pop-Up PMs Have Now Been Disabled On your Profile.<br/>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    else if(
    $action=="automsgson")
    {
        echo 
    "<head>";
        echo 
    "<title>Enable Auto Msgs</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $ncl mysql_query("UPDATE ibwf_users SET automsgs='1' WHERE id='".$uid."'");
        echo 
    "Automsgs Have Now Been Enabled.<br/>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    else if(
    $action=="automsgsoff")
    {
        echo 
    "<head>";
        echo 
    "<title>Disable Auto Msgs</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $ncl mysql_query("UPDATE ibwf_users SET automsgs='0' WHERE id='".$uid."'");
        echo 
    "Automsgs Have Now Been Disabled.<br/>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    else if(
    $action=="rwidc")
    {
        
    addonline(getuid_sid($sid),"My $sitename ID","");
        echo 
    "<head>";
        echo 
    "<title>$sitename Id Card</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>$sitename ID card</b><br/>";
        
    $uid getuid_sid($sid);
        echo 
    "<img src=\"../rwidc.php?id=$uid\" alt=\"Id Card\"/><br/><br/>";
        echo 
    "This ID card is updated automatically everytime someone request it, the source to your card is $sitename/rwidc.php?id=$uid<br/><br/>";
        echo 
    "you can use it as an avatar in other sites<br/><br/>";
        echo 
    "To look at others cards view the user profile then go to more information&gt;$sitename ID card.";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    ///////////////////////////////////My Clubs

    else if($action=="myclub")
    {
        
    addonline(getuid_sid($sid),"My Clubs","");
        echo 
    "<head>";
        echo 
    "<title>My Clubs</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>My Clubs</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        
    $uid getuid_sid($sid);
        if(
    getplusses($uid)<500)
        {
          echo 
    "Clubs are small communities that users can create, every community should have things in common, for example a community for goths, sex freaks, alocholics, rappers and anythin else you can think of, currently people who have more than 500 plusses can only create clubs, every user can create up to maximum of 3 clubs, to get plusses post in the forums, or invite friends";
        }else{
          
    $uclubs mysql_query("SELECT id, name FROM ibwf_clubs WHERE owner='".$uid."'");
          while(
    $club=mysql_fetch_array($uclubs))
          {
            echo 
    "<a href=\"index.php?action=gocl&amp;clid=$club[0]&amp;sid=$sid\">$club[1]</a>";
            echo 
    ", <a href=\"genproc.php?action=dlcl&amp;clid=$club[0]&amp;sid=$sid\">[DELETE]</a><br/><br/>";
          }
          
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
          if(
    $noi[0]<3)
          {
          echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=addcl&amp;sid=$sid\">Add Club</a>";
          }
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    ///////////////////////////////////My Clubs

    else if($action=="clubs")
    {
        
    addonline(getuid_sid($sid),"My Clubs List","");
        
        echo 
    "<head>";
        echo 
    "<title>My Clubs List</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>Clubs List</b>";
        echo 
    "</p>";
        
    //////ALL LISTS SCRIPT <<

        
    if($page=="" || $page<=0)$page=1;
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
        
    $num_items $noi[0]; //changable
        
    $items_per_page5;
        
    $num_pages ceil($num_items/$items_per_page);
        if((
    $page>$num_pages)&&$page!=1)$page$num_pages;
        
    $limit_start = ($page-1)*$items_per_page;

        
    //changable sql

            
    $sql "SELECT id, name, owner, description, created FROM ibwf_clubs ORDER BY created DESC LIMIT $limit_start$items_per_page";


        echo 
    "<p>";
        
    $items mysql_query($sql);
        if(
    mysql_num_rows($items)>0)
        {
        while (
    $item mysql_fetch_array($items))
        {
            
    $item[1]=htmlspecialchars($item[1]);
            
    $mems mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$item[0]."' AND accepted='1'"));
          
    $lnk "<a href=\"index.php?action=gocl&amp;clid=$item[0]&amp;sid=$sid\">$item[1]($mems[0])</a> <small>Owner: <a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">".getnick_uid($item[2])."</a></small>";
          echo 
    "$lnk<br/><small>";
          echo 
    htmlspecialchars($item[3])."<br/>Creation Date: (".date("d/m/y"$item[4]).")</small><br/><br/>";
        }
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        if(
    $page>1)
        {
          
    $ppage $page-1;
          echo 
    "<a href=\"index.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;view=$view\">«PREV</a> ";
        }
        if(
    $page<$num_pages)
        {
          
    $npage $page+1;
          echo 
    "<a href=\"index.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;view=$view\">Next»</a>";
        }
        echo 
    "<br/>$page/$num_pages<br/>";
        if(
    $num_pages>2)
        {
            
    $rets "<form action=\"index.php\" method=\"get\">";
            
    $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"3\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
            
    $rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
            
    $rets .= "</form>";

            echo 
    $rets;
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="gocl")
    {
      
    $clid $_GET["clid"];
      
    $clinfo mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$clid."'"));
        
    addonline(getuid_sid($sid),"Viewing A Club","");
        
    $clnm htmlspecialchars($clinfo[0]);
        echo 
    "<head>";
        echo 
    "<title>$Clnm</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>$clnm</b><br/>";
        if(
    trim($clinfo[4])=="")
        {
          echo 
    "<img src=\"../images/logo.gif\" alt=\"logo\"/>";
        }else{
            echo 
    "<img src=\"$clinfo[4]\" alt=\"logo\"/>";
        }
        echo 
    "</p>";
        echo 
    "<p>";
        echo 
    "Club ID: <b>$clid</b><br/>";
        
    $uid getuid_sid($sid);
        
    $cango mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND uid='".$uid."' AND accepted='1'"));
        echo 
    "Owner: <a href=\"index.php?action=viewuser&amp;who=$clinfo[1]&amp;sid=$sid\">".getnick_uid($clinfo[1])."</a><br/>";
          
    $mems mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='1'"));
          echo 
    "Members: <a href=\"lists.php?action=clmem&amp;sid=$sid&amp;clid=$clid\">$mems[0]</a><br/>";
          echo 
    "Created On: ".date("d/m/y"$clinfo[6])."<br/>";
          echo 
    "Plusses credit: $clinfo[5]<br/>";
          
    $fid mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$clid."'"));
          
    $rid mysql_fetch_array(mysql_query("SELECT id FROM ibwf_rooms WHERE clubid='".$clid."'"));
          
    $tps mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid[0]."'"));
          
    $pss mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$fid[0]."'"));
          
        if((
    $cango[0]>0)||isadmin($uid))
        {
                    if(
    $clid==161) {
                echo 
    "<a href=\"http://www.$sitename/clubs/royal/index.php?sid=$sid&amp;site=wap\">Royal X Uploader</a><br/>";
        }
            
    $noa mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE clid='".$clid."'"));
            echo 
    "<br/><b>1 </b><a accesskey=\"1\" href=\"lists.php?action=annc&amp;sid=$sid&amp;clid=$clid\"><img src=\"../images/annc.gif\" alt=\"!\"/>Announcements($noa[0])</a><br/>";
            
    $noa mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE rid='".$rid[0]."'"));
            echo 
    "<b>2 </b><a accesskey=\"2\" href=\"chat.php?sid=$sid&amp;rid=$rid[0]\"><img src=\"../images/chat.gif\" alt=\"*\"/>$clnm Chat($noa[0])</a><br/>";
            echo 
    "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid[0]\"><img src=\"../images/1.gif\" alt=\"*\"/>$clnm Forum($tps[0]/$pss[0])</a><br/><br/>";
            
    $ismem mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND uid='".getuid_sid($sid)."'"));
            
            if(
    $ismem[0]>0)
            {
                
    //unjoin 
                
    if($clinfo[1]!=$uid)
                {
                    echo 
    "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=unjc&amp;sid=$sid&amp;clid=$clid\">Unjoin Club</a>";
                }
            }else{
                echo 
    "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$clid\">Join Now!</a>";
            }
            if(
    isowner(getuid_sid($sid)))
            {
                echo 
    "<br/><b>5 </b><a accesskey=\"5\" href=\"admincp.php?action=club&amp;sid=$sid&amp;clid=$clid\">Admin Tools</a>";
            }
            if(
    $clinfo[1]==$uid)
          {
            
    //club owner
            
    $mems mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='0'"));
            echo 
    "<br/><b>6 </b><a accesskey=\"6\" href=\"lists.php?action=clreq&amp;sid=$sid&amp;clid=$clid\">»Requests($mems[0])</a><br/>";
          }
        }else{
          echo 
    "Topics: <b>$tps[0]</b>, Posts: <b>$pss[0]</b><br/>";
          echo 
    "<b>Description:</b><br/>";
          echo 
    htmlspecialchars($clinfo[2]);
          echo 
    "<br/><br/>";
          echo 
    "<b>Rules:</b><br/>";
          echo 
    htmlspecialchars($clinfo[3]);
          echo 
    "<br/><br/>";
          echo 
    "Seems Good? <b>1 </b><a accesskey=\"1\" href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$clid\">Join Now!</a>";
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=clubs&amp;sid=$sid\">Clubs list</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="addcl")
    {
        
    addonline(getuid_sid($sid),"Adding A Club","");
        echo 
    "<head>";
        echo 
    "<title>Adding A Club</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<b>Add Club</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        if(
    getplusses($uid)>=500)
        {
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
          if(
    $noi[0]<3)
          {
            echo 
    "<small><img src=\"../images/point.gif\" alt=\"*\"/>All Info are required except the logo<br/>";
            echo 
    "<img src=\"../images/point.gif\" alt=\"*\"/>Beside you, mods can moderate your club forums and chat<br/>";
            echo 
    "<img src=\"../images/point.gif\" alt=\"*\"/>Any leading spaces for description, name, logo, or rules will be removed<br/>";
            echo 
    "<img src=\"../images/point.gif\" alt=\"*\"/>Admins will delete your club and subtract your plusses if you abuse the rules of owning a club<br/>";
            echo 
    "<img src=\"../images/point.gif\" alt=\"*\"/>Admins have the right to delete your club if it wasnt active or if it was useless<br/></small><br/>";
            echo 
    "<form action=\"genproc.php?action=addcl&amp;sid=$sid\" method=\"post\">";
            echo 
    "Club Name:<input name=\"clnm\" maxlength=\"30\"/><br/>";
            echo 
    "Description:<input name=\"clds\" maxlength=\"200\"/><br/>";
            echo 
    "Rules:<input name=\"clrl\" maxlength=\"500\"/><br/>";
            echo 
    "Logo:<input name=\"cllg\" maxlength=\"200\"/><br/>";
            echo 
    "<input type=\"submit\" value=\"Create\"/>";        
           echo 
    "</form>";
          }else{
            echo 
    "You already have 3 clubs";
          }
          }else{

          echo 
    "You cant add any clubs :op ";
          }
        echo 
    "</p>";

        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    ///////////////////////////////////Search

    else if($action=="search")
    {
        
    addonline(getuid_sid($sid),"Searching For Something","");
        echo 
    "<head>";
        echo 
    "<title>Search Menu</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<img src=\"../images/search.gif\" alt=\"*\"/><br/>";
        echo 
    "<b>Search Menu</b>";
        echo 
    "</p>";
        echo 
    "<p>";
        echo 
    "<b>1 </b><a accesskey=\"1\" href=\"search.php?action=tpc&amp;sid=$sid\">»In Topics</a><br/>";
        echo 
    "<b>2 </b><a accesskey=\"2\" href=\"search.php?action=blg&amp;sid=$sid\">»In Blogs</a><br/>";
        echo 
    "<b>3 </b><a accesskey=\"3\" href=\"search.php?action=nbx&amp;sid=$sid\">»In My Inbox</a><br/>";
        echo 
    "<b>4 </b><a accesskey=\"4\" href=\"search.php?action=clb&amp;sid=$sid\">»In Clubs</a><br/><br/>";
        echo 
    "Find Members:<br/>";
        echo 
    "<b>5 </b><a accesskey=\"5\" href=\"search.php?action=mbrn&amp;sid=$sid\">»In Nicknames</a><br/>";
        
    //echo "<b>6 </b><a accesskey=\"6\" href=\"search.php?action=mbrl&amp;sid=$sid\">»In Location</a><br/>";
        //echo "<b>7 </b><a accesskey=\"7\" href=\"search.php?action=mbrs&amp;sid=$sid\">»By sex orientation</a><br/>";
        
    echo "More search options for members are to come<br/>";
        echo 
    "<br/><small>or you can just type the Username of the member and view its profile</small><br/>";
        echo 
    "<br/>Username:<br/>";
    echo 
    "<form action=\"index.php?action=viewuser&amp;sid=$sid\" method=\"post\">";
        echo 
    "<br/><input name=\"mnick\" maxlength=\"15\"/><br/>";
    echo 
    "<input type=\"submit\" value=\"View\"/>";
        echo 
    "</form>";

      echo 
    "</p>";

        echo 
    "<p align=\"center\">";

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    ///////////////////////////////////Settings

    else if($action=="uset")
    {
      
    addonline(getuid_sid($sid),"User Settings","");
      echo 
    "<head>";
      echo 
    "<title>User Settings</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      
    $uid getuid_sid($sid);
      
    $avat getavatar($uid);
      
    $email mysql_fetch_array(mysql_query("SELECT email FROM ibwf_users WHERE id='".$uid."'"));
      
    $bdy mysql_fetch_array(mysql_query("SELECT birthday FROM ibwf_users WHERE id='".$uid."'"));
      
    $uloc mysql_fetch_array(mysql_query("SELECT location FROM ibwf_users WHERE id='".$uid."'"));
      
    $usig mysql_fetch_array(mysql_query("SELECT signature FROM ibwf_users WHERE id='".$uid."'"));
      
    $sx mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
      
    $uloc[0] = htmlspecialchars($uloc[0]);
      echo 
    "<p align=\"center\">";
      echo 
    "<b>Settings</b>";
      echo 
    "</p>";
      echo 
    "<p>";
      echo 
    "<form action=\"genproc.php?action=uprof&amp;sid=$sid\" method=\"post\">";
      echo 
    "Profile Pic: <input name=\"savat\" maxlength=\"100\" value=\"$avat\"/><br/>";
      echo 
    "E-Mail: <input name=\"semail\" maxlength=\"100\" value=\"$email[0]\"/><br/>";
      echo 
    "Birthday(YYYY-MM-DD): <input name=\"ubday\" maxlength=\"50\" value=\"$bdy[0]\"/><br/>";
      echo 
    "Location: <input name=\"uloc\" maxlength=\"50\" value=\"$uloc[0]\"/><br/>";
      echo 
    "Info: <input name=\"usig\" maxlength=\"100\" value=\"$usig[0]\"/><br/>";
      echo 
    "Sex: <select name=\"usex\" value=\"$sx[0]\">";
      echo 
    "<option value=\"M\">Male</option>";
      echo 
    "<option value=\"F\">Female</option>";
      echo 
    "</select><br/>";
      echo 
    "<input type=\"submit\" value=\"Update\"/>";
      echo 
    "</form>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    ///////////////////////////////////Settings

    else if($action=="chngpass")
    {
      
    addonline(getuid_sid($sid),"User Settings","");
      echo 
    "<head>";
      echo 
    "<title>User Settings</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>Change Password</b>";
      echo 
    "</p>";
      echo 
    "<p>";
      echo 
    "<form action=\"genproc.php?action=upwd&amp;sid=$sid\" method=\"post\">";
      echo 
    "Old Password: <input type=\"password\" name=\"opwd\" style=\"-wap-input-format: '*x'\" maxlength=\"15\"/><br/>";
      echo 
    "Password: <input type=\"password\" name=\"npwd\" style=\"-wap-input-format: '*x'\" maxlength=\"15\"/><br/>";
      echo 
    "Password again: <input type=\"password\" name=\"cpwd\" style=\"-wap-input-format: '*x'\" maxlength=\"15\"/><br/>";
      echo 
    "<input type=\"submit\" value=\"Change\"/>";
      echo 
    "</form><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
    }

    ///////////////////////////////////Poll Topic
    else if($action=="poll")
    {
        
    addonline(getuid_sid($sid),"Administrating Poll","");
        echo 
    "<head>";
        echo 
    "<title>Your Poll</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        
    $uid getuid_sid($sid);
        if(
    getplusses($uid)<50)
        {
          echo 
    "Minimum plusses required to administrate your poll is 50 plusses";
        }else{
            
    $pid mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
            if(
    $pid[0] == 0)
            {
              echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=crpoll&amp;sid=$sid\">Create Poll</a>";
            }else{
              echo 
    "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=viewpl&amp;sid=$sid&amp;who=$uid\">View Your Poll</a><br/>";
                echo 
    "<b>3 </b><a accesskey=\"3\" href=\"genproc.php?action=dlpoll&amp;sid=$sid\">Delete Your Poll</a><br/>";
            }
        }
        echo 
    "</p>";
        
        echo 
    "<p align=\"center\">";

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
        
    }else if(
    $action=="crpoll")
    {
        
    addonline(getuid_sid($sid),"Creating A New Poll","");
        echo 
    "<head>";
        echo 
    "<title>Create Poll</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        if(
    getplusses(getuid_sid($sid))>=50)
        {
        
    $pid mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
            if(
    $pid[0] == 0)
            {
    echo 
    "<form action=\"genproc.php?action=crpoll&amp;sid=$sid\" method=\"post\">";

              echo 
    "Question:<input name=\"pques\" maxlength=\"250\"/><br/>";
              echo 
    "Option 1:<input name=\"opt1\" maxlength=\"100\"/><br/>";
              echo 
    "Option 2:<input name=\"opt2\" maxlength=\"100\"/><br/>";
              echo 
    "Option 3:<input name=\"opt3\" maxlength=\"100\"/><br/>";
              echo 
    "Option 4:<input name=\"opt4\" maxlength=\"100\"/><br/>";
              echo 
    "Option 5:<input name=\"opt5\" maxlength=\"100\"/><br/>";
    echo 
    "<input type=\"submit\" value=\"Create\"/>";          
    echo 
    "</form>";
              }else{
                echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>You already have a poll, delete your current one before adding a new one";
              }
              }else{
                echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>You should have at least 50 plusses to create a poll";
              }
        echo 
    "</p>";

        echo 
    "<p align=\"center\">";

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }
    else if(
    $action=="pws")
    {
        
    addonline(getuid_sid($sid),"My Personal Wap Site","");
        echo 
    "<head>";
        echo 
    "<title>My Personal Wap Site</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        echo 
    "»Welcome Image<br/>";
        echo 
    "<small>The image on main page<br/>";
        echo 
    "In Image field: type smilie code for smilie like -hi-, the image URL for external image, leave blank for other options</small><br/>";
        echo 
    "<form action=\"genproc.php?action=pws&amp;sid=$sid\" method=\"post\">";
        echo 
    "<select name=\"imgt\">";
        echo 
    "<option value=\"idc\">My ID Card</option>";
        echo 
    "<option value=\"avt\">My Current Avatar</option>";
        echo 
    "<option value=\"sml\">Smilie</option>";
        echo 
    "<option value=\"ilk\">Image URL</option>";
        echo 
    "</select><br/>";
        echo 
    "Image:<input name=\"imgo\" maxlength=\"200\"/><br/><br/>";
        echo 
    "»Welcome Message<br/>";
        echo 
    "<small>The message that appears on first page of your site, smilies are allowed</small><br/>";
        echo 
    "Message:<input name=\"smsg\" maxlength=\"250\"/><br/><br/>";
        echo 
    "»Theme<br/>";
        echo 
    "<small>Themes available only on phones supporting XHTML</small><br/>";
        echo 
    "<select name=\"thms\">";
        
    $themes mysql_query("SELECT id, name FROM ibwf_themes");
        while (
    $theme mysql_fetch_array($themes))
        {
        echo 
    "<option value=\"$theme[0]\">".htmlspecialchars($theme[1])."</option>";
        }
        echo 
    "</select><br/>";
        echo 
    "<input type=\"Submit\" Name=\"Update\" Value=\"Update\"></form>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="pltpc")
    {
      
    $tid $_GET["tid"];
        
    addonline(getuid_sid($sid),"Creating A Poll","");
        echo 
    "<head>";
        echo 
    "<title>Creating A Poll</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        if((
    getplusses(getuid_sid($sid))>=500)||ismod($uid))
        {
        
    $pid mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
            if(
    $pid[0] == 0)
            {
            echo 
    "<form action=\"genproc.php?action=pltpc&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
              echo 
    "Question:<input name=\"pques\" maxlength=\"250\"/><br/>";
              echo 
    "Option 1:<input name=\"opt1\" maxlength=\"100\"/><br/>";
              echo 
    "Option 2:<input name=\"opt2\" maxlength=\"100\"/><br/>";
              echo 
    "Option 3:<input name=\"opt3\" maxlength=\"100\"/><br/>";
              echo 
    "Option 4:<input name=\"opt4\" maxlength=\"100\"/><br/>";
              echo 
    "Option 5:<input name=\"opt5\" maxlength=\"100\"/><br/>";
              echo 
    "<input type=\"Submit\" name=\"Create\" Value=\"Create\"></form>";
              }else{
                echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>The topic already have a poll";
              }
              }else{
                echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>You should have at least 500 plusses to create a poll";
              }
        echo 
    "</p>";

        echo 
    "<p align=\"center\">";

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="stats")
    {
        
    addonline(getuid_sid($sid),"Site stats","index.php?action=stats");
        echo 
    "<head>";
        echo 
    "<title>Site Stats</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    popup($sid);
        echo 
    "<p align=\"center\">";
        
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
        echo 
    "Registered Members: <b>$norm[0]</b> ";
        
    $memid mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
        echo 
    "The Newsest Member is: <b><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a></b><br/>";
        
    $mols mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
        echo 
    "Most Users Online: <b>$mols[1]</b> Members on $mols[0]<br/>";
        
    $mols mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
        echo 
    "Most Users Online(<a href=\"lists.php?action=moto&amp;sid=$sid\"> For today only</a>): <b>$mols[0]</b> Members at $mols[1]<br/>";
        
    $tm24 time() - (24*60*60);
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
        echo 
    mysql_error();
        echo 
    "Active users today <b>$aut[0]</b><br/>";
        
    $notc mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
        
    $nops mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
        echo 
    "Number of Topics: <b>$notc[0]</b> - Number of Posts: <b>$nops[0]</b><br/>";
        
    $nopm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private"));
        echo 
    "Number of Inboxes: <b>$nopm[0]</b><br/>";
        
    $nopm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups"));
        echo 
    "Number of Popups: <b>$nopm[0]</b><br/>";
        
    $nopm mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='Counter'"));
        echo 
    "Counter: <b>$nopm[0]</b>";
         echo 
    "</p>";
        echo 
    "<p>";
        
    //echo "<a href=\"index.php?action=l24&amp;sid=$sid\">»Whats Happened Here In Last 24 Hours</a><br/>";
        
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
        echo 
    "<a href=\"lists.php?action=members&amp;sid=$sid\">»Members($norm[0])</a><br/>";
        
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='M'"));

        echo 
    "<a href=\"lists.php?action=males&amp;sid=$sid\">-»Males($norm[0])</a><br/>";
        
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='F'"));
        echo 
    "<a href=\"lists.php?action=fems&amp;sid=$sid\">-»Females($norm[0])</a><br/>";

        
    $tbday=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
        echo 
    "<a href=\"lists.php?action=bdy&amp;sid=$sid\">»Today's Birthday($tbday[0])</a><br/>";
        
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs"));
        echo 
    "<a href=\"lists.php?action=allbl&amp;sid=$sid\">»Blogs($noi[0])</a><br/>";
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE pollid>'0'"));
        echo 
    "<a href=\"lists.php?action=polls&amp;sid=$sid\">»Polls($noi[0])</a><br/>";
        echo 
    "<a href=\"lists.php?action=topp&amp;sid=$sid\">»Top Posters</a><br/>";
        echo 
    "<a href=\"lists.php?action=tchat&amp;sid=$sid\">»Top Chatters</a><br/>";
        echo 
    "<a href=\"lists.php?action=tgame&amp;sid=$sid\">»Top Gamers</a><br/>";
        echo 
    "<a href=\"lists.php?action=topb&amp;sid=$sid\">»Top Battlers</a><br/>";
        echo 
    "<a href=\"lists.php?action=tshout&amp;sid=$sid\">»Top Shouters</a><br/>";
        
    $nobr=mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT browserm) FROM ibwf_users WHERE browserm IS NOT NULL "));
        echo 
    "<a href=\"lists.php?action=brows&amp;sid=$sid\">»Browsers($nobr[0])</a><br/>";
        
    $noi mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_judges"));
        echo 
    "<a href=\"lists.php?action=judg&amp;sid=$sid\">»Battles Judges($noi[0])</a>";

       
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
          echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    else if(
    $action=="l24")
    {
        
    addonline(getuid_sid($sid),"Site stats","");
        echo 
    "<head>";
        echo 
    "<title>Site Stats</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        
    /////
        
    echo "Things that have happened in $sitename during last 24 hours<br/><br/>";
        
    $tm24 time() - (24*60*60);
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
        echo 
    "Active Members: <b>$aut[0]</b><br/>";
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE regdate>'".$tm24."'"));
        echo 
    "Registered Members: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bgdate>'".$tm24."'"));
        echo 
    "Blogs Created: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE joined>'".$tm24."' AND accepted='1'"));
        echo 
    "Members Joined Clubs: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE created>'".$tm24."'"));
        echo 
    "Clubs Created: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE reqdt>'".$tm24."' AND agreed='1'"));
        echo 
    "Buddies Added: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE dtime>'".$tm24."'"));
        echo 
    "Guestbooks Signed: <b>$aut[0]</b><br/>";
        if(
    ismod(getuid_sid($sid))){
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog WHERE actdt>'".$tm24."'"));
        echo 
    "ModLog Actions: <b>$aut[0]</b><br/>";
      }
      
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_polls WHERE pdt>'".$tm24."'"));
        echo 
    "Polls Added: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE dtpost>'".$tm24."'"));
        echo 
    "Posts: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE timesent>'".$tm24."'"));
        echo 
    "PMs Sent: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shtime>'".$tm24."'"));
        echo 
    "Shouts: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE crdate>'".$tm24."'"));
        echo 
    "Topics Created: <b>$aut[0]</b><br/>";
        
    $aut mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE pudt>'".$tm24."'"));
        echo 
    "Vault Items Added: <b>$aut[0]</b><br/>;";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";

    echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=stats&amp;sid=$sid\">Statistics</a><br/>";
      echo 
    "<br/><b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////View category

    else if($action=="viewcat")
    {

      
    $cid $_GET["cid"];
      
    addonline(getuid_sid($sid),"Viewing Forum Category","index.php?action=viewcat&amp;cid=$cid");
      
    $cinfo mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));
      echo 
    "<head>";
      echo 
    "<title>$cinfo[0]</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      
    //echo "<div><img src=\"logos/forums.gif\" alt=\"Forums\"/></div>";
      
    echo popup($sid);
      
    $umsg getunreadpm(getuid_sid($sid));
      if(
    $umsg>0)
      {
      echo 
    "<p align=\"center\">";
      echo 
    "<br/><b>6 </b><a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a>";
      echo 
    "</p>";
      }
      
    $forums mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name");
      
    //echo "<b>$cinfo[0]</b></p><br/>";
      
    echo "<p>";
      while(
    $forum mysql_fetch_array($forums))
      {
      
    $notp mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      
    $nops mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
      
    $iml "<img src=\"../images/1.gif\" alt=\"*\"/>";
      echo 
    "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$iml$forum[1]($notp[0]/$nops[0])</a><br/>";
      
    $lpt mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics WHERE fid='".$forum[0]."' ORDER BY lastpost DESC LIMIT 0,1"));
      
    $nops mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$lpt[0]."'"));
      if(
    $nops[0]==0)
      {
      
    $pinfo mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$lpt[0]."'"));
      
    $tluid $pinfo[0];
      }else{
      
    $pinfo mysql_fetch_array(mysql_query("SELECT  uid  FROM ibwf_posts WHERE tid='".$lpt[0]."' ORDER BY dtpost DESC LIMIT 0, 1"));
      
    $tluid $pinfo[0];
      }
      
    $tlnm htmlspecialchars($lpt[1]);
      
    $tlnick getnick_uid($tluid);
      
    $tpclnk "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$lpt[0]&amp;go=last\">$tlnm</a>";
      
    $vulnk "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$tluid\">$tlnick</a>";
      if(
    $pinfo[0]>0)
      {
      echo 
    "Last Post: $tpclnk<br/>By: $vulnk<br/>";
      }
      }
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      echo 
    forumlink($sid,9);
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    //////////////////////////////////View Topic

    else if($action=="viewtpc")
    {
      
    $tid $_GET["tid"];
      
    $go $_GET["go"];
      
    addonline(getuid_sid($sid),"Viewing Forum Topic","index.php?action=viewtpc&amp;tid=$tid");
      
    $tfid mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
      if(!
    canaccess(getuid_sid($sid), $tfid[0]))
        {
        echo 
    "<head>";
        echo 
    "<title>View Topic</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        
        
    $tinfo mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
        
    $tnm htmlspecialchars($tinfo[0]);
        echo 
    "<head>";
        echo 
    "<title>View Topic</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    popup($sid);
        echo 
    "<p align=\"center\">";
        
    $umsg getunreadpm(getuid_sid($sid));
        if(
    $umsg>0)
        {
        echo 
    "<br/><b>6 </b><a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a><br/>";
        }
        
    $num_pages getnumpages($tid);
        if(
    $page==""||$page<1)$page=1;
        if(
    $go!="")$page=getpage_go($go,$tid);
        
    $posts_per_page 5;
        if(
    $page>$num_pages)$page=$num_pages;
        
    $limit_start $posts_per_page *($page-1);
        echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid\">Post reply</a>";
        
    $lastlink "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=$action&amp;tid=$tid&amp;sid=$sid&amp;go=last\">Last Page</a>";
        
    $firstlink "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=$action&amp;tid=$tid&amp;sid=$sid&amp;page=1\">First Page</a> ";
        
    $golink "";
        if(
    $page>1)
        {
          
    $golink $firstlink;
        }
        if(
    $page<$num_pages)
        {
          
    $golink .= $lastlink;
        }
        if(
    $golink !="")
        {
          echo 
    "<br/>$golink";
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        
    $vws $tinfo[4]+1;
        
    $rpls mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
        echo 
    "Replies: $rpls[0] - Views: $vws<br/>";
        
    ///fm here
        
        
    if($page==1)
        {
          
    $posts_per_page=4;
          
    mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE  id='".$tid."'");
          
    $ttext mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
          
    $unick getnick_uid($ttext[0]);
          if(
    isonline($ttext[0]))
        {
          
    $iml "<img src=\"../images/onl.gif\" alt=\"+\"/>";
        }else{
            
    $iml "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
        }
        
    $usl "<br/><a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\">$iml$unick</a>";
        
    $topt "<a href=\"index.php?action=tpcopt&amp;sid=$sid&amp;tid=$tid\">*</a>";
        if(
    $go==$tid)
        {
          
    $fli "<img src=\"../images/flag.gif\" alt=\"!\"/>";
        }else{
          
    $fli ="";
        }
        
    $pst parsemsg($ttext[1],$sid);
        echo 
    "$usl$fli$pst $topt<br/>";
        
    $dtot date("d-m-y - H:i:s",$ttext[2]);
        echo 
    $dtot;
        echo 
    "<br/>";
        if(
    $ttext[3]>0)
        {
          echo 
    "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=viewtpl&amp;sid=$sid&amp;who=$tid\">POLL</a><br/>";
        }
      }
      if(
    $page>1)
      {
        
    $limit_start--;
      }
      
    $sql "SELECT id, text, uid, dtpost, quote FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start$posts_per_page";
      
    $posts mysql_query($sql);
      while(
    $post mysql_fetch_array($posts))
      {
        
    $unick getnick_uid($post[2]);
        if(
    isonline($post[2]))
        {
          
    $iml "<img src=\"../images/onl.gif\" alt=\"+\"/>";
        }else{
            
    $iml "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
        }
        
    $usl "<br/><a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2]\">$iml$unick</a>";
        
    $pst parsemsg($post[1], $sid);
        
    $topt "<a href=\"index.php?action=pstopt&amp;sid=$sid&amp;pid=$post[0]&amp;page=$page&amp;fid=$tinfo[5]\">*</a>";
        if(
    $post[4]>0)
        {
            
    $qtl "<small><i><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;pst=\">(quote:p=blaze,d=16-04-2006)</a></i></small>";
        }
        if(
    $go==$post[0])
        {
          
    $fli "<img src=\"../images/flag.gif\" alt=\"!\"/>";
        }else{
          
    $fli ="";
        }
        echo 
    "$usl$fli$pst $topt<br/>";
        
    $dtot date("d-m-y - H:i:s",$post[3]);
        echo 
    $dtot;
        echo 
    "<br/>";
      }
        
    ///to here
        
    echo "</p>";
        echo 
    "<p align=\"center\">";
        if(
    $page>1)
        {
          
    $ppage $page-1;
          echo 
    "<a href=\"index.php?action=viewtpc&amp;page=$ppage&amp;sid=$sid&amp;tid=$tid\">«PREV</a> ";
        }
        if(
    $page<$num_pages)
        {
          
    $npage $page+1;
          echo 
    "<a href=\"index.php?action=viewtpc&amp;page=$npage&amp;sid=$sid&amp;tid=$tid\">Next»</a>";
        }
        echo 
    "<br/>$page/$num_pages<br/>";
        if(
    $num_pages>2)
        {
          
    $rets "<form action=\"index.php\" method=\"get\">";
        
    $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
        
    $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        
    $rets .= "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
        
    $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
        
    $rets .= "<input type=\"Submit\" value=\"Go To Page\" Name=\"Submit\"/></form>";

            echo 
    $rets;
        }
      echo 
    "<br/>";
      echo 
    "<b>1 </b><a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid\">Post reply</a>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      
    $fid $tinfo[5];
      
    $fname getfname($fid);
      
    $cid mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
      
    $cinfo mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
      
    $cname $cinfo[0];
      
    $cid mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
      
    $fname htmlspecialchars($fname);
      echo 
    "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">Back To $fname</a><br/>";
      if(
    $cid[0]>0)
      {
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      
    $cinfo mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
      
    $cname htmlspecialchars($cinfo[0]);
      echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$cid[0]\">$cname</a><br/>";
      echo 
    forumlink($sid,9);
      }else{
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      
    $cid mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
      
    $cinfo mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
      
    $cname htmlspecialchars($cinfo[0]);
      echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gocl&amp;sid=$sid&amp;clid=$cid[0]\">$cname Club</a><br/>";
      echo 
    forumlink($sid,9);
      }
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }
    //////////////////////////////////View Forum

    else if($action=="viewfrm")
    {
      
        
    $fid $_GET["fid"];
        
    $view $_GET["view"];
        if(!
    canaccess(getuid_sid($sid), $fid))
        {
          
    addonline(getuid_sid($sid),"im viewing admin forum naughty me","");
        echo 
    "<head>";
        echo 
    "<title>View Forum</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        
    addonline(getuid_sid($sid),"Viewing Forum","index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid");
        
    $finfo mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));
        
    $fnm htmlspecialchars($finfo[0]);
        echo 
    "<head>";
        echo 
    "<title>View Forum</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $umsg getunreadpm(getuid_sid($sid));
        if(
    $umsg>0)
        {
        echo 
    "<br/><b>6 </b><a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a><br/>";
        }
        
    $norf mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'"));
        if(
    $norf[0]>0)
        {
            echo 
    "<a href=\"rwrss.php?action=showfrss&amp;sid=$sid&amp;fid=$fid\"><img src=\"../images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>";
        }
        echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=newtopic&amp;sid=$sid&amp;fid=$fid\">New Topic</a><br/>";
        echo 
    "<form action=\"index.php\" method=\"get\">";
        echo 
    "View: <select name=\"view\">";
        echo 
    "<option value=\"all\">All</option>";
        echo 
    "<option value=\"new\">Since Last Visit</option>";
        echo 
    "<option value=\"myps\">I posted In</option>";
        echo 
    "</select>";
        echo 
    "<input type=\"submit\" value=\"Go\"/>";
        echo 
    "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        echo 
    "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        echo 
    "<input type=\"hidden\" name=\"sid\"  value=\"$sid\"/>";
        echo 
    "</form>";
        echo 
    "<br/>";
        if(
    $view=="new")
        {
            echo 
    "<small>Viewing topics that has no new posts since your last visit</small>";
        }else if(
    $view=="myps")
        {
            echo 
    "<small>Viewing topics contain posts by you</small>";
        }else {
        echo 
    "<small>Viewing All topics</small>";
        }
        echo 
    "</p>";
        echo 
    "<p>";
        if(
    $page=="" || $page<=0)$page=1;
        if(
    $page==1)
        {
          
    ///////////pinned topics
          
    $topics mysql_query("SELECT id, name, closed, views, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='1' ORDER BY lastpost DESC, name, id LIMIT 0,5");
          while(
    $topic mysql_fetch_array($topics))
        {
          
    $iml "<img src=\"../images/normal.gif\" alt=\"*\"/>";
          
    $iml "*";
          
    $atxt ="";
          if(
    $topic[2]=='1')
          {
            
    //closed
            
    $atxt "(X)";
          }
          if(
    $topic[4]>0)
          {
            
    $pltx "(P)";
          }else{
            
    $pltx "";
          }
          
    $tnm htmlspecialchars($topic[1]);
          
    $nop mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
          echo 
    "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$topic[0]\">$iml$pltx$tnm($nop[0])$atxt</a><br/>";

        }
        echo 
    "<br/>";
      }
      
    $uid getuid_sid($sid);
      if(
    $view=="new")
      {
      
      
    $ulv mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."'"));
      }
      else if(
    $view=="myps")
      {
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.id) FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."'"));
      }
      else{
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0'"));
      }
        
    $num_items $noi[0]; //changable
        
    $items_per_page10;
        
    $num_pages ceil($num_items/$items_per_page);
        if(
    $page>$num_pages)$page$num_pages;
        
    $limit_start = ($page-1)*$items_per_page;
        if(
    $limit_start<0)$limit_start=0;
        if(
    $view=="new")
        {
        
    $ulv mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
        
    $topics mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."' ORDER BY lastpost DESC, name, id LIMIT $limit_start$items_per_page");
        }
        else if(
    $view=="myps"){
        
    $topics mysql_query("SELECT a.id, a.name, a.closed, a.views, a.moved, a.pollid FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."' GROUP BY a.id ORDER BY a.lastpost DESC, a.name, a.id  LIMIT $limit_start$items_per_page");
        }
        else{
        
    $topics mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' ORDER BY lastpost DESC, name, id LIMIT $limit_start$items_per_page");
        }
        
        while(
    $topic mysql_fetch_array($topics))
        {
          
          
    $nop mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
          
    $iml "<img src=\"../images/normal.gif\" alt=\"*\"/>";
          if(
    $nop[0]>24)
          {
            
    $iml "<img src=\"../images/hot.gif\" alt=\"*\"/>";
          }
          if(
    $topic[4]=='1')
          {
            
    $iml "<img src=\"../images/moved.gif\" alt=\"*\"/>";
          }
          if(
    $topic[2]=='1')
          {
            
    $iml "<img src=\"../images/closed.gif\" alt=\"*\"/>";
          }
          if(
    $topic[5]>0)
          {
            
    $iml "<img src=\"../images/poll.gif\" alt=\"*\"/>";
          }
          
    $atxt ="";
          if(
    $topic[2]=='1')
          {
            
    //closed
            
    $atxt "(X)";
          }
          
    $tnm htmlspecialchars($topic[1]);
          echo 
    "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$topic[0]\">$iml$tnm($nop[0])$atxt</a><br/>";

        }


        echo 
    "</p>";
        echo 
    "<p align=\"center\">";

        if(
    $page>1)
        {
          
    $ppage $page-1;
          echo 
    "<a href=\"index.php?action=viewfrm&amp;page=$ppage&amp;sid=$sid&amp;fid=$fid&amp;view=$view\">«PREV</a> ";
        }
        if(
    $page<$num_pages)
        {
          
    $npage $page+1;
          echo 
    "<a href=\"index.php?action=viewfrm&amp;page=$npage&amp;sid=$sid&amp;fid=$fid&amp;view=$view\">Next»</a>";
        }
        echo 
    "<br/>$page/$num_pages<br/>";
        if(
    $num_pages>2)
        {
            
    $rets "<form action=\"index.php\" method=\"get\">";
            
    $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
          
    $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
            
    $rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
            
    $rets .= "</form>";

            echo 
    $rets;
        }

        echo 
    "<br/><br/><b>1 </b><a href=\"index.php?action=newtopic&amp;sid=$sid&amp;fid=$fid\">New Topic</a><br/>";
        
    $cid mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
        if(
    $cid[0]>0)
        {
      echo 
    "<br/><br/><b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
        
    $cinfo mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
        
    $cname htmlspecialchars($cinfo[0]);
        echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$cid[0]\">$cname</a><br/>";
        echo 
    forumlink($sid,9);
        }else{
      echo 
    "<br/><br/><b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            
    $cid mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
            
    $cinfo mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
            
    $cname htmlspecialchars($cinfo[0]);
        echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gocl&amp;sid=$sid&amp;clid=$cid[0]\">$cname Club</a><br/>";
        echo 
    forumlink($sid,9);
        }
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }
    //////////////////////////////////ONLINE USERS
    else if($action=="newtopic")
    {
      
    $fid $_GET["fid"];
      if(!
    canaccess(getuid_sid($sid), $fid))
        {
        echo 
    "<head>";
        echo 
    "<title>New Topic</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        
    addonline(getuid_sid($sid),"Creating new topic","index.php?action=online");
        echo 
    "<head>";
        echo 
    "<title>New Topic</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<form action=\"genproc.php?action=newtopic&amp;sid=$sid\" method=\"post\">";
        echo 
    "Title:<input name=\"ntitle\" maxlength=\"250\"/><br/>";
        echo 
    "Text:<input name=\"tpctxt\" maxlength=\"500\"/><br/>";
        echo 
    "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        echo 
    "<input type=\"submit\" value=\"Create\"/>";
        echo 
    "</form>";
        
    $fname getfname($fid);
        echo 
    "<br/><br/><b>9 </b><a accesskey=\"9\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">$fname</a><br/>";
        echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////Post reply

    else if($action=="post")
    {
        
    $tid $_GET["tid"];
        
        
    $tfid mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
        
    $fid $tfid[0];
    if(!
    canaccess(getuid_sid($sid), $fid))
        {
        echo 
    "<head>";
        echo 
    "<title>Post Reply</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        
    addonline(getuid_sid($sid),"Posting reply","");
        
        echo 
    "<head>";
        echo 
    "<title>Post Reply</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    $qut $_GET["qut"];
        echo 
    "<p align=\"center\">";
        echo 
    "<form action=\"genproc.php?action=post&amp;sid=$sid\" method=\"post\">";
        echo 
    "Text:<input name=\"reptxt\" maxlength=\"500\"/><br/>";
        echo 
    "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
        echo 
    "<input type=\"hidden\" name=\"qut\" value=\"$qut\"/>";
        echo 
    "<input type=\"submit\" value=\"Reply\"/>";
        echo 
    "</form>";
        
    $fid getfid($tid);
        
    $fname getfname($fid);
        echo 
    "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid\">Back to topic</a>";
        echo 
    "<br/><b>9 </b><a accesskey=\"9\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">$fname</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////shout

    else if($action=="shout")
    {
        
    addonline(getuid_sid($sid),"Close Your Ears Im Shouting","");

        echo 
    "<head>";
        echo 
    "<title>Shout</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        if(
    getplusses(getuid_sid($sid))<75)
        {
            echo 
    "You need at least 75 plusses to shout!";
        }else{
         
        echo 
    "<small>please take note: $nick all your plusses will be removed if you spam or flood the shoutbox</small><br/>";
        echo 
    "<small>also smilies and BBcode do not work in shoutbox</small><br/><br/>";
        echo 
    "<form action=\"genproc.php?action=shout&amp;sid=$sid\" method=\"post\">";
        echo 
    "Text:<input name=\"shtxt\" maxlength=\"100\">";
        echo 
    "<input type=\"Submit\" value=\"Shout\" name=\"Shout\"></form>";
                }
      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////shout

    else if($action=="annc")
    {
        
    addonline(getuid_sid($sid),"Adding An Announcement","");
        
    $clid $_GET["clid"];
        echo 
    "<head>";
        echo 
    "<title>Announce</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        
    $cow mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
        
    $uid getuid_sid($sid);
        if(
    $cow[0]!=$uid)
        {
            echo 
    "This club is not yours!";
        }else{
        echo 
    "<form action=\"genproc.php?action=annc&amp;sid=$sid&amp;clid=$clid\" method=\"post\">";
        echo 
    "Text:<input name=\"antx\" maxlength=\"200\"><br/>";
        echo 
    "<input type=\"Submit\" name=\"Announce\" Value=\"Announce\"></form>";
                }
      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////Guestbook

    else if($action=="addblg")
    {

        
    if(!
    getplusses(getuid_sid($sid))>50)
        {
        echo 
    "<head>";
        echo 
    "<title>Add Blog</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "you should have 50 plusses to add a blog<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        
    addonline(getuid_sid($sid),"Adding a blog","");

        echo 
    "<head>";
        echo 
    "<title>Add Blog</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";

        echo 
    "<p align=\"center\">";
             echo 
    "<form action=\"genproc.php?action=addblg&amp;sid=$sid\" method=\"post\">";
        echo 
    "Title:<input name=\"btitle\" maxlength=\"30\"/><br/>";
        echo 
    "Text:<input name=\"msgtxt\" maxlength=\"500\"/><br/>";
    echo 
    "<input type=\"submit\" value=\"Add Blog\"/>";    
    echo 
    "</form>";
       
      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////add vault

    else if($action=="addvlt")
    {


    if(!
    getplusses(getuid_sid($sid))>25)
        {
        echo 
    "<head>";
        echo 
    "<title>Add To Vault</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    " you should have 25 plusses to add an item to your vault<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        
    addonline(getuid_sid($sid),"Adding a vault item","");

        echo 
    "<head>";
        echo 
    "<title>Add To Vault</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<small>The vault is used to store your downloadable links,like images, mp3's, games  etc...<br/>WARNING: if you used it to wapsites links they will got deleted and you'll lose some plusses, if you used it for ranking sites links like 2wap, mradar, you'll be banned</small><br/><br/>";
    echo 
    "<form action=\"genproc.php?action=addvlt&amp;sid=$sid\" method=\"post\">";
        echo 
    "The vault is used to store your downloadable links,like images, mp3's, games  etc...<br/>WARNING: if you used it to wapsites links they will got deleted and you'll lose some plusses, if you used it for ranking sites links like 2wap, mradar, you'll be banned<br/><br/>";
        echo 
    "Item Name:<input name=\"viname\" maxlength=\"50\"/><br/>";
        echo 
    "Item Url:<input name=\"vilink\" maxlength=\"255\"/><br/>";
    echo 
    "<input type=\"submit\" value=\"Add Item\"/>";    
    echo 
    "</form>";

      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }
    //////////////////////////////////////////Guestbook

    else if($action=="signgb")
    {
    $who=$_GET["who"];
    addonline(getuid_sid($sid),"Signing Users guestbook","");
    if(!
    cansigngb(getuid_sid($sid), $who))
        {
        echo 
    "<head>";
        echo 
    "<title>Sign Guestbook</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You cant Sign this user guestbook<br/><br/>";
          echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
        

        echo 
    "<head>";
        echo 
    "<title>Sign Guestbook</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<form action=\"genproc.php?action=signgb&amp;sid=$sid\" method=\"post\">";
        echo 
    "<input type=\"hidden\" name=\"who\" Value=\"$who\">";
        echo 
    "Text:<input name=\"msgtxt\" maxlength=\"500\"/><br/>";
        echo 
    "<input type=\"Submit\" name=\"Add\" Value=\"Add\"></form>";

      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }


    else if(
    $action=="online")
    {

      
    addonline(getuid_sid($sid),"Online List","index.php?action=online");
        echo 
    "<head>";
        echo 
    "<title>Online List</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    //echo "<div><img src=\"../images/onlinelist.gif\" alt=\"Online List\"/></div>";
      
    echo popup($sid);
      
    //////ALL LISTS SCRIPT <<

        
    if($page=="" || $page<=0)$page=1;
        
    $num_items getnumonline(); //changable
        
    $items_per_page10;
        
    $num_pages ceil($num_items/$items_per_page);
        if(
    $page>$num_pages)$page$num_pages;
        
    $limit_start = ($page-1)*$items_per_page;

        
    //changable sql
        
    $sql "SELECT
                a.name,a.perm, b.place, b.userid FROM ibwf_users a
                INNER JOIN ibwf_online b ON a.id = b.userid
                GROUP BY 1,2
                LIMIT 
    $limit_start$items_per_page
        "
    ;
      echo 
    "<p align=\"center\">";
        
    $items mysql_query($sql);
        echo 
    mysql_error();
        while (
    $item mysql_fetch_array($items))
        {
            if(
    $item[1]=='0')
            {
              
    $tit "";
            }if(
    $item[1]=='1')
            {
              
    $tit "*";
            }if(
    $item[1]=='2')
            {
              
    $tit "*";
            } if(
    $item[1]=='3')
            {
              
    $tit "*";
            } if(
    $item[1]=='4')
            {
              
    $tit "*";
            }

    $sex mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'"));
    if(
    $sex[0]=="M"){$usersex "<img src=\"../images/male.gif\" alt=\"(M)\"/>";}
    if(
    $sex[0]=="F"){$usersex "<img src=\"../images/female.gif\" alt=\"(F)\"/>";}
    if(
    $sex[0]==""){$usersex "";}
    if(
    $item[1]>'0')
      {
      
    $lnk "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]$tit</a>";
      }else{
      
    $lnk "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]$tit</a>";
      }
      echo 
    "$lnk - $item[2] <br/>";
        }
        
    //echo "</p>";
        //echo "<p align=\"center\">";
        
    if($page>1)
        {
          
    $ppage $page-1;
          echo 
    "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">«Prev</a> ";
        }
        if(
    $page<$num_pages)
        {
          
    $npage $page+1;
          echo 
    "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next»</a>";
        }
        echo 
    "<br/>$page/$num_pages";
        if(
    $num_pages>2)
        {
        echo 
    getjumper($action$sid,"index");
        }
        echo 
    "</p>";
      
    ////// UNTILL HERE >>

      
    echo "<p align=\"center\">";
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
      echo 
    forumlink($sid,9);
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    else if(
    $action=="viewpl")
    {
      
    $who $_GET["who"];
      
    addonline(getuid_sid($sid),"Viewing A Users Poll","");
        echo 
    "<head>";
        echo 
    "<title>View Poll</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        
    $uid getuid_sid($sid);
        
    $pollid mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
        if(
    $pollid[0]>0)
        {
            
    $polli mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
            if(
    trim($polli[1])!="")
            {
                
    $qst parsepm($polli[1], $sid);
                echo 
    $qst."<br/><br/>";
                
    $vdone mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
                
    $nov mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
                
    $nov $nov[0];
                if(
    $vdone[0]>0)
                {
                  
    $votedtrue;
                }else{
                  
    $voted false;
                }
                
    $opt1 $polli[2];
                if (
    trim($opt1)!="")
                {
                  
    $opt1 htmlspecialchars($opt1);
                  
    $nov1 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
                  
    $nov1 $nov1[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov1/$nov)*100);
                  
    $rests "Votes: $nov1($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                    if(
    $voted)
                    {
                      
    $lnk "1.$opt1 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt2 $polli[3];
                if (
    trim($opt2)!="")
                {
                  
    $opt2 htmlspecialchars($opt2);
                  
    $nov2 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
                  
    $nov2 $nov2[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov2/$nov)*100);
                  
    $rests "Votes: $nov2($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "2.$opt2 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt3 $polli[4];
                if (
    trim($opt3)!="")
                {
                  
    $opt3 htmlspecialchars($opt3);
                  
    $nov3 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
                  
    $nov3 $nov3[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov3/$nov)*100);
                  
    $rests "Votes: $nov3($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "3.$opt3 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt4 $polli[5];
                if (
    trim($opt4)!="")
                {
                  
    $opt4 htmlspecialchars($opt4);
                  
    $nov4 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
                  
    $nov4 $nov4[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov4/$nov)*100);
                  
    $rests "Votes: $nov4($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "4.$opt4 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt5 $polli[6];
                if (
    trim($opt5)!="")
                {
                  
    $opt5 htmlspecialchars($opt5);
                  
    $nov5 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
                  
    $nov5 $nov5[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov5/$nov)*100);
                  
    $rests "Votes: $nov5($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "5.$opt5 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                echo 
    "<small>".date("d m y - H:i",$polli[7])."</small>";
            }else{
                echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
            }
        }else{
            echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>This user have no poll";
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
        
    }

    else if(
    $action=="viewtpl")
    {
      
    $who $_GET["who"];
      
    addonline(getuid_sid($sid),"Viewing a poll","");
        echo 
    "<head>";
        echo 
    "<title>View Poll</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        
    $uid getuid_sid($sid);
        
    $pollid mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$who."'"));
        if(
    $pollid[0]>0)
        {
            
    $polli mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
            if(
    trim($polli[1])!="")
            {
                
    $qst parsepm($polli[1], $sid);
                echo 
    $qst."<br/><br/>";
                
    $vdone mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
                
    $nov mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
                
    $nov $nov[0];
                if(
    $vdone[0]>0)
                {
                  
    $votedtrue;
                }else{
                  
    $voted false;
                }
                
    $opt1 $polli[2];
                if (
    trim($opt1)!="")
                {
                  
    $opt1 htmlspecialchars($opt1);
                  
    $nov1 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
                  
    $nov1 $nov1[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov1/$nov)*100);
                  
    $rests "Votes: $nov1($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                    if(
    $voted)
                    {
                      
    $lnk "1.$opt1 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt2 $polli[3];
                if (
    trim($opt2)!="")
                {
                  
    $opt2 htmlspecialchars($opt2);
                  
    $nov2 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
                  
    $nov2 $nov2[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov2/$nov)*100);
                  
    $rests "Votes: $nov2($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "2.$opt2 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt3 $polli[4];
                if (
    trim($opt3)!="")
                {
                  
    $opt3 htmlspecialchars($opt3);
                  
    $nov3 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
                  
    $nov3 $nov3[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov3/$nov)*100);
                  
    $rests "Votes: $nov3($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "3.$opt3 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt4 $polli[5];
                if (
    trim($opt4)!="")
                {
                  
    $opt4 htmlspecialchars($opt4);
                  
    $nov4 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
                  
    $nov4 $nov4[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov4/$nov)*100);
                  
    $rests "Votes: $nov4($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "4.$opt4 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                
    $opt5 $polli[6];
                if (
    trim($opt5)!="")
                {
                  
    $opt5 htmlspecialchars($opt5);
                  
    $nov5 mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
                  
    $nov5 $nov5[0];
                  if(
    $nov>0)
                  {
                  
    $per floor(($nov5/$nov)*100);
                  
    $rests "Votes: $nov5($per%)";
                  }else{
                    
    $rests "Votes: 0(0%)";
                  }
                  if(
    $voted)
                    {
                      
    $lnk "5.$opt5 <small>$rests</small><br/>";
                    }else{
                  
    $lnk "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
                  }
                  echo 
    "$lnk";
                }
                echo 
    "<small>".date("d m y - H:i",$polli[7])."</small>";
            }else{
                echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
            }
        }else{
            echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/>This user have no poll";
        }
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";

    }
    else if(
    $action=="stfol")
    {

      
    addonline(getuid_sid($sid),"Staff List","");
      echo 
    "<head>";
      echo 
    "<title>Staff List</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      
    $sql "SELECT id, name, perm FROM ibwf_users WHERE perm='4' ORDER BY name";
      echo 
    "<p>";
      echo 
    "<b>Owner(s):</b><br/>";
      
    $query mysql_query($sql);
      echo 
    mysql_error();
      if(
    mysql_num_rows($query)>0)
      {
      while (
    $owners mysql_fetch_array($query))
      {
      
    $lnk "<a href=\"index.php?action=viewuser&amp;who=$owners[0]&amp;sid=$sid\">$owners[1]</a>";
      echo 
    "$lnk<br/>";
      }
      }else{
      echo 
    "No Owner(s) Atm...<br/>";
      }
      
    $sql "SELECT id, name, perm FROM ibwf_users WHERE perm='3' ORDER BY name";
      echo 
    "<b>Head Admin(s):</b><br/>";
      
    $query mysql_query($sql);
      echo 
    mysql_error();
      if(
    mysql_num_rows($query)>0)
      {
      while (
    $headadmins mysql_fetch_array($query))
      {
      
    $lnk "<a href=\"index.php?action=viewuser&amp;who=$headadmins[0]&amp;sid=$sid\">$headadmins[1]</a>";
      echo 
    "$lnk<br/>";
      }
      }else{
      echo 
    "No Head Admin(s) Atm...<br/>";
      }
      
    $sql "SELECT id, name, perm FROM ibwf_users WHERE perm='2' ORDER BY name";
      echo 
    "<b>Admin(s):</b><br/>";
      
    $query mysql_query($sql);
      echo 
    mysql_error();
      if(
    mysql_num_rows($query)>0)
      {
      while (
    $admins mysql_fetch_array($query))
      {
      
    $lnk "<a href=\"index.php?action=viewuser&amp;who=$admins[0]&amp;sid=$sid\">$admins[1]</a>";
      echo 
    "$lnk<br/>";
      }
      }else{
      echo 
    "No Admins(s) Atm...<br/>";
      }
      
    $sql "SELECT id, name, perm FROM ibwf_users WHERE perm='1' ORDER BY name";
      echo 
    "<b>Mods (s):</b><br/>";
      
    $query mysql_query($sql);
      echo 
    mysql_error();
      if(
    mysql_num_rows($query)>0)
      {
      while (
    $mods mysql_fetch_array($query))
      {
      
    $lnk "<a href=\"index.php?action=viewuser&amp;who=$mods[0]&amp;sid=$sid\">$mods[1]</a>";
      echo 
    "$lnk<br/>";
      }
      }else{
      echo 
    "No Mods(s) Atm...<br/>";
      }

      
    $timeout 300;
      
    $timeon time()-$timeout;
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'"));
      echo 
    "<b>Staff Online:($noi[0])</b><br/>";
      
    $sql "SELECT name, perm, id FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'";
      
    $items mysql_query($sql);
      echo 
    mysql_error();
      while (
    $item mysql_fetch_array($items))
      {
      
    $lnk "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
      if(
    $item[1]==1)
      {
    $item[1] = "Mod";}
      else if(
    $item[1]==2)
      {
    $item[1] = "Admin";}
      else if(
    $item[1]==3)
      {
    $item[1] = "Head Admin";}
      else if(
    $item[1]==4)
      {
    $item[1] = "Owner";}
      echo 
    "$lnk - $item[1] <br/>";
      }
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    else if(
    $action=="chbmsg")
    {
      
    addonline(getuid_sid($sid),"Buddy Message","");
        echo 
    "<head>";
        echo 
    "<title>Set Mood</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";

             echo 
    "<form action=\"genproc.php?action=upbmsg&amp;sid=$sid\" method=\"post\">";

        echo 
    "Text:<input name=\"bmsg\" maxlength=\"100\" value=\"$cmsg\"/><br/>";
    echo 
    "<input type=\"submit\" value=\"Save\"/>";
        echo 
    "</form><br/>";
     echo 
    "<a href=\"lists.php?action=buds&amp;sid=$sid\">";
    echo 
    "Buddies List</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    /////////////////////////////////viewuser profile

    else if($action=="viewuser")
    {
      
    addonline(getuid_sid($sid),"Viewing Users Profile","index.php?action=viewuser&amp;who=$who");
        echo 
    "<head>";
        echo 
    "<title>View Profile</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
       echo 
    "<p align=\"center\">";
      
    $lastloc=$_GET["lstloc"];
    if(
    $lastloc=="cht"){
        
    $rid$_GET["rid"];
        
    $rooms mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        
    $rname $rooms[1];
    }
      if(
    $who==""||$who==0)
      {
        
    $mnick $_POST["mnick"];
        
    $who getuid_nick($mnick);
      }
      
    $whonick getnick_uid($who);
      if(
    $whonick!="")
      {



    if(
    isowner(getuid_sid($sid)))
      {
      echo 
    "<a href=\"ownercp.php?action=user&amp;sid=$sid&amp;who=$who\">*Owner Tools*</a><br/>";
      }
    if(
    isheadadmin(getuid_sid($sid)))
      {
      echo 
    "<a href=\"headadmincp.php?action=user&amp;sid=$sid&amp;who=$who\">*Head Admin Tools*</a><br/>";
      }
      if(
    ismod($uid))
      {
      if(!
    isowner(getuid_sid($sid)))
      {
      if(!
    isheadadmin(getuid_sid($sid)))
      {
      echo 
    "<a href=\"admincp.php?action=user&amp;sid=$sid&amp;who=$who\">*Admin Tools*</a><br/>";
      }
      }
      }

      
    $avlink getavatar($who);
      if(
    $avlink=="")
      {
      echo 
    "";
      }else{
      echo 
    "<img src=\"$avlink\" alt=\"$whonick\"/><br/>";
      }
      if(
    cansee(getuid_sid($sid), $who))
      {
        
    $unol mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$who."'"));
        
    /*if($unol[0]!="")
        {
        echo "Last Penalty Reason: $unol[0]<br/>";
        }
        $unol = mysql_fetch_array(mysql_query("SELECT lastplreas FROM ibwf_users WHERE id='".$who."'"));
        if($unol[0]!="")
        {
        echo "Last Plusses Reason: $unol[0]<br/>";
        }*/
      
    }
      echo 
    "<b>Username:</b> $whonick<br/>";
      echo 
    "<b>Status:</b> ".getstatus($who)."<br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "<b>UserId:</b> $who<br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT sex, birthday, location FROM ibwf_users WHERE id='".$who."'"));
      
    $uage getage($nopl[1]);
      if(
    $nopl[0]=='M')
      {
        
    $usex "Male";
      }else if(
    $nopl[0]=='F'){
        
    $usex "Female";
      }else{
        
    $usex "Argh! No Profile!";
      }
      
    $nopl[2] = htmlspecialchars($nopl[2]);
      echo 
    "<b>Asl:</b> $uage/$usex/$nopl[2]<br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE id='".$who."'"));
      
    $jdt date("H:i - D jS M y",$nopl[0]);
      echo 
    "<b>Joined:</b> $jdt<br/>";
      
    $membrage time() - $nopl[0];
      
    $membrage gettimemsg($membrage);
      echo 
    "<b>Member For:</b> $membrage<br/>";
      
    $nob mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
      echo 
    "<b>Buddies:</b> $nob[0]<br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT email FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "<b>E-mail:</b> $nopl[0]<br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT signature FROM ibwf_users WHERE id='".$who."'"));
      
    $sign parsepm($nopl[0], $sid);
      echo 
    "<b>Info:</b> $sign<br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
      
    $var1 date("His",$noi[0]);
      
    $var2 time();
      
    $var21 date("His",$var2);
      
    $var3 $var21 $var1;
      
    $var4 date("s",$var3);
      echo 
    "<b>Idle For:</b> ";
      
    $remain time() - $noi[0];
      
    $idle gettimemsg($remain);
      echo 
    "$idle<br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT browserm FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "<b>Browser:</b> $nopl[0]<br/>";
      if(
    ismod(getuid_sid($sid)))
      {
      
    $uipadd mysql_fetch_array(mysql_query("SELECT ipadd FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "<b>Ip:</b> <a href=\"lists.php?action=byip&amp;sid=$sid&amp;who=$who\">$uipadd[0]</a><br/>";
      }
      if(
    budres($uid$who)==0)
      {
        echo 
    "<a href=\"genproc.php?action=bud&amp;who=$who&amp;sid=$sid&amp;todo=add\">Add Buddy</a><br/>";
      }else if(
    budres($uid$who)==1)
      {
        echo 
    "(Queued Buddy Request)<br/>";
      }else if(
    budres($uid$who)==2)
      {
        echo 
    "<a href=\"genproc.php?action=bud&amp;who=$who&amp;sid=$sid&amp;todo=del\">Del Buddy</a><br/>";
      }
      if (
    arebuds($uid$who))
      {
      echo 
    "<a href=\"inbox.php?action=sendpopup&amp;who=$who&amp;sid=$sid\">Send Popup</a><br/>";
      }
      echo 
    "<a href=\"inbox.php?action=sendpm&amp;who=$who&amp;sid=$sid\">Send Inbox</a><br/>";
      
    $ires ignoreres($uid$who);
    if(
    $ires==1)
      {
        echo 
    "<a href=\"genproc.php?action=ign&amp;who=$who&amp;sid=$sid&amp;todo=add\">Ignore</a><br/>";
      }
      if(
    isignored($who$uid))
      {
        echo 
    "<a href=\"genproc.php?action=ign&amp;who=$who&amp;sid=$sid&amp;todo=del\">UnIgnore</a><br/>";
      }
      echo 
    "<a href=\"index.php?action=prostats&amp;who=$who&amp;sid=$sid\">User Stats</a><br/>";
      echo 
    "<a href=\"uinfo.php?who=$who&amp;sid=$sid\">Advanced Profile</a><br/>";
      echo 
    "<a href=\"../users?$whonick\">Personal Wap Site</a><br/>";
       
    $noi mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
       if(
    $noi[0]>0)
       {
       echo 
    "<a href=\"index.php?action=viewpl&amp;who=$who&amp;sid=$sid\">Poll</a><br/>";
     }

       
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$who."'"));
       if(
    $noi[0]>0)
       {
       echo 
    "<a href=\"lists.php?action=blogs&amp;who=$who&amp;sid=$sid\">Blogs($noi[0])</a><br/>";
     }
     
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$who."'"));
       if(
    $noi[0]>0)
       {
       echo 
    "<a href=\"lists.php?action=vault&amp;who=$who&amp;sid=$sid\">Vault($noi[0])</a><br/>";
       }
       
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$who."'"));
       echo 
    "<a href=\"lists.php?action=gbook&amp;who=$who&amp;sid=$sid\">Guestbook($noi[0])</a><br/>";
       
    $judg mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";

       }else{
         echo 
    "<img src=\"../images/notok.gif\" alt=\"X\"/> Member dos not exist<br/>";
       }
         if(
    $lastloc=="cht"){
              
        echo 
    "<b>5 </b><a accesskey=\"5\" href=\"chat.php?sid=$sid&amp;rid=$rid\">Back to $rname</a><br/>"
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
      }else{
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
      }
    }
    //////////////////////////////////////////profile stats
    else if($action=="prostats")
    {
        
    addonline(getuid_sid($sid),"Viewing User Stats","");
        echo 
    "<head>";
        echo 
    "<title>User Stats</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      if(
    $who==""||$who==0)
      {
        
    $mnick $_POST["mnick"];
        
    $who getuid_nick($mnick);
      }
      echo 
    "<p align=\"center\">";
      echo 
    "<b>User Stats</b>";
      echo 
    "</p>";
      echo 
    "<p>";
      
    $uid getuid_sid($sid);
      
    $unol mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE authorid='".$who."'"));
      
    $tlink "<a href=\"lists.php?action=tbuid&amp;sid=$sid&amp;who=$who\">$unol[0]</a>";
      echo 
    "Topics: <b>$tlink</b><br/>";
      
    $unop mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$who."'"));
      
    $unol mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$who."'"));
      
    $plink "<a href=\"lists.php?action=uposts&amp;sid=$sid&amp;who=$who\">$unol[0]</a>";
      echo 
    "Posts: <b>$plink/$unop[0]</b><br/>";
      
    $noin mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$who."'"));
      
    $nout mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE byuid='".$who."'"));
      echo 
    "PMs IN: <b>$noin[0]</b> - OUT: <b>$nout[0]</b><br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "Plusses: <b>$nopl[0]</b><br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT chmsgs FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "Chat Posts: <b>$nopl[0]</b><br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT battlep FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "Battle Points: <b>$nopl[0]</b><br/>";
      
    $judg mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".$who."'"));
      if(
    $judg[0]>0)
      {
      echo 
    "<b>Battle Board Judge</b><br/>";
      }
      
    $nout mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shouter='".$who."'"));
      
    $nopl mysql_fetch_array(mysql_query("SELECT shouts FROM ibwf_users WHERE id='".$who."'"));
      echo 
    "Shouts: <b><a href=\"lists.php?action=shouts&amp;sid=$sid&amp;who=$who\">$nout[0]</a>/$nopl[0]</b><br/>";
      
    $nout mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_uploads WHERE uid='".$who."'"));
      echo 
    "Files Uploaded: <b>$nout[0]</b><br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
      
    $jdt date("d m y-H:i:s",$nopl[0]);
      echo 
    "Last Active: <b>$jdt</b><br/>";
      
    $nopl mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$who."'"));
      
    $jdt date("d m y-H:i:s",$nopl[0]);
      echo 
    "Last Visit: <b>$jdt</b><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$who."'"));
      if(
    $noi[0]>0)
      {
      echo 
    "<b>1 </b><a accesskey=\"1\" href=\"lists.php?action=ucl&amp;who=$who&amp;sid=$sid\">Clubs($noi[0])</a><br/>";
      }
     
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."'"));
       if(
    $noi[0]>0)
       {
       echo 
    "<b>2 </b><a accesskey=\"2\" href=\"lists.php?action=clm&amp;who=$who&amp;sid=$sid\">Member In $noi[0] Clubs</a><br/>";
       }
       if(
    ismod(getuid_sid($sid))||$judg[0]>0)
       {
       echo 
    "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=batp&amp;who=$who&amp;sid=$sid\">Battle Points</a><br/>";
       }
      echo 
    "<b>4 </b><a accesskey=\"4\" href=\"userfun.php?action=profile&amp;who=$who&amp;sid=$sid\">Fun And Games</a><br/>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<br/><b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    ////////////////////////////////////////// uxset
    else if($action=="uxset")
    {
        
    addonline(getuid_sid($sid),"Extended Settings","");
        echo 
    "<head>";
        echo 
    "<title>Extended Settings</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p>";
        echo 
    "<a href=\"index.php?action=uadd&amp;sid=$sid\">»My Address</a><br/>";
        echo 
    "<a href=\"index.php?action=uper&amp;sid=$sid\">»Personality</a><br/>";
        echo 
    "<a href=\"index.php?action=umin&amp;sid=$sid\">»More about me</a><br/>";
        echo 
    "<a href=\"index.php?action=upre&amp;sid=$sid\">»Preferences</a><br/>";
        
        
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////User Address

    else if($action=="uadd")
    {
        
    addonline(getuid_sid($sid),"My Address","");
        echo 
    "<head>";
        echo 
    "<title>My Adderss</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    $ainfo mysql_fetch_array(mysql_query("SELECT country, city, street, phoneno, timezone FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo 
    "<p>";
        echo 
    "<small><img src=\"../images/point.gif\" alt=\"!\"/>Go to Preferences and choose buddies only if you want only your buddies to see your street and phone number<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>If you don't anyone to see these information just don't type them<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Example on timezone is 2 for +2 hours on GMT, or -2.5 for -2:30 on GMT<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>These info. will help you to meet friends and dates from where do you live<br/><br/></small>";
        echo 
    "<form action=\"genproc.php?action=uadd&amp;sid=$sid\" method=\"post\">";
        echo 
    "Contry: <input name=\"ucon\" value=\"$ucon\" maxlength=\"50\"><br/>";
        echo 
    "City: <input name=\"ucit\" value=\"$ucit\" maxlength=\"50\"><br/>";
        echo 
    "Street: <input name=\"ustr\" value=\"$ustr\" maxlength=\"50\"><br/>";
        echo 
    "Timezone(e.g +2 or -2.5): <input name=\"utzn\" size=\"5\" value=\"0\" maxlength=\"5\"><br/>";
        echo 
    "Phone No.: <input name=\"uphn\" value=\"$uphn\" maxlength=\"20\"><br/>";
        echo 
    "<input type=\"Submit\" name=\"Submit\" value=\"Submit\"></form>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////User Preferences

    else if($action=="upre")
    {
        
    addonline(getuid_sid($sid),"Preferences","");
        echo 
    "<head>";
        echo 
    "<title>User Preferences</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    $ainfo mysql_fetch_array(mysql_query("SELECT budsonly, sexpre FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo 
    "<p>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Set buddies only to yes, so only your buddies can see your phone number, street, and real name<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Sex preference will help the correct people to find you";
        echo 
    "<form action=\"genproc.php?action=upre&amp;sid=$sid\" method=\"post\">";
        echo 
    "Buddies Only:<br/>";
        echo 
    "<select name=\"ubon\" value=\"$ainfo[0]\">";
        echo 
    "<option value=\"1\">Yes</option>";
        echo 
    "<option value=\"0\">No</option>";
        echo 
    "</select>";
        echo 
    "<br/>Sex Preference:<br/>";
        echo 
    "<select name=\"usxp\" value=\"$ainfo[1]\">";
        echo 
    "<option value=\"F\">Females</option>";
        echo 
    "<option value=\"M\">Males</option>";
        echo 
    "<option value=\"B\">Both</option>";
        echo 
    "</select>";
        echo 
    "<br/><input type=\"Submit\" name=\"Submit\" value=\"Submit\"></form>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////User Personaliy

    else if($action=="uper")
    {
        
    addonline(getuid_sid($sid),"Personality","");
        echo 
    "<head>";
        echo 
    "<title>Personality</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    $ainfo mysql_fetch_array(mysql_query("SELECT height, weight, realname, racerel, eyescolor, profession, hairtype FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo 
    "<p>";
        echo 
    "<form action=\"genproc.php?action=uper&amp;sid=$sid\" method=\"post\">";
        echo 
    "Height: <input name=\"uhig\" value=\"$ainfo[0]\" maxlength=\"10\"><br/>";
        echo 
    "Weight: <input name=\"uwgt\" value=\"$ainfo[1]\" maxlength=\"10\"><br/>";
        echo 
    "Real Name: <input name=\"urln\" value=\"$ainfo[2]\" maxlength=\"100\"><br/>";
        echo 
    "Ethnic Origin: <input name=\"ueor\" value=\"$ainfo[3]\" maxlength=\"100\"><br/>";
        echo 
    "Eyes: <input name=\"ueys\" value=\"$ainfo[4]\" maxlength=\"10\"><br/>";
        echo 
    "Hair: <input name=\"uher\" value=\"$ainfo[6]\" maxlength=\"50\"><br/>";
        echo 
    "Profession: <input name=\"upro\" value=\"$ainfo[5]\" maxlength=\"100\"><br/>";
        echo 
    "<input type=\"Submit\" name=\"Submit\" Value=\"Submit\"></form>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////User Personaliy

    else if($action=="umin")
    {
        
    addonline(getuid_sid($sid),"More About Me","");
        echo 
    "<head>";
        echo 
    "<title>More About Me</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    $ainfo mysql_fetch_array(mysql_query("SELECT likes, deslikes, habitsb, habitsg, favsport, favmusic, moretext FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo 
    "<p>";
        echo 
    "<form action=\"genproc.php?action=umin&amp;sid=$sid\" method=\"post\">";
        echo 
    "Likes: <input name=\"ulik\" value=\"$ainfo[0]\" maxlength=\"250\"><br/>";
        echo 
    "Dislikes: <input name=\"udlk\" value=\"$ainfo[1]\" maxlength=\"250\"><br/>";
        echo 
    "Bad Habbits: <input name=\"ubht\" value=\"$ainfo[2]\" maxlength=\"250\"><br/>";
        echo 
    "Good Habbits: <input name=\"ught\" value=\"$ainfo[3]\" maxlength=\"250\"><br/>";
        echo 
    "Favorite Sports: <input name=\"ufsp\" value=\"$ainfo[4]\" maxlength=\"100\"><br/>";
        echo 
    "Favorite Music: <input name=\"ufmc\" value=\"$ainfo[5]\" maxlength=\"100\"><br/>";
        echo 
    "More Text: <input name=\"umtx\" value=\"$ainfo[6]\" maxlength=\"500\"><br/>";
        echo 
    "<input type=\"Submit\" name=\"Submit\" value=\"Submit\"></form>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////G-Mail Settings

    else if($action=="gmset")
    {
        
    addonline(getuid_sid($sid),"GMail Settings","");
        echo 
    "<head>";
        echo 
    "<title>Gmail Settings</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
        
    $ainfo mysql_fetch_array(mysql_query("SELECT gmailun, gmailpw, gmailchk FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo 
    "<p>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Set these values only if you want to be auto-logged in your gmail account<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Put in the checking field the time you want $sitename to check your g-mail account<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Putting less than 20 minutes could slow your navigation throw $sitename, suggested period is 30 minutes<br/>";
        echo 
    "<form action=\"genproc.php?action=gmset&amp;sid=$sid\" method=\"post\">";
        echo 
    "G-Mail Username: <input name=\"ugun\" value=\"$ainfo[0]\" maxlength=\"100\"/><br/>";
        echo 
    "G-Mail Password: <input name=\"ugpw\" value=\"$ainfo[1]\" maxlength=\"200\"/><br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Valid values 0 - 99 minutes, 0 will check your e-mail with every action you make<br/>";
        echo 
    "G-Mail Checking: <input name=\"ugch\" style=\"-wap-input-format: '*N'\" size=\"2\" value=\"$ainfo[2]\" maxlength=\"2\"/><br/>";
        echo 
    "<input type=\"submit\" name=\"submit\" value=\"Submit\"></form>";
        echo 
    "</p>";
        echo 
    "<p align=\"center\">";
        echo 
    "<a href=\"index.php?action=cpanel&amp;sid=$sid\">User Settings</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo 
    "</p>";
        echo 
    "</body>";
    }

    //////////////////////////////////////////Give Game Plusses

    else if($action=="givegp")
    {
      
    $who $_GET["who"];
      
    addonline(getuid_sid($sid),"Giving Game Plusses","");
        echo 
    "<head>";
        echo 
    "<title>Give Game Plusses</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>Give GPs To ".getnick_uid($who)."</b><br/><br/>";
      
    $gps mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
      echo 
    "You have $gps[0] GP's<br/><br/>";
      echo 
    "GP's to give<br/>";
      echo 
    "<form action=\"genproc.php?action=givegp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
      echo 
    "<input name=\"tfgp\" style=\"-wap-input-format: '*N'\" maxlength=\"2\">";
      echo 
    "<br/><input type=\"Submit\" Value=\"Give\" name=\"Give\"></form>";
      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    //////////////////////////////////////////Give Battle points

    else if($action=="batp")
    {
      
    $who $_GET["who"];
      
    addonline(getuid_sid($sid),"Giving Battle Points","");
        echo 
    "<head>";
        echo 
    "<title>Give Battle Points</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      
    $judg mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
      if(
    ismod(getuid_sid($sid))||$judg[0]>0)
      {
      echo 
    "<b>Give/Take BPs To ".getnick_uid($who)."</b><br/><br/>";
      echo 
    "<form action=\"genproc.php?action=batp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
      echo 
    "<input name=\"tfbp\" style=\"-wap-input-format: '*N'\" maxlength=\"2\">";
      echo 
    "<br/><input type=\"hidden\" name=\"giv\" value=\"1\">";
      echo 
    "<input type=\"Submit\" name=\"Add\" Value=\"Add\"></form>";
        echo 
    "<form action=\"genproc.php?action=batp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
      echo 
    "<input name=\"tfbp\" style=\"-wap-input-format: '*N'\" maxlength=\"2\">";
      echo 
    "<br/><input type=\"hidden\" name=\"giv\" value=\"0\">";
      echo 
    "<input type=\"Submit\" name=\"Remove\" Value=\"Remove\"></form>";
      }else{
        echo 
    "You Can't Do This";
      }
      echo 
    "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    //////////////////////////////////////////Post Options

    else if($action=="pstopt")
    {
      
    $pid $_GET["pid"];
      
    $page $_GET["page"];
      
    $fid $_GET["fid"];
        
    addonline(getuid_sid($sid),"Post Options","");
        
    $pinfomysql_fetch_array(mysql_query("SELECT uid,tid, text  FROM ibwf_posts WHERE id='".$pid."'"));
        
    $trid $pinfo[0];
        
    $tid $pinfo[1];
        
    $ptext htmlspecialchars($pinfo[2]);
        echo 
    "<head>";
        echo 
    "<title>Post Options</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>Post Options</b>";
      
      echo 
    "</p>";
      echo 
    "<p>";
      
    $trnick getnick_uid($trid);
      echo 
    "<b>1 </b><a accesskey=\"1\" href=\"inbox.php?action=sendpm&amp;sid=$sid&amp;who=$trid\">»Send PM to $trnick</a><br/>";
      echo 
    "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$trid\">»View $trnick's Profile</a><br/>";
      
    //echo "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">»Quote</a><br/>";
      
    echo "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=rpost&amp;sid=$sid&amp;pid=$pid\">»Report</a><br/>";
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;page=$page\">«Back to topic</a><br/>";
      if(
    ismod(getuid_sid($sid)))
      {
        echo 
    "<br/>Text: ";
        echo 
    "<form action=\"modproc.php?action=edtpst&amp;sid=$sid&amp;pid=$pid\" method=\"post\">";
        echo 
    "<input name=\"ptext\" value=\"$ptext\" maxlength=\"500\">";
        echo 
    "<br/><input type=\"Submit\" Value=\"Edit\" name=\"Edit\"></form>";

    echo 
    "<br/><b>6 </b><a accesskey=\"6\" href=\"modproc.php?action=delp&amp;sid=$sid&amp;pid=$pid\">»DELETE</a><br/>";
      }
      echo 
    "</p>";
    echo 
    "<p align=\"center\">";
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }

    else if(
    $action=="tpcopt")
    {
        
    $tid $_GET["tid"];
        
    addonline(getuid_sid($sid),"Topic Options","");
        
    $tinfomysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed  FROM ibwf_topics WHERE id='".$tid."'"));
        
    $trid $tinfo[2];
        
    $ttext htmlspecialchars($tinfo[3]);
        
    $tname htmlspecialchars($tinfo[0]);
        echo 
    "<head>";
        echo 
    "<title>Toic Options</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<b>Topic Options</b>";
      echo 
    "</p>";
      echo 
    "<p>";
      echo 
    "Topic ID: <b>$tid</b><br/>";
      
    $trnick getnick_uid($trid);
      echo 
    "<b>1 </b><a accesskey=\"1\" href=\"inbox.php?action=sendpm&amp;sid=$sid&amp;who=$trid\">»Send PM to $trnick</a><br/>";
      echo 
    "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$trid\">»View $trnick's Profile</a><br/>";
      
    //echo "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">»Quote</a><br/>";
      
    $plid mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
      if(
    $plid[0]==0)
      {
      if(
    ismod($uid))
        {
      echo 
    "<a href=\"index.php?action=pltpc&amp;sid=$sid&amp;tid=$tid\">»Add Poll</a><br/>";
    }
    }else{
      if(
    ismod($uid))
      {
        echo 
    "<a href=\"genproc.php?action=dltpl&amp;sid=$sid&amp;tid=$tid\">»Delete Poll</a><br/>";
        }
    }
      echo 
    "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=rtpc&amp;sid=$sid&amp;tid=$tid\">»Report</a><br/>";
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;page=1\">«Back to topic</a><br/>";
      if(
    ismod(getuid_sid($sid)))
      {
        echo 
    "<br/>Title: ";
        echo 
    "<form action=\"modproc.php?action=rentpc&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
        echo 
    "<input name=\"tname\" value=\"$tname\" maxlength=\"25\"/>";
        echo 
    "<br/><input type=\"Submit\" Name=\"Rename\" Value=\"Rename\"></form>";
        echo 
    "<br/>Text: ";
        echo 
    "<form action=\"modproc.php?action=edttpc&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
        echo 
    "<input name=\"ttext\" value=\"$ttext\" maxlength=\"500\"/>";
        echo 
    "<br/><input type=\"Submit\" Name=\"Edit\" Value=\"Edit\"></form>";

    echo 
    "<br/><a href=\"modproc.php?action=delt&amp;sid=$sid&amp;tid=$tid\">»DELETE</a><br/>";
        echo 
    "<br/>";
        if(
    $tinfo[5]=='1')
        {
          
    $ctxt "Open";
          
    $cact "0";
        }else{
            
    $ctxt "Close";
          
    $cact "1";
        }
        echo 
    "<a href=\"modproc.php?action=clot&amp;sid=$sid&amp;tid=$tid&amp;tdo=$cact\">»$ctxt</a><br/>";
        if(
    $tinfo[4]=='1')
        {
          
    $ptxt "Unpin";
          
    $pact "0";
        }else{
            
    $ptxt "Pin";
          
    $pact "1";
        }
      echo 
    "<a href=\"modproc.php?action=pint&amp;sid=$sid&amp;tid=$tid&amp;tdo=$pact\">»$ptxt</a><br/>";
      
    //echo "<a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">»Quote</a><br/>";
      
    echo "<br/>Move to:<br/>";
      
    $forums mysql_query("SELECT id, name FROM ibwf_forums WHERE clubid='0'");
      echo 
    "<form action=\"modproc.php?action=mvt&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
      echo 
    "<select name=\"mtf\">";
      while (
    $forum mysql_fetch_array($forums))
      {
        echo 
    "<option value=\"$forum[0]\">$forum[1]</option>";
      }
      echo 
    "</select><br/>";
      echo 
    "<input type=\"Submit\" Value=\"Move\" name=\"Move\"></form>";
      }
      echo 
    "</p>";
    echo 
    "<p align=\"center\">";
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
              echo 
    "<b>8 </b><a accesskey=\"8\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
              echo 
    "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
      echo 
    "</body>";
    }
    else if (
    $action=="chat")           {
            
    addonline(getuid_sid($sid),"chat room list","index.php?action=chat");
            echo 
    "<head>";
            echo 
    "<title>Chatroom List</title>";
            echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
            echo 
    "</head>";
            echo 
    "<body>";
            
    //echo "<div><img src=\"../images/chat.gif\" alt=\"\"/></div>";
            
    echo popup($sid);
            echo 
    "<p align=\"center\">";
            
    $rooms mysql_query("SELECT id, name, perms, mage, chposts FROM ibwf_rooms WHERE static='1' AND clubid='0'");
            while (
    $roommysql_fetch_array($rooms))
            {
              
              
    /*if(canenter($room[0], $sid))
              {*/
                
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
                echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$room[0]\">$room[1]($noi[0])</a><br/>";
              
    /*}*/
              
            
    }
            echo 
    "<br/>";
            echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=uchat&amp;sid=$sid\">Private Rooms</a><br/>";
            echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo 
    "</p>";
            echo 
    "</body>";
                                               }
    else if (
    $action=="uchat")           {
    addonline(getuid_sid($sid),"Chat Menu","");
        echo 
    "<head>";
        echo 
    "<title>Chat Menu</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
            echo 
    "<p align=\"center\">";
            echo 
    "<img src=\"../images/chat.gif\" alt=\"*\"/><br/>";
            echo 
    "</p>";
    echo 
    "<p align=\"center\">";
         echo 
    "<br/>";
            echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=chat&amp;sid=$sid\">Public Rooms</a><br/>";
            echo 
    "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=mkroom&amp;sid=$sid\">Create Room</a><br/><br/>";
            
    $rooms mysql_query("SELECT id, name, pass FROM ibwf_rooms WHERE static='0'");
            
    $co=0;
            while (
    $roommysql_fetch_array($rooms))
            {
                
    $co++;
              if(
    canenter($room[0], $sid))
              {
                
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
                if(
    $room[2]=="")
                {
                echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$room[0]\">".htmlspecialchars($room[1])."($noi[0])</a><br/>";
                }else{
    echo 
    htmlspecialchars($room[1]);
                  
    //echo "($noi[0])";
    echo "<form action=\"chat.php\" method=\"get\">";
                  echo 
    "<br/><input format=\"*x\" name=\"rpw\" maxlength=\"10\"/><br/>";
    echo 
    "<input type=\"submit\" value=\"GO\"/>";
                  echo 
    "<input type=\"hidden\" name=\"rid\" value=\"$room[0]\"/>";
                  echo 
    "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
                  echo 
    "</form>";
                }
              }
            }
            echo 
    "<br/><br/><b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo 
    "</p>";
            echo 
    "</body>";
                                               }
    else if(
    $action=="mkroom")
    {
        
    addonline(getuid_sid($sid),"Creating Chatroom","");
        echo 
    "<head>";
        echo 
    "<title>Create Room</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
            echo 
    "<p>";
            echo 
    "<small><img src=\"../images/point.gif\" alt=\"!\"/>Leave password empty if you dont want to lock the room</small><br/>";
            echo 
    "<small><img src=\"../images/point.gif\" alt=\"!\"/>Don't make the password too personal, it's visible in the database</small><br/><br/>";
            echo 
    "<form action=\"genproc.php?action=mkroom&amp;sid=$sid\" method=\"post\">";
            echo 
    "Room Name: <input name=\"rname\" maxlength=\"30\"><br/>";
            echo 
    "Password: <input name=\"rpass\" style=\"-wap-input-format: '*x'\" maxlength=\"10\"><br/>";
            echo 
    "<input type=\"Submit\" name=\"Create\" Value=\"Create\"></form>";
            echo 
    "</p>";
            echo 
    "<p align=\"center\">";
            echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo 
    "</p>";
            echo 
    "</body>";
    }
                                               
    else if (
    $action=="funm")           {
    addonline(getuid_sid($sid),"Fun Menu","");
        echo 
    "<head>";
        echo 
    "<title>Fun n Games</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
            echo 
    "<p align=\"center\">";
            echo 
    "<img src=\"../images/roll.gif\" alt=\"*\"/><br/>";
            echo 
    "Hello, so you want to have some creative fun? well you came into the right place";
            echo 
    "</p>";
            echo 
    "<p>";
          echo 
    "<b>1 </b><a accesskey=\"1\" href=\"babe.php?sid=$sid\">»ChatGirl</a><br/>";
            echo 
    "<b>2 </b><a accesskey=\"2\" href=\"games.php?action=guessgm&amp;sid=$sid\">»Guess The Number</a><br/>";
          echo 
    "<b>4 </b><a accesskey=\"4\" href=\"games.php?action=hangman&amp;sid=$sid\">»Hangman</a><br/>";
            echo 
    "<b>5 </b><a accesskey=\"5\" href=\"games.php?action=scramble&amp;sid=$sid\">»Word Scramble</a><br/>";

            
    //echo "»Hangman<br/>";
            //echo "»Dares Box<br/>";
            
    echo "</p>";
            echo 
    "<p align=\"center\">";
            echo 
    "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo 
    "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo 
    "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo 
    forumlink($sid,9);

      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo 
    "</p>";
            echo 
    "</body>";
                                               }
    ///////////////////////////////view blog

    else if($action=="viewblog")
    {
      
    $bid $_GET["bid"];
      
    addonline(getuid_sid($sid),"Viewing Users Blog","");
        echo 
    "<head>";
        echo 
    "<title>View Blog</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      echo 
    "<p>";

      
    $pminfo mysql_fetch_array(mysql_query("SELECT btext, bname, bgdate,bowner, id FROM ibwf_blogs WHERE id='".$bid."'"));
        
    $bttl htmlspecialchars($pminfo[1]);
        
    $btxt parsemsg($pminfo[0], $sid);
        
    $bnick getnick_uid($pminfo[3]);
      
    $vbbl "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$pminfo[3]\">$bnick</a><br/>";
      echo 
    "Club ID: <b>$bid</b><br/>";
        echo 
    "<b>$bttl</b> by: $vbbl<br/>";
      echo 
    "$btxt<br/>";
      
    $tmstamp $pminfo[2];
      
    $tmdt date("d m y - h:i:s"$tmstamp);
      echo 
    "<small>$tmdt</small><br/><br/>";
      
    $vb mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_brate WHERE uid='".$uid."' AND blogid='".$bid."'"));
      if(
    $vb[0]==0)
      {
      echo 
    "<form action=\"genproc.php?action=rateb&amp;sid=$sid&amp;bid=$pminfo[4]\" method=\"post\">";
      echo 
    "<select name=\"brate\">";
      echo 
    "<option value=\"1\">1</option>";
      echo 
    "<option value=\"2\">2</option>";
      echo 
    "<option value=\"3\">3</option>";
      echo 
    "<option value=\"4\">4</option>";
      echo 
    "<option value=\"5\">5</option>";
      echo 
    "</select><br/>";
      echo 
    "<input type=\"Submit\" Name=\"Rate\" Value=\"Rate\"></form>";
      }else{
        
    $rinfo mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(brate) as nofp FROM ibwf_brate WHERE blogid='".$bid."'"));
        
    $ther $rinfo[1]/$rinfo[0];
        echo 
    "Rate: $ther - Points: $rinfo[1]";
      }
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<a href=\"lists.php?action=allbl&amp;sid=$sid\">Back to Blogs</a><br/>";
      
    $bnick getnick_uid($pminfo[3]);
      echo 
    "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$pminfo[3]\">Back to $bnick's Blogs</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo 
    "</p>";
        echo 
    "</body>";

    }
    /////////////////////////////////Terms of use

    else if($action=="terms")
    {
      
    $uid =getuid_sid($sid);
      if(
    $uid>0)
      {
      
    addonline(getuid_sid($sid),"Terms of use","");
      }
        echo 
    "<head>";
        echo 
    "<title>Terms Of Use</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo 
    "</head>";
        echo 
    "<body>";
      echo 
    "<p align=\"center\">";
          echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>This Site Is made for OVER 14's ONLY, and users found to be lying about their age in order to access the site will be deleted without warning. YOU HAVE BEEN WARNED!<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Posts containing racism, spamming, flooding Or hacking Information will be deleted immediately, and the posters will get warned or banned<br/>";
        echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Registering more than one nickname, could result in  all your accounts being deleted<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Never give your username and password to anyone<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Faking your personal information (like age, sex, location etc..) just to gain access to hidden forums and other content in here, could result in you being banned, or getting a warning at least<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Harassment and racism will result in a ban, and an permanent IP-Ban if this behavior continues<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>Bumping topics (keep posting in them by the author of the topic just to keep it in first page) will cause these topics to be deleted and the penalty could vary between warning, or even a ban<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>You MUST speak in english on the Public parts of this site (shoutbox, and all chat rooms except user created and international rooms), but you are free to create your own chatroom and club in any language<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>No smoking in public, next to the pregnant ladies, or next to babies hehe<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>ALL Bans are logged as are ALL pms with any form of website links in them, any pms sent containing weblinks will be moderated and may result in a ban for the sending user for an appropriate length of time.<br/>";
      echo 
    "<img src=\"../images/point.gif\" alt=\"!\"/>The most important rule is to have fun here and enjoy your stay ;)<br/>";
      echo 
    "<br/>Remember, these rules were made for protecting you before protecting us, if you think they are a little restrictive then ask any online staff member(only if you logged in), Thank you<br/>";
        echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      if(
    $uid>0)
      {
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }else{
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"index.php\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }
      echo 
    "</p>";
      echo 
    "</body>";
    }
    else{
      
    /////////////////////////Main Page Here
      
    echo "<head>";
      echo 
    "<title>$sitename</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<div><img src=\"../images/logo.gif\" alt=\"\"/><br/>";
      echo 
    "".date("H:i")." - ".date("D jS M y")."</div>";
      echo 
    "<p align=\"center\">";
      echo 
    "Welcome to $sitename Community, please Feel Free To Browse and invite all your friends ;o)</p>";
      echo 
    "<p align=\"center\">wap2.0/xhtml<br/>works with any pc browser n most mobiles</p>";
      echo 
    "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"\"/></p>";
      echo 
    "<form action=\"login.php\" method=\"get\"><p align=\"center\">";
      echo 
    "<b>Username:</b><br/><input align=\"center\" name=\"loguid\" size=\"12\" maxlength=\"12\"/><br/>";
      echo 
    "<b>Password:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
      echo 
    "<input type=\"submit\" value=\"Login!\"></p></form>";
      echo 
    "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"\"/></p>";
      echo 
    "<p align=\"center\"><br/>Not registered yet? <br/><a href=\"register.php\">Register</a><br/>";
      echo 
    "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      
    $onu getnumonline();
      echo 
    "Members Inside: $onu<br/><br/>";
      echo 
    "<a href=\"../wap/index.php\">Wap 1.0(wml) Version</a></p>";
      echo 
    mobads();
      echo 
    "<div><b>©2007<br/>$sitename</b></div>";
      echo 
    "</body>";
    }
    ?>
    </html>
    Last edited by metulj; 12.11.10, 19:37. Reason: use [ php ] tag [ / php ] for posting php code, specially for longer code

    #2
    Originally posted by bamster89 View Post
    help can some one fix this to me

    Code:
    <?php
    include("../blocked.php");
    include("config.php");
    include("core.php");
    header("Cache-Control: no-cache, must-revalidate");	        // Prevent caching, HTTP/1.1
    header("Pragma: no-cache");
    //header('Content-type: application/vnd.wap.xhtml+xml'); 
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    $bcon = connectdb();
    if (!$bcon)
    {
        echo "<head>";
        echo "<title>Error!!!</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
        echo "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
        echo "This error happens usually when backing up the database, please be patient...";
        echo "</p>";
        echo "</body>";
        echo "</html>";
        exit();
    }
    
    $brws = explode("/",$HTTP_USER_AGENT);
    $ubr = $brws[0];
    $uip = getip();
    $action = $_GET["action"];
    $sid = $_GET["sid"];
    $page = $_GET["page"];
    $who = $_GET["who"];
    $uid = getuid_sid($sid);
    $theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
    $sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
    $sitename = $sitename[0];
    cleardata();
    
    if(isipbanned($uip,$ubr))
      {
    if(!isshield(getuid_sid($sid)))
      {
      echo "<head>";
      echo "<title>Ip Block!</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<div><img src=\"../images/notok.gif\" alt=\"!\"/></div>";
      echo "<b>This IP address is blocked!!!</b><br/>";
      echo "<br/>";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      $remain =  $banto[0] - time();
      $rmsg = gettimemsg($remain);
      echo "<b>Time Left: </b>$rmsg<br/>";
      echo "</p>";
      echo "<p align=\"center\"><form action=\"login.php\" method=\"get\">";
      echo "<b>Username:</b><br/><input align=\"center\" name=\"loguid\" style=\"-wap-input-format: '*x'\" size=\"12\" maxlength=\"12\"/><br/>";
      echo "<b>Password:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
      echo "<input name=\"LOGIN\" type=\"submit\" value=\"Login!\"></form></p>";
      echo "<p align=\"center\"><br/>Not registered yet? <br/><a href=\"register.php\">Sign-Up</a><br/>";
      echo "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo "</p>";
      echo "<p align=\"center\">";
      $onu = getnumonline();
      echo "Members Inside: $onu<br/><br/>";
      echo "<a href=\"../wap/index.php\">Wap 1.0(wml) Version</a></p>";
      echo mobads();
      echo "<div><b>&#169;2006-2007<br/>$sitename</b></div>";
      echo "</body>";
      echo "</html>";
      exit();
      }
    }
    
    if(($action != "") && ($action!="terms"))
      {
        $uid = getuid_sid($sid);
        if((islogged($sid)==false)||($uid==0))
        {
          echo "<head>";
          echo "<title>Error!!!</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
          echo "</head>";
          echo "<body>";
          echo "<p align=\"center\">";
          echo "You are not logged in<br/>";
          echo "Or Your session has been expired<br/><br/>";
          echo "<a href=\"index.php\">Login</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }            
     }
    
    //echo isbanned($uid);
    if(isbanned($uid))
        {
          echo "<head>";
          echo "<title>Error!!!</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo "</head>";
          echo "<body>";
          echo "<p align=\"center\">";
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
          echo "<b>You are Banned</b><br/><br/>";
          $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
    	$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
          $remain = $banto[0]- time();
          $rmsg = gettimemsg($remain);
          echo "<b>Time Left: </b>$rmsg<br/>";
          $nick = getnick_uid($banto[2]);
    	echo "<b>By: </b>$nick<br/>";
    	echo "<b>Reason: </b>$banto[1]";
          //echo "<a href=\"index.php\">Login</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
    $res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");
    
    ////////////////////////////////////////MAIN PAGE
    if($action=="main")
    {
      addvisitor();
      addonline(getuid_sid($sid),"Main Menu","index.php?action=$action");
      //saveuinfo($sid);
      $nick = getnick_sid($sid);
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      $time = time() - (9 * 60 * 60);
      $newtime = date("H:i",$time);
      $date = strtotime('-9 hours');
      $newdate = date('D jS M y',$date);
    
      echo "<div><img src=\"../images/logo.gif\" alt=\"logo\"/><br/>";
      echo "".$newtime." - ".$newdate."</div>";
      echo popup($sid);
      $nick = getnick_sid($sid);
      echo "<p align=\"center\">You are logged in as $nick <a accesskey=\"0\" href=\"index.php?action=logout&amp;sid=$sid&amp;who=$uid\">Logout</a></p>";
      $fmsg = getbbcode(getfmsg(), $sid, 0);
      echo "<b>Site News"
      echo "<p align=\"center\">$fmsg</p>";
      echo "<p align=\"center\">";  
      echo getshoutbox($sid);
      echo "</p>";
    
      echo "<p align=\"center\">";
      $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
      $memid = mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
      echo "We Have $norm[0]<br/>Registered Members<br/><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a><br/>has now joined<br/>$sitename :o)<br/><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
      if($noi[0]!=0){
      $sql = mysql_fetch_array(mysql_query("SELECT id, name, birthday  FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate()) ORDER BY RAND() LIMIT 1"));
      $uage = getage($sql[2]);
      $lnk = "Happy Birthday<br/><a href=\"index.php?action=viewuser&amp;who=$sql[0]&amp;sid=$sid\">$sql[1]</a>";
      echo "$lnk<br/>Hope U have A Wonderful Day<br/><br/>";
      }
    if(isowner(getuid_sid($sid)))
      {
      echo "<a href=\"ownercp.php?action=ownercp&amp;sid=$sid\">Owner Tools</a><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE validated='0'"));
    if($noi[0]>0)
      {
      echo "<a href=\"ownercp.php?action=validatelist&amp;sid=$sid\">Validate List($noi[0])</a><br/>";
      }
      }
    if(isheadadmin(getuid_sid($sid)))
      {
      echo "<a href=\"headadmincp.php?action=headadmincp&amp;sid=$sid\">Head Admin Tools</a><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE validated='0'"));
    if($noi[0]>0)
      {
      echo "<a href=\"headadmincp.php?action=validatelist&amp;sid=$sid\">Validate List($noi[0])</a><br/>";
      }
      }
      if(ismod($uid))
      {
      if(!isowner(getuid_sid($sid)))
      {
    if(!isheadadmin(getuid_sid($sid)))
      {
      echo "<a href=\"admincp.php?action=admincp&amp;sid=$sid\">Admin Tools</a><br/>";
      }
      }
      }
      if(ismod($uid))
      {
      $adminclub = "1";
      $ismem = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND uid='".$uid."'"));
      if($ismem[0]==0)
      {
      echo "<a href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$adminclub\">Join Admin Club Now!</a><br/>";
      }else{
      $clinfo = mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$adminclub."'"));
      $clnm = htmlspecialchars($clinfo[0]);
      $fid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$adminclub."'"));
      $rid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_rooms WHERE clubid='".$adminclub."'"));
      $tps = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid[0]."'"));
      $pss = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$fid[0]."'"));
      $cango = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND uid='".$uid."' AND accepted='1'"));
      if(($cango[0]>0)||(isheadadmin($uid))||(isowner($uid)))
      {
      $noa = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE clid='".$adminclub."'"));
      echo "<a href=\"lists.php?action=annc&amp;sid=$sid&amp;clid=$adminclub\">Announcements($noa[0])</a><br/>";
      $noa = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE rid='".$rid[0]."'"));
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$rid[0]."'"));
      echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid[0]\">$clnm Chat($chs[0])</a><br/>";
      echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid[0]\">$clnm Forum($tps[0]/$pss[0])</a><br/>";
      if($clinfo[1]==$uid)
      {
      $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND accepted='0'"));
      if($mems[0]>0)
      {
      echo "<a href=\"lists.php?action=clreq&amp;sid=$sid&amp;clid=$adminclub\">Requests($mems[0])</a><br/>";
      }
      }
      }
      }
        $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE reported='1'"));
        $tot = $tnor[0];
        $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups WHERE reported='1'"));
        $tot += $tnor[0];
        $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE reported='1'"));
        $tot += $tnor[0];
        $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE reported='1'"));
        $tot += $tnor[0];
        $tnol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog"));
        $tol = $tnol[0];
        if($tol+$tot>0)
        {
        echo "<a href=\"modcp.php?action=main&amp;sid=$sid\">Reports/Logs($tot/$tol)</a><br/><br/>";
        }
      }
    
    echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=online&amp;sid=$sid\">Online Users(".getnumonline().")</a><br/>";
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      echo "<b>2 </b><a accesskey=\"2\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
      $reqs = getnreqs($uid);
      if($reqs>0)
      {
    
        $request = "! <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
      }
      $uid = getuid_sid($sid);
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
      echo "<b>3 </b><a accesskey=\"3\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist($onbuds/$mybuds)</a>$request<br/>";
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
      echo "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=clmenu&amp;sid=$sid\">Clubs($chs[0])</a><br/>";
      if(getfview()==0)
      {
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      echo "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=forumindx&amp;sid=$sid\">Forums($topics[0]/$posts[0])</a><br/>";
      }
      $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id");
      while($fcat=mysql_fetch_array($fcats))
      {
        $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$fcat[0]."' AND clubid='0' ORDER BY position, id, name");
    
        if(getfview()==1)
        {
        echo "<b>$fcat[1]</b><br/>";
        while($forum=mysql_fetch_array($forums))
            {
          if(canaccess(getuid_sid($sid),$forum[0]))
          {
          echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$forum[1]</a><br/>";
          }
        }
        }else if(getfview()==2)
        {
        $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics a INNER JOIN ibwf_forums b ON a.fid = b.id WHERE b.cid='".$fcat[0]."'"));
        $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id INNER JOIN ibwf_forums c ON b.fid = c.id WHERE c.cid='".$fcat[0]."'"));
        echo "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$fcat[0]\">$fcat[1]($topics[0]/$posts[0])</a><br/>";
        }else if(getfview()==3)
        {
      echo "<form action=\"index.php\" method=\"get\">";
      echo "<b>$fcat[1]</b><br/><select name=\"fid\">";
      while($forum=mysql_fetch_array($forums))
      {
    if(canaccess(getuid_sid($sid),$forum[0]))
      {
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
      echo "<option value=\"$forum[0]\">$forum[1]($topics[0]/$posts[0])</option>";
      }
      }
      echo "</select><br/>";
      echo "<input type=\"hidden\" name=\"action\" value=\"viewfrm\"/>";
      echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
      echo "<input type=\"hidden\" name=\"fid\" value=\"$(fid)\"/>";
      echo "<input type=\"submit\" value=\"[view]\"/>";
      echo "</form>";
        }
      }
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      echo "<b>6 </b><a accesskey=\"6\" href=\"index.php?action=chat&amp;sid=$sid\">Chat($chs[0])</a><br/>";
    
    if(!($dp = opendir("../pics/"))) die ("Cannot open ./");
    $files = array(); 
    while ($pics = readdir ($dp))
    	{
    	if(substr($pics,0,1) != '.' and $pics!= "index.php")
    		{
    		$files[] =  $pics;
    		}
    	}
    $file_count = count ($files);
    sort ($files);
      echo "<b>7 </b><a accesskey=\"7\" href=\"../pics/index.php?action=pics&amp;sid=$sid&amp;script=xhtml\">Gallery($file_count)</a><br/>";
      //echo "<a href=\"shop.php?action=shop&amp;sid=$sid\">&#187;Plusses Shop</a><br/>";
      echo "<b>8 </b><a accesskey=\"8\" href=\"linksites.php?sid=$sid\">Links</a><br/>";
      echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=logout&amp;sid=$sid&amp;who=$uid\">Logout</a>";
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<a href=\"quiz.php?action=quiz&amp;sid=$sid\">Quiz</a><br/>";
      echo "<a href=\"index.php?action=search&amp;sid=$sid\">Search</a><br/>";
      echo "<a href=\"lists.php?action=smilies&amp;sid=$sid\">Smilies List</a><br/>";
      $downloads = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_uploads"));
      echo "<a href=\"../uploaded/index.php?sid=$sid&amp;site=web\">Downloads($downloads[0])</a><br/>";
      echo "<a href=\"index.php?action=funm&amp;sid=$sid\">Fun n Games</a><br/>";
      $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
      echo "Members:<a href=\"lists.php?action=members&amp;sid=$sid\">$norm[0]</a><br/>";
      $noi2 = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE perm>'0'"));
      $timeout = 300;
      $timeon = time()-$timeout;
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'"));
      echo "Staff List: <a href=\"index.php?action=stfol&amp;sid=$sid\">".$noi[0]."/$noi2[0]</a></p>";
      echo "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"banner\"/></p>";
      echo "<p align=\"center\">";  
    if(ismod($uid))
      {
      echo "<p align=\"center\"><a href=\"staffinfo.php?sid=$sid\">Staff Rules and Info</a><br/>";
      }
      echo "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo "<a href=\"index.php?action=stats&amp;sid=$sid\">Site Stats</a></p>";
      echo mobads();
      echo "<center><a href=\"hosting.php?sid=$sid\">Hosting</a></center>";
      echo "<div><b>&#169;2007<br/>$sitename</b></div>";
      echo "</body>";
    }
    ///////////////////////////Logout///////////////////////////////
    
    else if($action=="logout")
    {
      $who = $_GET["who"];
      $user = getnick_uid($who);
      echo "<head>";
      echo "<title>Logout</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      $uid = getuid_sid($sid);
      if($who!=$uid){ 
      echo "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
      echo "<br/>$user, U Cannot Log Someone Out<br/>This Is An Attempt To Breach Site Security<br/>If U Are Caught Trying This Again U Will Be Banned<br/>";
      echo "<br/><a accesskey=\"1\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Ok!</a>";
      echo "</p>";
      }else{
      echo "<br/>";
      $res = mysql_query("DELETE FROM ibwf_ses WHERE uid='".$who."'");
      if($res)
      {
      addonline($who,"Logging Out","");
      echo "<img src=\"../images/ok.gif\" alt=\"O\"/><b>$user</b><br/>U Hav Successfully Logged Out Pls Come Back Soon :o)<br/>";
      }else{
      echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Logging Out";
      }
      echo "<br/><a accesskey=\"1\" href=\"index.php\"><img src=\"../images/home.gif\" alt=\"\"/>ok!</a>";
      echo "</p>";
      }
      echo "</body>";
    }
    ///////////////////////////////////
    
    else if($action=="forumindx")
    {
      addonline(getuid_sid($sid),"Forum Index","index.php?action=$action");
      $sid = $_GET["sid"];
      $uid = getuid_sid($sid);
      echo "<head>";
      echo "<title>Forum Index</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p>";
      echo "<b>Our Forum Categories</b><br/>";
      $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id");
      $iml = "<img src=\"../images/1.gif\" alt=\"\"/>";
      while($fcat=mysql_fetch_array($fcats))
      {
        $catlink = "<a href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$fcat[0]\">$iml$fcat[1]</a>";
        echo "<br/>$catlink";
        $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$fcat[0]."' AND clubid='0' ORDER BY position, id, name");
        if(getfview()==0)
        {
        echo "<br/>";
        while($forum=mysql_fetch_array($forums))
            {
      $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
          echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$forum[1]($notp[0]/$nops[0])</a><br/>";
          }
        }
      }
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    ///////////////////////////////////
    
    else if($action=="clmop")
    {
        $clid = $_GET["clid"];
        $who = $_GET["who"];
        addonline(getuid_sid($sid),"Moderating Club Member","");
          echo "<head>";
          echo "<title>Moderate Member</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo "</head>";
          echo "<body>";
        echo "<p align=\"center\">";
        $whnick = getnick_uid($who);
        echo "<b>$whnick</b>";
        echo "</p>";
        echo "<p>";
        $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
    $cow = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
    if($exs[0]>0 && $cow[0]>0)
    {
        echo "<b>7 </b><a accesskey=\"7\" href=\"genproc.php?action=dcm&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">&#187;Kick $whnick out</a><br/>";
        echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gcp&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">&#187;$whnick's Club Points</a><br/>";
        echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=gpl&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">&#187;Give $whnick Plusses</a><br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Missing Info!";
        }
        echo "</p>";
    
        echo "<p align=\"center\">";
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    else if($action=="gcp")
    {
        $clid = $_GET["clid"];
        $who = $_GET["who"];
        addonline(getuid_sid($sid),"Moderating Club Member","");
          echo "<head>";
          echo "<title>Moderate Member</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo "</head>";
          echo "<body>";
        echo "<p align=\"center\">";
        $whnick = getnick_uid($who);
        echo "<b>$whnick</b>";
        echo "</p>";
        echo "<p>";
        $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
    $cow = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
    if($exs[0]>0 && $cow[0]>0)
    {
        echo "<form action=\"genproc.php?action=gcp&amp;sid=$sid&amp;who=$who&amp;clid=$clid\" method=\"post\">";
        echo "Action: <select name=\"giv\">";
        echo "<option value=\"1\">Add</option>";
        echo "<option value=\"0\">Subtract</option>";
        echo "</select><br/>";
        echo "Points: <input name=\"pnt\" style=\"-wap-input-format: '*N'\" size=\"2\" maxlength=\"2\"/><br/>";
        echo "<input type=\"submit\" value=\"GO\"/>";
        echo "</form>";
        }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Missing Info!";
        }
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    else if($action=="gpl")
    {
        $clid = $_GET["clid"];
        $who = $_GET["who"];
        addonline(getuid_sid($sid),"Moderating Club Member","");
          echo "<head>";
          echo "<title>Moderate Member</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo "</head>";
          echo "<body>";
        echo "<p align=\"center\">";
        $whnick = getnick_uid($who);
        echo "<b>$whnick</b>";
        echo "</p>";
        echo "<p>";
        $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
    $cow = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
    if($exs[0]>0 && $cow[0]>0)
    {
        echo "<small><img src=\"../images/point.gif\" alt=\"!\"/>You can only give plusses, these are real plusses, you can't subtract plusses<br/>";
        $cpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_clubs WHERE id='".$clid."'"));
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Your club plusses credit is $cpl[0]<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Do not abuse giving of plusses to users, your club could be deleted<br/></small><br/>";
        echo "<form action=\"genproc.php?action=gpl&amp;sid=$sid&amp;who=$who&amp;clid=$clid\" method=\"post\">";
        echo "Plusses: <input name=\"pnt\" style=\"-wap-input-format: '*N'\" size=\"2\" maxlength=\"2\"/><br/>";
        echo "<input type=\"submit\" value=\"GO\"/>";    
        echo "</form>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Missing Info!";
        }
        echo "</p>";
    
        echo "<p align=\"center\">";
    
        echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    ///////////////////////////////////Control Panel
    
    else if($action=="cpanel")
    {
      addonline(getuid_sid($sid),"User Settings","index.php?action=cpanel");
      echo "<head>";
      echo "<title>Settings</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/cpanel.gif\" alt=\"CPanel\"/><br/>";
      echo "<b>Control Panel</b>";
      echo "</p>";
      echo "<p>";
      echo "<br/><b>---General Options---</b><br/>";
      echo "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$uid\">&#187;View Your Profile</a><br/>";
      echo "<a href=\"index.php?action=uset&amp;sid=$sid\">&#187;Update Profile</a><br/>";
      echo "<a href=\"index.php?action=chngpass&amp;sid=$sid\">&#187;Change Password</a><br/>";
      echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">&#187;Extended Settings</a><br/>";
      echo "<a href=\"index.php?action=pws&amp;sid=$sid\">&#187;Personal Wap site</a><br/>";
      $popmsgs = mysql_fetch_array(mysql_query("SELECT popmsg FROM ibwf_users WHERE id='".$uid."'"));
      if($popmsgs[0]==0){
      echo "<a href=\"index.php?action=popenable&amp;sid=$sid\">&#187;Enable Pop-ups</a><br/>";
      }else{
      echo "<a href=\"index.php?action=popdisable&amp;sid=$sid\">&#187;Disable Pop-ups</a><br/>";
      }
      if(automsgs($uid)){
      echo "<a href=\"index.php?action=automsgsoff&amp;sid=$sid\">&#187;Disable Automsgs</a><br/>";
      }else{
      echo "<a href=\"index.php?action=automsgson&amp;sid=$sid\">&#187;Enable Automsgs</a><br/>";
      }
      $sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".$uid."'"));
      if($sml[0]=="1")
      {
      echo "<a href=\"genproc.php?action=shsml&amp;sid=$sid&amp;act=dis\">&#187;Disable Smilies</a><br/>";
      }else{
      echo "<a href=\"genproc.php?action=shsml&amp;sid=$sid&amp;act=enb\">&#187;Enable Smilies</a><br/>";
      }
      echo "<a href=\"index.php?action=sitethms&amp;sid=$sid\">&#187;Change Theme</a><br/>";
      echo "<br/><b>---Other Options---</b><br/>";
      echo "<a href=\"index.php?action=rwidc&amp;sid=$sid\">&#187;$sitename ID card.</a><br/>";
      echo "<a href=\"index.php?action=myclub&amp;sid=$sid\">&#187;My Clubs</a><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$uid."'"));
      echo "<a href=\"lists.php?action=vault&amp;sid=$sid&amp;who=$uid\">&#187;My Download Links($noi[0])</a><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ignore WHERE name='".$uid."'"));
      echo "<a href=\"lists.php?action=ignl&amp;sid=$sid\">&#187;Ignore List($noi[0])</a><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$uid."'"));
      echo "<a href=\"lists.php?action=gbook&amp;sid=$sid&amp;who=$uid\">&#187;Guestbook($noi[0])</a><br/>";
      echo "<a href=\"index.php?action=poll&amp;sid=$sid\">&#187;My Poll</a><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$uid."'"));
      echo "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$uid\">&#187;Blogs($noi[0])</a><br/>";
      echo "<a href=\"lists.php?action=chmood&amp;sid=$sid\">&#187;Chatmood</a><br/>";
      echo "<a href=\"lists.php?action=bbcode&amp;sid=$sid\">&#187;BBCode</a><br/>";
      echo "</p>";
      echo "<p align=\"center\">";  
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    else if($action=="sitethms")
    {
      addonline(getuid_sid($sid),"Site Themes","");
      echo "<head>";
      echo "<title>Site Themes</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<b>Site Themes</b></p>";
      echo "<p>changing ur site theme will change all the colors of the site eg:<br/>backround, text, links, typing fields etc..<br/>";
      echo "<form action=\"genproc.php?action=updtthme&amp;sid=$sid\" method=\"post\">";
      echo "<select name=\"thms\">";
      echo "<option value=\"white\">White</option>";
      echo "<option value=\"black\">Black</option>";
      echo "<option value=\"red\">Red</option>";
      echo "<option value=\"blue\">Blue</option>";
      echo "<option value=\"green\">Green</option>";
      echo "<option value=\"pink\">Pink</option>";
      echo "</select>";
      echo "<select name=\"size\">";
      echo "<option value=\"small\">Small</option>";
      echo "<option value=\"medium\">Medium</option>";
      echo "<option value=\"large\">Large</option>";
      echo "</select>";
      echo "<input type=\"Submit\" name=\"submit\" Value=\"Save\"></form>";
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    ///////////////////////////////////Clubs Menu
    
    else if($action=="clmenu")
    {
        addonline(getuid_sid($sid),"Clubs Menu","");
        echo "<head>";
        echo "<title>Clubs Menu</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<b>Clubs Menu</b>";
        echo "</p>";
        echo "<p>";
        $myid = getuid_sid($sid);
      echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=clubs&amp;sid=$sid\">&#187;All Clubs</a><br/>";
      echo "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=myclub&amp;sid=$sid\">&#187;My Clubs</a><br/>";
      echo "<b>3 </b><a accesskey=\"3\" href=\"lists.php?action=clm&amp;who=$myid&amp;sid=$sid&amp;who=$uid\">&#187;Clubs I'm a member of</a><br/>";
      echo "<b>4 </b><a accesskey=\"4\" href=\"lists.php?action=pclb&amp;sid=$sid&amp;who=$uid\">&#187;Clubs By popularity</a><br/>";
      echo "<b>5 </b><a accesskey=\"5\" href=\"lists.php?action=aclb&amp;sid=$sid&amp;who=$uid\">&#187;Clubs By Activity</a><br/>";
      echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=rclb&amp;sid=$sid&amp;who=$uid\">&#187;5 Random Clubs</a><br/><br/>";
      $ncl = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_clubs ORDER BY created DESC LIMIT 1"));
      echo "The Newest Club Is: <b>* </b><a accesskey=\"*\" href=\"index.php?action=gocl&amp;clid=$ncl[0]&amp;sid=$sid\">".htmlspecialchars($ncl[1])."</a><br/>";
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    else if($action=="popread")
    {
        echo "<head>";
        echo "<title>Pop-Up Read</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $lastloc=$_GET["lastloc"];
        $pmid=$_GET["pmid"];
       $ncl = mysql_query("UPDATE ibwf_private SET read='1' WHERE id='".$pmid."'");
      echo "Pm Now Marked As Read Visit Your Inbox To Reply Or delete the message.<br/>";
        echo "</p>";
    
        echo "<p align=\"center\">";
        if($lastloc=="indxmain"){
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">";
        }else if($lastloc=="cht"){
        $rid=$_GET["rid"];
        echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid\">";
        }
        echo "Back To Where You Where Before</a>";
        echo "</p>";
        echo "</body>";
    }
    
    else if($action=="popenable")
    {
        echo "<head>";
        echo "<title>Enable Pop-Up Msgs</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
       $ncl = mysql_query("UPDATE ibwf_users SET popmsg='1' WHERE id='".$uid."'");
      echo "Pop-Up PMs Have Now Been Enabled On your Profile.<br/>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action=="popdisable")
    {
        echo "<head>";
        echo "<title>Disable Pop-Up Msgs</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $ncl = mysql_query("UPDATE ibwf_users SET popmsg='0' WHERE id='".$uid."'");
        echo "Pop-Up PMs Have Now Been Disabled On your Profile.<br/>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action=="automsgson")
    {
        echo "<head>";
        echo "<title>Enable Auto Msgs</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $ncl = mysql_query("UPDATE ibwf_users SET automsgs='1' WHERE id='".$uid."'");
        echo "Automsgs Have Now Been Enabled.<br/>";
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action=="automsgsoff")
    {
        echo "<head>";
        echo "<title>Disable Auto Msgs</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $ncl = mysql_query("UPDATE ibwf_users SET automsgs='0' WHERE id='".$uid."'");
        echo "Automsgs Have Now Been Disabled.<br/>";
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action=="rwidc")
    {
        addonline(getuid_sid($sid),"My $sitename ID","");
        echo "<head>";
        echo "<title>$sitename Id Card</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<b>$sitename ID card</b><br/>";
        $uid = getuid_sid($sid);
        echo "<img src=\"../rwidc.php?id=$uid\" alt=\"Id Card\"/><br/><br/>";
        echo "This ID card is updated automatically everytime someone request it, the source to your card is $sitename/rwidc.php?id=$uid<br/><br/>";
        echo "you can use it as an avatar in other sites<br/><br/>";
        echo "To look at others cards view the user profile then go to more information&gt;$sitename ID card.";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    ///////////////////////////////////My Clubs
    
    else if($action=="myclub")
    {
        addonline(getuid_sid($sid),"My Clubs","");
        echo "<head>";
        echo "<title>My Clubs</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<b>My Clubs</b>";
        echo "</p>";
        echo "<p>";
        $uid = getuid_sid($sid);
        if(getplusses($uid)<500)
        {
          echo "Clubs are small communities that users can create, every community should have things in common, for example a community for goths, sex freaks, alocholics, rappers and anythin else you can think of, currently people who have more than 500 plusses can only create clubs, every user can create up to maximum of 3 clubs, to get plusses post in the forums, or invite friends";
        }else{
          $uclubs = mysql_query("SELECT id, name FROM ibwf_clubs WHERE owner='".$uid."'");
          while($club=mysql_fetch_array($uclubs))
          {
            echo "<a href=\"index.php?action=gocl&amp;clid=$club[0]&amp;sid=$sid\">$club[1]</a>";
            echo ", <a href=\"genproc.php?action=dlcl&amp;clid=$club[0]&amp;sid=$sid\">[DELETE]</a><br/><br/>";
          }
          $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
          if($noi[0]<3)
          {
          echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=addcl&amp;sid=$sid\">Add Club</a>";
          }
        }
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    ///////////////////////////////////My Clubs
    
    else if($action=="clubs")
    {
        addonline(getuid_sid($sid),"My Clubs List","");
        
        echo "<head>";
        echo "<title>My Clubs List</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<b>Clubs List</b>";
        echo "</p>";
        //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
        $num_items = $noi[0]; //changable
        $items_per_page= 5;
        $num_pages = ceil($num_items/$items_per_page);
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
    
        //changable sql
    
            $sql = "SELECT id, name, owner, description, created FROM ibwf_clubs ORDER BY created DESC LIMIT $limit_start, $items_per_page";
    
    
        echo "<p>";
        $items = mysql_query($sql);
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
        {
            $item[1]=htmlspecialchars($item[1]);
            $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$item[0]."' AND accepted='1'"));
          $lnk = "<a href=\"index.php?action=gocl&amp;clid=$item[0]&amp;sid=$sid\">$item[1]($mems[0])</a> <small>Owner: <a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">".getnick_uid($item[2])."</a></small>";
          echo "$lnk<br/><small>";
          echo htmlspecialchars($item[3])."<br/>Creation Date: (".date("d/m/y", $item[4]).")</small><br/><br/>";
        }
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;view=$view\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;view=$view\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
            $rets = "<form action=\"index.php\" method=\"get\">";
            $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"3\"/>";
            $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
            $rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
            $rets .= "</form>";
    
            echo $rets;
        }
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    else if($action=="gocl")
    {
      $clid = $_GET["clid"];
      $clinfo = mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$clid."'"));
        addonline(getuid_sid($sid),"Viewing A Club","");
        $clnm = htmlspecialchars($clinfo[0]);
        echo "<head>";
        echo "<title>$Clnm</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<b>$clnm</b><br/>";
        if(trim($clinfo[4])=="")
        {
          echo "<img src=\"../images/logo.gif\" alt=\"logo\"/>";
        }else{
            echo "<img src=\"$clinfo[4]\" alt=\"logo\"/>";
        }
        echo "</p>";
        echo "<p>";
        echo "Club ID: <b>$clid</b><br/>";
        $uid = getuid_sid($sid);
        $cango = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND uid='".$uid."' AND accepted='1'"));
        echo "Owner: <a href=\"index.php?action=viewuser&amp;who=$clinfo[1]&amp;sid=$sid\">".getnick_uid($clinfo[1])."</a><br/>";
          $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='1'"));
          echo "Members: <a href=\"lists.php?action=clmem&amp;sid=$sid&amp;clid=$clid\">$mems[0]</a><br/>";
          echo "Created On: ".date("d/m/y", $clinfo[6])."<br/>";
          echo "Plusses credit: $clinfo[5]<br/>";
          $fid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$clid."'"));
          $rid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_rooms WHERE clubid='".$clid."'"));
          $tps = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid[0]."'"));
          $pss = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$fid[0]."'"));
          
        if(($cango[0]>0)||isadmin($uid))
        {
    	    	    if($clid==161) {
    		    echo "<a href=\"http://www.$sitename/clubs/royal/index.php?sid=$sid&amp;site=wap\">Royal X Uploader</a><br/>";
    	}
            $noa = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE clid='".$clid."'"));
            echo "<br/><b>1 </b><a accesskey=\"1\" href=\"lists.php?action=annc&amp;sid=$sid&amp;clid=$clid\"><img src=\"../images/annc.gif\" alt=\"!\"/>Announcements($noa[0])</a><br/>";
            $noa = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE rid='".$rid[0]."'"));
            echo "<b>2 </b><a accesskey=\"2\" href=\"chat.php?sid=$sid&amp;rid=$rid[0]\"><img src=\"../images/chat.gif\" alt=\"*\"/>$clnm Chat($noa[0])</a><br/>";
            echo "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid[0]\"><img src=\"../images/1.gif\" alt=\"*\"/>$clnm Forum($tps[0]/$pss[0])</a><br/><br/>";
    		$ismem = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND uid='".getuid_sid($sid)."'"));
    		
    		if($ismem[0]>0)
    		{
    			//unjoin 
    			if($clinfo[1]!=$uid)
    			{
    				echo "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=unjc&amp;sid=$sid&amp;clid=$clid\">Unjoin Club</a>";
    			}
    		}else{
    			echo "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$clid\">Join Now!</a>";
    		}
    		if(isowner(getuid_sid($sid)))
    		{
    			echo "<br/><b>5 </b><a accesskey=\"5\" href=\"admincp.php?action=club&amp;sid=$sid&amp;clid=$clid\">Admin Tools</a>";
    		}
            if($clinfo[1]==$uid)
          {
            //club owner
            $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='0'"));
            echo "<br/><b>6 </b><a accesskey=\"6\" href=\"lists.php?action=clreq&amp;sid=$sid&amp;clid=$clid\">&#187;Requests($mems[0])</a><br/>";
          }
        }else{
          echo "Topics: <b>$tps[0]</b>, Posts: <b>$pss[0]</b><br/>";
          echo "<b>Description:</b><br/>";
          echo htmlspecialchars($clinfo[2]);
          echo "<br/><br/>";
          echo "<b>Rules:</b><br/>";
          echo htmlspecialchars($clinfo[3]);
          echo "<br/><br/>";
          echo "Seems Good? <b>1 </b><a accesskey=\"1\" href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$clid\">Join Now!</a>";
        }
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=clubs&amp;sid=$sid\">Clubs list</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    else if($action=="addcl")
    {
        addonline(getuid_sid($sid),"Adding A Club","");
        echo "<head>";
        echo "<title>Adding A Club</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<b>Add Club</b>";
        echo "</p>";
        echo "<p>";
        if(getplusses($uid)>=500)
        {
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
          if($noi[0]<3)
          {
            echo "<small><img src=\"../images/point.gif\" alt=\"*\"/>All Info are required except the logo<br/>";
            echo "<img src=\"../images/point.gif\" alt=\"*\"/>Beside you, mods can moderate your club forums and chat<br/>";
            echo "<img src=\"../images/point.gif\" alt=\"*\"/>Any leading spaces for description, name, logo, or rules will be removed<br/>";
            echo "<img src=\"../images/point.gif\" alt=\"*\"/>Admins will delete your club and subtract your plusses if you abuse the rules of owning a club<br/>";
            echo "<img src=\"../images/point.gif\" alt=\"*\"/>Admins have the right to delete your club if it wasnt active or if it was useless<br/></small><br/>";
            echo "<form action=\"genproc.php?action=addcl&amp;sid=$sid\" method=\"post\">";
            echo "Club Name:<input name=\"clnm\" maxlength=\"30\"/><br/>";
            echo "Description:<input name=\"clds\" maxlength=\"200\"/><br/>";
            echo "Rules:<input name=\"clrl\" maxlength=\"500\"/><br/>";
            echo "Logo:<input name=\"cllg\" maxlength=\"200\"/><br/>";
            echo "<input type=\"submit\" value=\"Create\"/>";        
           echo "</form>";
          }else{
            echo "You already have 3 clubs";
          }
          }else{
    
          echo "You cant add any clubs :op ";
          }
        echo "</p>";
    
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    ///////////////////////////////////Search
    
    else if($action=="search")
    {
        addonline(getuid_sid($sid),"Searching For Something","");
        echo "<head>";
        echo "<title>Search Menu</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<img src=\"../images/search.gif\" alt=\"*\"/><br/>";
        echo "<b>Search Menu</b>";
        echo "</p>";
        echo "<p>";
        echo "<b>1 </b><a accesskey=\"1\" href=\"search.php?action=tpc&amp;sid=$sid\">&#0187;In Topics</a><br/>";
        echo "<b>2 </b><a accesskey=\"2\" href=\"search.php?action=blg&amp;sid=$sid\">&#0187;In Blogs</a><br/>";
        echo "<b>3 </b><a accesskey=\"3\" href=\"search.php?action=nbx&amp;sid=$sid\">&#0187;In My Inbox</a><br/>";
        echo "<b>4 </b><a accesskey=\"4\" href=\"search.php?action=clb&amp;sid=$sid\">&#0187;In Clubs</a><br/><br/>";
    	echo "Find Members:<br/>";
        echo "<b>5 </b><a accesskey=\"5\" href=\"search.php?action=mbrn&amp;sid=$sid\">&#0187;In Nicknames</a><br/>";
    	//echo "<b>6 </b><a accesskey=\"6\" href=\"search.php?action=mbrl&amp;sid=$sid\">&#0187;In Location</a><br/>";
    	//echo "<b>7 </b><a accesskey=\"7\" href=\"search.php?action=mbrs&amp;sid=$sid\">&#0187;By sex orientation</a><br/>";
    	echo "More search options for members are to come<br/>";
        echo "<br/><small>or you can just type the Username of the member and view its profile</small><br/>";
        echo "<br/>Username:<br/>";
    echo "<form action=\"index.php?action=viewuser&amp;sid=$sid\" method=\"post\">";
        echo "<br/><input name=\"mnick\" maxlength=\"15\"/><br/>";
    echo "<input type=\"submit\" value=\"View\"/>";
        echo "</form>";
    
      echo "</p>";
    
        echo "<p align=\"center\">";
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    ///////////////////////////////////Settings
    
    else if($action=="uset")
    {
      addonline(getuid_sid($sid),"User Settings","");
      echo "<head>";
      echo "<title>User Settings</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      $uid = getuid_sid($sid);
      $avat = getavatar($uid);
      $email = mysql_fetch_array(mysql_query("SELECT email FROM ibwf_users WHERE id='".$uid."'"));
      $bdy = mysql_fetch_array(mysql_query("SELECT birthday FROM ibwf_users WHERE id='".$uid."'"));
      $uloc = mysql_fetch_array(mysql_query("SELECT location FROM ibwf_users WHERE id='".$uid."'"));
      $usig = mysql_fetch_array(mysql_query("SELECT signature FROM ibwf_users WHERE id='".$uid."'"));
      $sx = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
      $uloc[0] = htmlspecialchars($uloc[0]);
      echo "<p align=\"center\">";
      echo "<b>Settings</b>";
      echo "</p>";
      echo "<p>";
      echo "<form action=\"genproc.php?action=uprof&amp;sid=$sid\" method=\"post\">";
      echo "Profile Pic: <input name=\"savat\" maxlength=\"100\" value=\"$avat\"/><br/>";
      echo "E-Mail: <input name=\"semail\" maxlength=\"100\" value=\"$email[0]\"/><br/>";
      echo "Birthday(YYYY-MM-DD): <input name=\"ubday\" maxlength=\"50\" value=\"$bdy[0]\"/><br/>";
      echo "Location: <input name=\"uloc\" maxlength=\"50\" value=\"$uloc[0]\"/><br/>";
      echo "Info: <input name=\"usig\" maxlength=\"100\" value=\"$usig[0]\"/><br/>";
      echo "Sex: <select name=\"usex\" value=\"$sx[0]\">";
      echo "<option value=\"M\">Male</option>";
      echo "<option value=\"F\">Female</option>";
      echo "</select><br/>";
      echo "<input type=\"submit\" value=\"Update\"/>";
      echo "</form>";
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    ///////////////////////////////////Settings
    
    else if($action=="chngpass")
    {
      addonline(getuid_sid($sid),"User Settings","");
      echo "<head>";
      echo "<title>User Settings</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<b>Change Password</b>";
      echo "</p>";
      echo "<p>";
      echo "<form action=\"genproc.php?action=upwd&amp;sid=$sid\" method=\"post\">";
      echo "Old Password: <input type=\"password\" name=\"opwd\" style=\"-wap-input-format: '*x'\" maxlength=\"15\"/><br/>";
      echo "Password: <input type=\"password\" name=\"npwd\" style=\"-wap-input-format: '*x'\" maxlength=\"15\"/><br/>";
      echo "Password again: <input type=\"password\" name=\"cpwd\" style=\"-wap-input-format: '*x'\" maxlength=\"15\"/><br/>";
      echo "<input type=\"submit\" value=\"Change\"/>";
      echo "</form><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
    }
    
    ///////////////////////////////////Poll Topic
    else if($action=="poll")
    {
        addonline(getuid_sid($sid),"Administrating Poll","");
        echo "<head>";
        echo "<title>Your Poll</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        $uid = getuid_sid($sid);
        if(getplusses($uid)<50)
        {
          echo "Minimum plusses required to administrate your poll is 50 plusses";
        }else{
            $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
            if($pid[0] == 0)
            {
              echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=crpoll&amp;sid=$sid\">Create Poll</a>";
            }else{
              echo "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=viewpl&amp;sid=$sid&amp;who=$uid\">View Your Poll</a><br/>";
                echo "<b>3 </b><a accesskey=\"3\" href=\"genproc.php?action=dlpoll&amp;sid=$sid\">Delete Your Poll</a><br/>";
            }
        }
        echo "</p>";
        
        echo "<p align=\"center\">";
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
        
    }else if($action=="crpoll")
    {
        addonline(getuid_sid($sid),"Creating A New Poll","");
        echo "<head>";
        echo "<title>Create Poll</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        if(getplusses(getuid_sid($sid))>=50)
        {
        $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
            if($pid[0] == 0)
            {
    echo "<form action=\"genproc.php?action=crpoll&amp;sid=$sid\" method=\"post\">";
    
              echo "Question:<input name=\"pques\" maxlength=\"250\"/><br/>";
              echo "Option 1:<input name=\"opt1\" maxlength=\"100\"/><br/>";
              echo "Option 2:<input name=\"opt2\" maxlength=\"100\"/><br/>";
              echo "Option 3:<input name=\"opt3\" maxlength=\"100\"/><br/>";
              echo "Option 4:<input name=\"opt4\" maxlength=\"100\"/><br/>";
              echo "Option 5:<input name=\"opt5\" maxlength=\"100\"/><br/>";
    echo "<input type=\"submit\" value=\"Create\"/>";          
    echo "</form>";
              }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You already have a poll, delete your current one before adding a new one";
              }
              }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You should have at least 50 plusses to create a poll";
              }
        echo "</p>";
    
        echo "<p align=\"center\">";
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    else if($action=="pws")
    {
        addonline(getuid_sid($sid),"My Personal Wap Site","");
        echo "<head>";
        echo "<title>My Personal Wap Site</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        echo "&#187;Welcome Image<br/>";
    	echo "<small>The image on main page<br/>";
    	echo "In Image field: type smilie code for smilie like -hi-, the image URL for external image, leave blank for other options</small><br/>";
    	echo "<form action=\"genproc.php?action=pws&amp;sid=$sid\" method=\"post\">";
    	echo "<select name=\"imgt\">";
    	echo "<option value=\"idc\">My ID Card</option>";
    	echo "<option value=\"avt\">My Current Avatar</option>";
    	echo "<option value=\"sml\">Smilie</option>";
    	echo "<option value=\"ilk\">Image URL</option>";
    	echo "</select><br/>";
    	echo "Image:<input name=\"imgo\" maxlength=\"200\"/><br/><br/>";
    	echo "&#187;Welcome Message<br/>";
    	echo "<small>The message that appears on first page of your site, smilies are allowed</small><br/>";
    	echo "Message:<input name=\"smsg\" maxlength=\"250\"/><br/><br/>";
    	echo "&#187;Theme<br/>";
    	echo "<small>Themes available only on phones supporting XHTML</small><br/>";
    	echo "<select name=\"thms\">";
    	$themes = mysql_query("SELECT id, name FROM ibwf_themes");
    	while ($theme = mysql_fetch_array($themes))
    	{
    	echo "<option value=\"$theme[0]\">".htmlspecialchars($theme[1])."</option>";
    	}
    	echo "</select><br/>";
    	echo "<input type=\"Submit\" Name=\"Update\" Value=\"Update\"></form>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    	    echo "</p>";
        echo "</body>";
    }
    
    else if($action=="pltpc")
    {
      $tid = $_GET["tid"];
        addonline(getuid_sid($sid),"Creating A Poll","");
        echo "<head>";
        echo "<title>Creating A Poll</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        if((getplusses(getuid_sid($sid))>=500)||ismod($uid))
        {
        $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
            if($pid[0] == 0)
            {
    	    echo "<form action=\"genproc.php?action=pltpc&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
              echo "Question:<input name=\"pques\" maxlength=\"250\"/><br/>";
              echo "Option 1:<input name=\"opt1\" maxlength=\"100\"/><br/>";
              echo "Option 2:<input name=\"opt2\" maxlength=\"100\"/><br/>";
              echo "Option 3:<input name=\"opt3\" maxlength=\"100\"/><br/>";
              echo "Option 4:<input name=\"opt4\" maxlength=\"100\"/><br/>";
              echo "Option 5:<input name=\"opt5\" maxlength=\"100\"/><br/>";
              echo "<input type=\"Submit\" name=\"Create\" Value=\"Create\"></form>";
              }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>The topic already have a poll";
              }
              }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You should have at least 500 plusses to create a poll";
              }
        echo "</p>";
    
        echo "<p align=\"center\">";
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    else if($action=="stats")
    {
        addonline(getuid_sid($sid),"Site stats","index.php?action=stats");
        echo "<head>";
        echo "<title>Site Stats</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo popup($sid);
        echo "<p align=\"center\">";
        $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
        echo "Registered Members: <b>$norm[0]</b> ";
        $memid = mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
        echo "The Newsest Member is: <b><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a></b><br/>";
        $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
        echo "Most Users Online: <b>$mols[1]</b> Members on $mols[0]<br/>";
        $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
        echo "Most Users Online(<a href=\"lists.php?action=moto&amp;sid=$sid\"> For today only</a>): <b>$mols[0]</b> Members at $mols[1]<br/>";
        $tm24 = time() - (24*60*60);
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
        echo mysql_error();
        echo "Active users today <b>$aut[0]</b><br/>";
        $notc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
        $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
        echo "Number of Topics: <b>$notc[0]</b> - Number of Posts: <b>$nops[0]</b><br/>";
        $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private"));
        echo "Number of Inboxes: <b>$nopm[0]</b><br/>";
        $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups"));
        echo "Number of Popups: <b>$nopm[0]</b><br/>";
        $nopm = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='Counter'"));
        echo "Counter: <b>$nopm[0]</b>";
         echo "</p>";
        echo "<p>";
        //echo "<a href=\"index.php?action=l24&amp;sid=$sid\">&#187;Whats Happened Here In Last 24 Hours</a><br/>";
        $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
        echo "<a href=\"lists.php?action=members&amp;sid=$sid\">&#187;Members($norm[0])</a><br/>";
        $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='M'"));
    
        echo "<a href=\"lists.php?action=males&amp;sid=$sid\">-&#187;Males($norm[0])</a><br/>";
        $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='F'"));
        echo "<a href=\"lists.php?action=fems&amp;sid=$sid\">-&#187;Females($norm[0])</a><br/>";
    
        $tbday=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
        echo "<a href=\"lists.php?action=bdy&amp;sid=$sid\">&#187;Today's Birthday($tbday[0])</a><br/>";
        
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs"));
        echo "<a href=\"lists.php?action=allbl&amp;sid=$sid\">&#187;Blogs($noi[0])</a><br/>";
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE pollid>'0'"));
        echo "<a href=\"lists.php?action=polls&amp;sid=$sid\">&#187;Polls($noi[0])</a><br/>";
        echo "<a href=\"lists.php?action=topp&amp;sid=$sid\">&#187;Top Posters</a><br/>";
        echo "<a href=\"lists.php?action=tchat&amp;sid=$sid\">&#187;Top Chatters</a><br/>";
        echo "<a href=\"lists.php?action=tgame&amp;sid=$sid\">&#187;Top Gamers</a><br/>";
        echo "<a href=\"lists.php?action=topb&amp;sid=$sid\">&#187;Top Battlers</a><br/>";
        echo "<a href=\"lists.php?action=tshout&amp;sid=$sid\">&#187;Top Shouters</a><br/>";
        $nobr=mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT browserm) FROM ibwf_users WHERE browserm IS NOT NULL "));
        echo "<a href=\"lists.php?action=brows&amp;sid=$sid\">&#187;Browsers($nobr[0])</a><br/>";
        $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_judges"));
        echo "<a href=\"lists.php?action=judg&amp;sid=$sid\">&#187;Battles Judges($noi[0])</a>";
    
       
        echo "</p>";
        echo "<p align=\"center\">";
          echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    else if($action=="l24")
    {
        addonline(getuid_sid($sid),"Site stats","");
        echo "<head>";
        echo "<title>Site Stats</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        /////
        echo "Things that have happened in $sitename during last 24 hours<br/><br/>";
        $tm24 = time() - (24*60*60);
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
        echo "Active Members: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE regdate>'".$tm24."'"));
        echo "Registered Members: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bgdate>'".$tm24."'"));
        echo "Blogs Created: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE joined>'".$tm24."' AND accepted='1'"));
        echo "Members Joined Clubs: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE created>'".$tm24."'"));
        echo "Clubs Created: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE reqdt>'".$tm24."' AND agreed='1'"));
        echo "Buddies Added: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE dtime>'".$tm24."'"));
        echo "Guestbooks Signed: <b>$aut[0]</b><br/>";
        if(ismod(getuid_sid($sid))){
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog WHERE actdt>'".$tm24."'"));
        echo "ModLog Actions: <b>$aut[0]</b><br/>";
      }
      $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_polls WHERE pdt>'".$tm24."'"));
        echo "Polls Added: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE dtpost>'".$tm24."'"));
        echo "Posts: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE timesent>'".$tm24."'"));
        echo "PMs Sent: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shtime>'".$tm24."'"));
        echo "Shouts: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE crdate>'".$tm24."'"));
        echo "Topics Created: <b>$aut[0]</b><br/>";
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE pudt>'".$tm24."'"));
        echo "Vault Items Added: <b>$aut[0]</b><br/>;";
        echo "</p>";
        echo "<p align=\"center\">";
    
    echo "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=stats&amp;sid=$sid\">Statistics</a><br/>";
      echo "<br/><b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////View category
    
    else if($action=="viewcat")
    {
    
      $cid = $_GET["cid"];
      addonline(getuid_sid($sid),"Viewing Forum Category","index.php?action=viewcat&amp;cid=$cid");
      $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));
      echo "<head>";
      echo "<title>$cinfo[0]</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      //echo "<div><img src=\"logos/forums.gif\" alt=\"Forums\"/></div>";
      echo popup($sid);
      $umsg = getunreadpm(getuid_sid($sid));
      if($umsg>0)
      {
      echo "<p align=\"center\">";
      echo "<br/><b>6 </b><a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a>";
      echo "</p>";
      }
      $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name");
      //echo "<b>$cinfo[0]</b></p><br/>";
      echo "<p>";
      while($forum = mysql_fetch_array($forums))
      {
      $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
      $iml = "<img src=\"../images/1.gif\" alt=\"*\"/>";
      echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$iml$forum[1]($notp[0]/$nops[0])</a><br/>";
      $lpt = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics WHERE fid='".$forum[0]."' ORDER BY lastpost DESC LIMIT 0,1"));
      $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$lpt[0]."'"));
      if($nops[0]==0)
      {
      $pinfo = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$lpt[0]."'"));
      $tluid = $pinfo[0];
      }else{
      $pinfo = mysql_fetch_array(mysql_query("SELECT  uid  FROM ibwf_posts WHERE tid='".$lpt[0]."' ORDER BY dtpost DESC LIMIT 0, 1"));
      $tluid = $pinfo[0];
      }
      $tlnm = htmlspecialchars($lpt[1]);
      $tlnick = getnick_uid($tluid);
      $tpclnk = "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$lpt[0]&amp;go=last\">$tlnm</a>";
      $vulnk = "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$tluid\">$tlnick</a>";
      if($pinfo[0]>0)
      {
      echo "Last Post: $tpclnk<br/>By: $vulnk<br/>";
      }
      }
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      echo forumlink($sid,9);
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    //////////////////////////////////View Topic
    
    else if($action=="viewtpc")
    {
      $tid = $_GET["tid"];
      $go = $_GET["go"];
      addonline(getuid_sid($sid),"Viewing Forum Topic","index.php?action=viewtpc&amp;tid=$tid");
      $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
      if(!canaccess(getuid_sid($sid), $tfid[0]))
        {
        echo "<head>";
        echo "<title>View Topic</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        
        $tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
        $tnm = htmlspecialchars($tinfo[0]);
        echo "<head>";
        echo "<title>View Topic</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo popup($sid);
        echo "<p align=\"center\">";
        $umsg = getunreadpm(getuid_sid($sid));
        if($umsg>0)
        {
        echo "<br/><b>6 </b><a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a><br/>";
        }
        $num_pages = getnumpages($tid);
        if($page==""||$page<1)$page=1;
        if($go!="")$page=getpage_go($go,$tid);
        $posts_per_page = 5;
        if($page>$num_pages)$page=$num_pages;
        $limit_start = $posts_per_page *($page-1);
        echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid\">Post reply</a>";
        $lastlink = "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=$action&amp;tid=$tid&amp;sid=$sid&amp;go=last\">Last Page</a>";
        $firstlink = "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=$action&amp;tid=$tid&amp;sid=$sid&amp;page=1\">First Page</a> ";
        $golink = "";
        if($page>1)
        {
          $golink = $firstlink;
        }
        if($page<$num_pages)
        {
          $golink .= $lastlink;
        }
        if($golink !="")
        {
          echo "<br/>$golink";
        }
        echo "</p>";
        echo "<p align=\"center\">";
        $vws = $tinfo[4]+1;
        $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
        echo "Replies: $rpls[0] - Views: $vws<br/>";
        ///fm here
        
        if($page==1)
        {
          $posts_per_page=4;
          mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE  id='".$tid."'");
          $ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
          $unick = getnick_uid($ttext[0]);
          if(isonline($ttext[0]))
        {
          $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>";
        }else{
            $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
        }
        $usl = "<br/><a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$ttext[0]\">$iml$unick</a>";
        $topt = "<a href=\"index.php?action=tpcopt&amp;sid=$sid&amp;tid=$tid\">*</a>";
        if($go==$tid)
        {
          $fli = "<img src=\"../images/flag.gif\" alt=\"!\"/>";
        }else{
          $fli ="";
        }
        $pst = parsemsg($ttext[1],$sid);
        echo "$usl: $fli$pst $topt<br/>";
        $dtot = date("d-m-y - H:i:s",$ttext[2]);
        echo $dtot;
        echo "<br/>";
        if($ttext[3]>0)
        {
          echo "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=viewtpl&amp;sid=$sid&amp;who=$tid\">POLL</a><br/>";
        }
      }
      if($page>1)
      {
        $limit_start--;
      }
      $sql = "SELECT id, text, uid, dtpost, quote FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start, $posts_per_page";
      $posts = mysql_query($sql);
      while($post = mysql_fetch_array($posts))
      {
        $unick = getnick_uid($post[2]);
        if(isonline($post[2]))
        {
          $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>";
        }else{
            $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
        }
        $usl = "<br/><a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$post[2]\">$iml$unick</a>";
        $pst = parsemsg($post[1], $sid);
        $topt = "<a href=\"index.php?action=pstopt&amp;sid=$sid&amp;pid=$post[0]&amp;page=$page&amp;fid=$tinfo[5]\">*</a>";
        if($post[4]>0)
        {
            $qtl = "<small><i><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;pst=\">(quote:p=blaze,d=16-04-2006)</a></i></small>";
        }
        if($go==$post[0])
        {
          $fli = "<img src=\"../images/flag.gif\" alt=\"!\"/>";
        }else{
          $fli ="";
        }
        echo "$usl: $fli$pst $topt<br/>";
        $dtot = date("d-m-y - H:i:s",$post[3]);
        echo $dtot;
        echo "<br/>";
      }
        ///to here
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=viewtpc&amp;page=$ppage&amp;sid=$sid&amp;tid=$tid\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=viewtpc&amp;page=$npage&amp;sid=$sid&amp;tid=$tid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
          $rets = "<form action=\"index.php\" method=\"get\">";
    	$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
    	$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
    	$rets .= "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
    	$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
    	$rets .= "<input type=\"Submit\" value=\"Go To Page\" Name=\"Submit\"/></form>";
    
            echo $rets;
        }
      echo "<br/>";
      echo "<b>1 </b><a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid\">Post reply</a>";
      echo "</p>";
      echo "<p align=\"center\">";
      $fid = $tinfo[5];
      $fname = getfname($fid);
      $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
      $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
      $cname = $cinfo[0];
      $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
      $fname = htmlspecialchars($fname);
      echo "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">Back To $fname</a><br/>";
      if($cid[0]>0)
      {
      echo "<b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
      $cname = htmlspecialchars($cinfo[0]);
      echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$cid[0]\">$cname</a><br/>";
      echo forumlink($sid,9);
      }else{
      echo "<b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
      $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
      $cname = htmlspecialchars($cinfo[0]);
      echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gocl&amp;sid=$sid&amp;clid=$cid[0]\">$cname Club</a><br/>";
      echo forumlink($sid,9);
      }
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    //////////////////////////////////View Forum
    
    else if($action=="viewfrm")
    {
      
        $fid = $_GET["fid"];
    	$view = $_GET["view"];
        if(!canaccess(getuid_sid($sid), $fid))
        {
          addonline(getuid_sid($sid),"im viewing admin forum naughty me","");
        echo "<head>";
        echo "<title>View Forum</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        addonline(getuid_sid($sid),"Viewing Forum","index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid");
        $finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));
        $fnm = htmlspecialchars($finfo[0]);
        echo "<head>";
        echo "<title>View Forum</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $umsg = getunreadpm(getuid_sid($sid));
        if($umsg>0)
        {
        echo "<br/><b>6 </b><a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a><br/>";
        }
        $norf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'"));
        if($norf[0]>0)
        {
            echo "<a href=\"rwrss.php?action=showfrss&amp;sid=$sid&amp;fid=$fid\"><img src=\"../images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>";
        }
        echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=newtopic&amp;sid=$sid&amp;fid=$fid\">New Topic</a><br/>";
        echo "<form action=\"index.php\" method=\"get\">";
        echo "View: <select name=\"view\">";
        echo "<option value=\"all\">All</option>";
        echo "<option value=\"new\">Since Last Visit</option>";
        echo "<option value=\"myps\">I posted In</option>";
        echo "</select>";
        echo "<input type=\"submit\" value=\"Go\"/>";
        echo "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        echo "<input type=\"hidden\" name=\"sid\"  value=\"$sid\"/>";
        echo "</form>";
        echo "<br/>";
    	if($view=="new")
    	{
    		echo "<small>Viewing topics that has no new posts since your last visit</small>";
    	}else if($view=="myps")
    	{
    		echo "<small>Viewing topics contain posts by you</small>";
    	}else {
    	echo "<small>Viewing All topics</small>";
    	}
        echo "</p>";
        echo "<p>";
        if($page=="" || $page<=0)$page=1;
        if($page==1)
        {
          ///////////pinned topics
          $topics = mysql_query("SELECT id, name, closed, views, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='1' ORDER BY lastpost DESC, name, id LIMIT 0,5");
          while($topic = mysql_fetch_array($topics))
        {
          $iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
          $iml = "*";
          $atxt ="";
          if($topic[2]=='1')
          {
            //closed
            $atxt = "(X)";
          }
          if($topic[4]>0)
          {
            $pltx = "(P)";
          }else{
            $pltx = "";
          }
          $tnm = htmlspecialchars($topic[1]);
          $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
          echo "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$topic[0]\">$iml$pltx$tnm($nop[0])$atxt</a><br/>";
    
        }
        echo "<br/>";
      }
      $uid = getuid_sid($sid);
      if($view=="new")
      {
      
      $ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."'"));
      }
      else if($view=="myps")
      {
    	$noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.id) FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."'"));
      }
      else{
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0'"));
      }
        $num_items = $noi[0]; //changable
        $items_per_page= 10;
        $num_pages = ceil($num_items/$items_per_page);
        if($page>$num_pages)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
        if($limit_start<0)$limit_start=0;
    	if($view=="new")
    	{
    	$ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
        $topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
    	}
    	else if($view=="myps"){
    	$topics = mysql_query("SELECT a.id, a.name, a.closed, a.views, a.moved, a.pollid FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."' GROUP BY a.id ORDER BY a.lastpost DESC, a.name, a.id  LIMIT $limit_start, $items_per_page");
    	}
    	else{
    	$topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
    	}
        
        while($topic = mysql_fetch_array($topics))
        {
          
          $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
          $iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
          if($nop[0]>24)
          {
            $iml = "<img src=\"../images/hot.gif\" alt=\"*\"/>";
          }
          if($topic[4]=='1')
          {
            $iml = "<img src=\"../images/moved.gif\" alt=\"*\"/>";
          }
          if($topic[2]=='1')
          {
            $iml = "<img src=\"../images/closed.gif\" alt=\"*\"/>";
          }
          if($topic[5]>0)
          {
            $iml = "<img src=\"../images/poll.gif\" alt=\"*\"/>";
          }
          $atxt ="";
          if($topic[2]=='1')
          {
            //closed
            $atxt = "(X)";
          }
          $tnm = htmlspecialchars($topic[1]);
          echo "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$topic[0]\">$iml$tnm($nop[0])$atxt</a><br/>";
    
        }
    
    
        echo "</p>";
        echo "<p align=\"center\">";
    
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=viewfrm&amp;page=$ppage&amp;sid=$sid&amp;fid=$fid&amp;view=$view\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=viewfrm&amp;page=$npage&amp;sid=$sid&amp;fid=$fid&amp;view=$view\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
            $rets = "<form action=\"index.php\" method=\"get\">";
            $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
            $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
            $rets .= "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
    	  $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
            $rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
            $rets .= "</form>";
    
            echo $rets;
        }
    
        echo "<br/><br/><b>1 </b><a href=\"index.php?action=newtopic&amp;sid=$sid&amp;fid=$fid\">New Topic</a><br/>";
        $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
        if($cid[0]>0)
        {
      echo "<br/><br/><b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
        $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
        $cname = htmlspecialchars($cinfo[0]);
        echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$cid[0]\">$cname</a><br/>";
        echo forumlink($sid,9);
        }else{
      echo "<br/><br/><b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
            $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
            $cname = htmlspecialchars($cinfo[0]);
        echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gocl&amp;sid=$sid&amp;clid=$cid[0]\">$cname Club</a><br/>";
        echo forumlink($sid,9);
        }
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    //////////////////////////////////ONLINE USERS
    else if($action=="newtopic")
    {
      $fid = $_GET["fid"];
      if(!canaccess(getuid_sid($sid), $fid))
        {
        echo "<head>";
        echo "<title>New Topic</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        addonline(getuid_sid($sid),"Creating new topic","index.php?action=online");
        echo "<head>";
        echo "<title>New Topic</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<form action=\"genproc.php?action=newtopic&amp;sid=$sid\" method=\"post\">";
        echo "Title:<input name=\"ntitle\" maxlength=\"250\"/><br/>";
        echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/><br/>";
        echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        echo "<input type=\"submit\" value=\"Create\"/>";
        echo "</form>";
        $fname = getfname($fid);
        echo "<br/><br/><b>9 </b><a accesskey=\"9\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">$fname</a><br/>";
        echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////Post reply
    
    else if($action=="post")
    {
        $tid = $_GET["tid"];
        
        $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
        $fid = $tfid[0];
    if(!canaccess(getuid_sid($sid), $fid))
        {
        echo "<head>";
        echo "<title>Post Reply</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        addonline(getuid_sid($sid),"Posting reply","");
        
        echo "<head>";
        echo "<title>Post Reply</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        $qut = $_GET["qut"];
        echo "<p align=\"center\">";
        echo "<form action=\"genproc.php?action=post&amp;sid=$sid\" method=\"post\">";
        echo "Text:<input name=\"reptxt\" maxlength=\"500\"/><br/>";
        echo "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
        echo "<input type=\"hidden\" name=\"qut\" value=\"$qut\"/>";
        echo "<input type=\"submit\" value=\"Reply\"/>";
        echo "</form>";
        $fid = getfid($tid);
        $fname = getfname($fid);
        echo "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid\">Back to topic</a>";
        echo "<br/><b>9 </b><a accesskey=\"9\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">$fname</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////shout
    
    else if($action=="shout")
    {
        addonline(getuid_sid($sid),"Close Your Ears Im Shouting","");
    
        echo "<head>";
        echo "<title>Shout</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        if(getplusses(getuid_sid($sid))<75)
        {
            echo "You need at least 75 plusses to shout!";
        }else{
    	 
    	echo "<small>please take note: $nick all your plusses will be removed if you spam or flood the shoutbox</small><br/>";
        echo "<small>also smilies and BBcode do not work in shoutbox</small><br/><br/>";
    	echo "<form action=\"genproc.php?action=shout&amp;sid=$sid\" method=\"post\">";
    	echo "Text:<input name=\"shtxt\" maxlength=\"100\">";
        echo "<input type=\"Submit\" value=\"Shout\" name=\"Shout\"></form>";
                }
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////shout
    
    else if($action=="annc")
    {
        addonline(getuid_sid($sid),"Adding An Announcement","");
        $clid = $_GET["clid"];
        echo "<head>";
        echo "<title>Announce</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $cow = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
        $uid = getuid_sid($sid);
        if($cow[0]!=$uid)
        {
            echo "This club is not yours!";
        }else{
        echo "<form action=\"genproc.php?action=annc&amp;sid=$sid&amp;clid=$clid\" method=\"post\">";
        echo "Text:<input name=\"antx\" maxlength=\"200\"><br/>";
        echo "<input type=\"Submit\" name=\"Announce\" Value=\"Announce\"></form>";
                }
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////Guestbook
    
    else if($action=="addblg")
    {
    
        
    if(!getplusses(getuid_sid($sid))>50)
        {
        echo "<head>";
        echo "<title>Add Blog</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo "you should have 50 plusses to add a blog<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        addonline(getuid_sid($sid),"Adding a blog","");
    
        echo "<head>";
        echo "<title>Add Blog</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
    
        echo "<p align=\"center\">";
             echo "<form action=\"genproc.php?action=addblg&amp;sid=$sid\" method=\"post\">";
        echo "Title:<input name=\"btitle\" maxlength=\"30\"/><br/>";
        echo "Text:<input name=\"msgtxt\" maxlength=\"500\"/><br/>";
    echo "<input type=\"submit\" value=\"Add Blog\"/>";    
    echo "</form>";
       
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////add vault
    
    else if($action=="addvlt")
    {
    
    
    if(!getplusses(getuid_sid($sid))>25)
        {
        echo "<head>";
        echo "<title>Add To Vault</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo " you should have 25 plusses to add an item to your vault<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        addonline(getuid_sid($sid),"Adding a vault item","");
    
        echo "<head>";
        echo "<title>Add To Vault</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<small>The vault is used to store your downloadable links,like images, mp3's, games  etc...<br/>WARNING: if you used it to wapsites links they will got deleted and you'll lose some plusses, if you used it for ranking sites links like 2wap, mradar, you'll be banned</small><br/><br/>";
    echo "<form action=\"genproc.php?action=addvlt&amp;sid=$sid\" method=\"post\">";
        echo "The vault is used to store your downloadable links,like images, mp3's, games  etc...<br/>WARNING: if you used it to wapsites links they will got deleted and you'll lose some plusses, if you used it for ranking sites links like 2wap, mradar, you'll be banned<br/><br/>";
        echo "Item Name:<input name=\"viname\" maxlength=\"50\"/><br/>";
        echo "Item Url:<input name=\"vilink\" maxlength=\"255\"/><br/>";
    echo "<input type=\"submit\" value=\"Add Item\"/>";    
    echo "</form>";
    
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    //////////////////////////////////////////Guestbook
    
    else if($action=="signgb")
    {
    $who=$_GET["who"];
    addonline(getuid_sid($sid),"Signing Users guestbook","");
    if(!cansigngb(getuid_sid($sid), $who))
        {
        echo "<head>";
        echo "<title>Sign Guestbook</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
          echo "<p align=\"center\">";
          echo "You cant Sign this user guestbook<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        
    
        echo "<head>";
        echo "<title>Sign Guestbook</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        echo "<form action=\"genproc.php?action=signgb&amp;sid=$sid\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"who\" Value=\"$who\">";
        echo "Text:<input name=\"msgtxt\" maxlength=\"500\"/><br/>";
        echo "<input type=\"Submit\" name=\"Add\" Value=\"Add\"></form>";
    
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    
    else if($action=="online")
    {
    
      addonline(getuid_sid($sid),"Online List","index.php?action=online");
        echo "<head>";
        echo "<title>Online List</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        //echo "<div><img src=\"../images/onlinelist.gif\" alt=\"Online List\"/></div>";
      echo popup($sid);
      //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $num_items = getnumonline(); //changable
        $items_per_page= 10;
        $num_pages = ceil($num_items/$items_per_page);
        if($page>$num_pages)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
    
        //changable sql
        $sql = "SELECT
                a.name,a.perm, b.place, b.userid FROM ibwf_users a
                INNER JOIN ibwf_online b ON a.id = b.userid
                GROUP BY 1,2
                LIMIT $limit_start, $items_per_page
        ";
      echo "<p align=\"center\">";
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
        {
            if($item[1]=='0')
            {
              $tit = "";
            }if($item[1]=='1')
            {
              $tit = "*";
            }if($item[1]=='2')
            {
              $tit = "*";
            } if($item[1]=='3')
            {
              $tit = "*";
            } if($item[1]=='4')
            {
              $tit = "*";
            }
    
    $sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'"));
    if($sex[0]=="M"){$usersex = "<img src=\"../images/male.gif\" alt=\"(M)\"/>";}
    if($sex[0]=="F"){$usersex = "<img src=\"../images/female.gif\" alt=\"(F)\"/>";}
    if($sex[0]==""){$usersex = "";}
    if($item[1]>'0')
      {
      $lnk = "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]$tit</a>";
      }else{
      $lnk = "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]$tit</a>";
      }
      echo "$lnk - $item[2] <br/>";
        }
        //echo "</p>";
        //echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">&#171;Prev</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages";
        if($num_pages>2)
        {
        echo getjumper($action, $sid,"index");
        }
        echo "</p>";
      ////// UNTILL HERE >>
    
      echo "<p align=\"center\">";
      echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
      echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
      echo forumlink($sid,9);
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    else if($action=="viewpl")
    {
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Viewing A Users Poll","");
        echo "<head>";
        echo "<title>View Poll</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        $uid = getuid_sid($sid);
        $pollid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
        if($pollid[0]>0)
        {
            $polli = mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
            if(trim($polli[1])!="")
            {
                $qst = parsepm($polli[1], $sid);
                echo $qst."<br/><br/>";
                $vdone = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
                $nov = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
                $nov = $nov[0];
                if($vdone[0]>0)
                {
                  $voted= true;
                }else{
                  $voted = false;
                }
                $opt1 = $polli[2];
                if (trim($opt1)!="")
                {
                  $opt1 = htmlspecialchars($opt1);
                  $nov1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
                  $nov1 = $nov1[0];
                  if($nov>0)
                  {
                  $per = floor(($nov1/$nov)*100);
                  $rests = "Votes: $nov1($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                    if($voted)
                    {
                      $lnk = "1.$opt1 <small>$rests</small><br/>";
                    }else{
                  $lnk = "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt2 = $polli[3];
                if (trim($opt2)!="")
                {
                  $opt2 = htmlspecialchars($opt2);
                  $nov2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
                  $nov2 = $nov2[0];
                  if($nov>0)
                  {
                  $per = floor(($nov2/$nov)*100);
                  $rests = "Votes: $nov2($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "2.$opt2 <small>$rests</small><br/>";
                    }else{
                  $lnk = "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt3 = $polli[4];
                if (trim($opt3)!="")
                {
                  $opt3 = htmlspecialchars($opt3);
                  $nov3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
                  $nov3 = $nov3[0];
                  if($nov>0)
                  {
                  $per = floor(($nov3/$nov)*100);
                  $rests = "Votes: $nov3($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "3.$opt3 <small>$rests</small><br/>";
                    }else{
                  $lnk = "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt4 = $polli[5];
                if (trim($opt4)!="")
                {
                  $opt4 = htmlspecialchars($opt4);
                  $nov4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
                  $nov4 = $nov4[0];
                  if($nov>0)
                  {
                  $per = floor(($nov4/$nov)*100);
                  $rests = "Votes: $nov4($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "4.$opt4 <small>$rests</small><br/>";
                    }else{
                  $lnk = "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt5 = $polli[6];
                if (trim($opt5)!="")
                {
                  $opt5 = htmlspecialchars($opt5);
                  $nov5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
                  $nov5 = $nov5[0];
                  if($nov>0)
                  {
                  $per = floor(($nov5/$nov)*100);
                  $rests = "Votes: $nov5($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "5.$opt5 <small>$rests</small><br/>";
                    }else{
                  $lnk = "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                echo "<small>".date("d m y - H:i",$polli[7])."</small>";
            }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
            }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This user have no poll";
        }
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
        
    }
    
    else if($action=="viewtpl")
    {
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Viewing a poll","");
        echo "<head>";
        echo "<title>View Poll</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        $uid = getuid_sid($sid);
        $pollid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$who."'"));
        if($pollid[0]>0)
        {
            $polli = mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
            if(trim($polli[1])!="")
            {
                $qst = parsepm($polli[1], $sid);
                echo $qst."<br/><br/>";
                $vdone = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
                $nov = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
                $nov = $nov[0];
                if($vdone[0]>0)
                {
                  $voted= true;
                }else{
                  $voted = false;
                }
                $opt1 = $polli[2];
                if (trim($opt1)!="")
                {
                  $opt1 = htmlspecialchars($opt1);
                  $nov1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
                  $nov1 = $nov1[0];
                  if($nov>0)
                  {
                  $per = floor(($nov1/$nov)*100);
                  $rests = "Votes: $nov1($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                    if($voted)
                    {
                      $lnk = "1.$opt1 <small>$rests</small><br/>";
                    }else{
                  $lnk = "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt2 = $polli[3];
                if (trim($opt2)!="")
                {
                  $opt2 = htmlspecialchars($opt2);
                  $nov2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
                  $nov2 = $nov2[0];
                  if($nov>0)
                  {
                  $per = floor(($nov2/$nov)*100);
                  $rests = "Votes: $nov2($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "2.$opt2 <small>$rests</small><br/>";
                    }else{
                  $lnk = "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt3 = $polli[4];
                if (trim($opt3)!="")
                {
                  $opt3 = htmlspecialchars($opt3);
                  $nov3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
                  $nov3 = $nov3[0];
                  if($nov>0)
                  {
                  $per = floor(($nov3/$nov)*100);
                  $rests = "Votes: $nov3($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "3.$opt3 <small>$rests</small><br/>";
                    }else{
                  $lnk = "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt4 = $polli[5];
                if (trim($opt4)!="")
                {
                  $opt4 = htmlspecialchars($opt4);
                  $nov4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
                  $nov4 = $nov4[0];
                  if($nov>0)
                  {
                  $per = floor(($nov4/$nov)*100);
                  $rests = "Votes: $nov4($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "4.$opt4 <small>$rests</small><br/>";
                    }else{
                  $lnk = "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                $opt5 = $polli[6];
                if (trim($opt5)!="")
                {
                  $opt5 = htmlspecialchars($opt5);
                  $nov5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
                  $nov5 = $nov5[0];
                  if($nov>0)
                  {
                  $per = floor(($nov5/$nov)*100);
                  $rests = "Votes: $nov5($per%)";
                  }else{
                    $rests = "Votes: 0(0%)";
                  }
                  if($voted)
                    {
                      $lnk = "5.$opt5 <small>$rests</small><br/>";
                    }else{
                  $lnk = "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
                  }
                  echo "$lnk";
                }
                echo "<small>".date("d m y - H:i",$polli[7])."</small>";
            }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
            }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This user have no poll";
        }
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    
    }
    else if($action=="stfol")
    {
    
      addonline(getuid_sid($sid),"Staff List","");
      echo "<head>";
      echo "<title>Staff List</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      $sql = "SELECT id, name, perm FROM ibwf_users WHERE perm='4' ORDER BY name";
      echo "<p>";
      echo "<b>Owner(s):</b><br/>";
      $query = mysql_query($sql);
      echo mysql_error();
      if(mysql_num_rows($query)>0)
      {
      while ($owners = mysql_fetch_array($query))
      {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$owners[0]&amp;sid=$sid\">$owners[1]</a>";
      echo "$lnk<br/>";
      }
      }else{
      echo "No Owner(s) Atm...<br/>";
      }
      $sql = "SELECT id, name, perm FROM ibwf_users WHERE perm='3' ORDER BY name";
      echo "<b>Head Admin(s):</b><br/>";
      $query = mysql_query($sql);
      echo mysql_error();
      if(mysql_num_rows($query)>0)
      {
      while ($headadmins = mysql_fetch_array($query))
      {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$headadmins[0]&amp;sid=$sid\">$headadmins[1]</a>";
      echo "$lnk<br/>";
      }
      }else{
      echo "No Head Admin(s) Atm...<br/>";
      }
      $sql = "SELECT id, name, perm FROM ibwf_users WHERE perm='2' ORDER BY name";
      echo "<b>Admin(s):</b><br/>";
      $query = mysql_query($sql);
      echo mysql_error();
      if(mysql_num_rows($query)>0)
      {
      while ($admins = mysql_fetch_array($query))
      {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$admins[0]&amp;sid=$sid\">$admins[1]</a>";
      echo "$lnk<br/>";
      }
      }else{
      echo "No Admins(s) Atm...<br/>";
      }
      $sql = "SELECT id, name, perm FROM ibwf_users WHERE perm='1' ORDER BY name";
      echo "<b>Mods (s):</b><br/>";
      $query = mysql_query($sql);
      echo mysql_error();
      if(mysql_num_rows($query)>0)
      {
      while ($mods = mysql_fetch_array($query))
      {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$mods[0]&amp;sid=$sid\">$mods[1]</a>";
      echo "$lnk<br/>";
      }
      }else{
      echo "No Mods(s) Atm...<br/>";
      }
    
      $timeout = 300;
      $timeon = time()-$timeout;
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'"));
      echo "<b>Staff Online:($noi[0])</b><br/>";
      $sql = "SELECT name, perm, id FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'";
      $items = mysql_query($sql);
      echo mysql_error();
      while ($item = mysql_fetch_array($items))
      {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
      if($item[1]==1)
      {$item[1] = "Mod";}
      else if($item[1]==2)
      {$item[1] = "Admin";}
      else if($item[1]==3)
      {$item[1] = "Head Admin";}
      else if($item[1]==4)
      {$item[1] = "Owner";}
      echo "$lnk - $item[1] <br/>";
      }
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    else if($action=="chbmsg")
    {
      addonline(getuid_sid($sid),"Buddy Message","");
        echo "<head>";
        echo "<title>Set Mood</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
    
             echo "<form action=\"genproc.php?action=upbmsg&amp;sid=$sid\" method=\"post\">";
    
        echo "Text:<input name=\"bmsg\" maxlength=\"100\" value=\"$cmsg\"/><br/>";
    echo "<input type=\"submit\" value=\"Save\"/>";
        echo "</form><br/>";
     echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">";
    echo "Buddies List</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    /////////////////////////////////viewuser profile
    
    else if($action=="viewuser")
    {
      addonline(getuid_sid($sid),"Viewing Users Profile","index.php?action=viewuser&amp;who=$who");
        echo "<head>";
        echo "<title>View Profile</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
       echo "<p align=\"center\">";
      $lastloc=$_GET["lstloc"];
    if($lastloc=="cht"){
    	$rid= $_GET["rid"];
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
    }
      if($who==""||$who==0)
      {
        $mnick = $_POST["mnick"];
        $who = getuid_nick($mnick);
      }
      $whonick = getnick_uid($who);
      if($whonick!="")
      {
    
    
    
    if(isowner(getuid_sid($sid)))
      {
      echo "<a href=\"ownercp.php?action=user&amp;sid=$sid&amp;who=$who\">*Owner Tools*</a><br/>";
      }
    if(isheadadmin(getuid_sid($sid)))
      {
      echo "<a href=\"headadmincp.php?action=user&amp;sid=$sid&amp;who=$who\">*Head Admin Tools*</a><br/>";
      }
      if(ismod($uid))
      {
      if(!isowner(getuid_sid($sid)))
      {
      if(!isheadadmin(getuid_sid($sid)))
      {
      echo "<a href=\"admincp.php?action=user&amp;sid=$sid&amp;who=$who\">*Admin Tools*</a><br/>";
      }
      }
      }
    
      $avlink = getavatar($who);
      if($avlink=="")
      {
      echo "";
      }else{
      echo "<img src=\"$avlink\" alt=\"$whonick\"/><br/>";
      }
      if(cansee(getuid_sid($sid), $who))
      {
        $unol = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$who."'"));
        /*if($unol[0]!="")
        {
        echo "Last Penalty Reason: $unol[0]<br/>";
        }
        $unol = mysql_fetch_array(mysql_query("SELECT lastplreas FROM ibwf_users WHERE id='".$who."'"));
        if($unol[0]!="")
        {
        echo "Last Plusses Reason: $unol[0]<br/>";
        }*/
      }
      echo "<b>Username:</b> $whonick<br/>";
      echo "<b>Status:</b> ".getstatus($who)."<br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE id='".$who."'"));
      echo "<b>UserId:</b> $who<br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT sex, birthday, location FROM ibwf_users WHERE id='".$who."'"));
      $uage = getage($nopl[1]);
      if($nopl[0]=='M')
      {
        $usex = "Male";
      }else if($nopl[0]=='F'){
        $usex = "Female";
      }else{
        $usex = "Argh! No Profile!";
      }
      $nopl[2] = htmlspecialchars($nopl[2]);
      echo "<b>Asl:</b> $uage/$usex/$nopl[2]<br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE id='".$who."'"));
      $jdt = date("H:i - D jS M y",$nopl[0]);
      echo "<b>Joined:</b> $jdt<br/>";
      $membrage = time() - $nopl[0];
      $membrage = gettimemsg($membrage);
      echo "<b>Member For:</b> $membrage<br/>";
      $nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
      echo "<b>Buddies:</b> $nob[0]<br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT email FROM ibwf_users WHERE id='".$who."'"));
      echo "<b>E-mail:</b> $nopl[0]<br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT signature FROM ibwf_users WHERE id='".$who."'"));
      $sign = parsepm($nopl[0], $sid);
      echo "<b>Info:</b> $sign<br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
      $var1 = date("His",$noi[0]);
      $var2 = time();
      $var21 = date("His",$var2);
      $var3 = $var21 - $var1;
      $var4 = date("s",$var3);
      echo "<b>Idle For:</b> ";
      $remain = time() - $noi[0];
      $idle = gettimemsg($remain);
      echo "$idle<br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT browserm FROM ibwf_users WHERE id='".$who."'"));
      echo "<b>Browser:</b> $nopl[0]<br/>";
      if(ismod(getuid_sid($sid)))
      {
      $uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM ibwf_users WHERE id='".$who."'"));
      echo "<b>Ip:</b> <a href=\"lists.php?action=byip&amp;sid=$sid&amp;who=$who\">$uipadd[0]</a><br/>";
      }
      if(budres($uid, $who)==0)
      {
        echo "<a href=\"genproc.php?action=bud&amp;who=$who&amp;sid=$sid&amp;todo=add\">Add Buddy</a><br/>";
      }else if(budres($uid, $who)==1)
      {
        echo "(Queued Buddy Request)<br/>";
      }else if(budres($uid, $who)==2)
      {
        echo "<a href=\"genproc.php?action=bud&amp;who=$who&amp;sid=$sid&amp;todo=del\">Del Buddy</a><br/>";
      }
      if (arebuds($uid, $who))
      {
      echo "<a href=\"inbox.php?action=sendpopup&amp;who=$who&amp;sid=$sid\">Send Popup</a><br/>";
      }
      echo "<a href=\"inbox.php?action=sendpm&amp;who=$who&amp;sid=$sid\">Send Inbox</a><br/>";
      $ires = ignoreres($uid, $who);
    if($ires==1)
      {
        echo "<a href=\"genproc.php?action=ign&amp;who=$who&amp;sid=$sid&amp;todo=add\">Ignore</a><br/>";
      }
      if(isignored($who, $uid))
      {
        echo "<a href=\"genproc.php?action=ign&amp;who=$who&amp;sid=$sid&amp;todo=del\">UnIgnore</a><br/>";
      }
      echo "<a href=\"index.php?action=prostats&amp;who=$who&amp;sid=$sid\">User Stats</a><br/>";
      echo "<a href=\"uinfo.php?who=$who&amp;sid=$sid\">Advanced Profile</a><br/>";
      echo "<a href=\"../users?$whonick\">Personal Wap Site</a><br/>";
       $noi = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
       if($noi[0]>0)
       {
       echo "<a href=\"index.php?action=viewpl&amp;who=$who&amp;sid=$sid\">Poll</a><br/>";
     }
    
       $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$who."'"));
       if($noi[0]>0)
       {
       echo "<a href=\"lists.php?action=blogs&amp;who=$who&amp;sid=$sid\">Blogs($noi[0])</a><br/>";
     }
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$who."'"));
       if($noi[0]>0)
       {
       echo "<a href=\"lists.php?action=vault&amp;who=$who&amp;sid=$sid\">Vault($noi[0])</a><br/>";
       }
       $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$who."'"));
       echo "<a href=\"lists.php?action=gbook&amp;who=$who&amp;sid=$sid\">Guestbook($noi[0])</a><br/>";
       $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
      echo "</p>";
      echo "<p align=\"center\">";
    
       }else{
         echo "<img src=\"../images/notok.gif\" alt=\"X\"/> Member dos not exist<br/>";
       }
         if($lastloc=="cht"){
    	  	
        echo "<b>5 </b><a accesskey=\"5\" href=\"chat.php?sid=$sid&amp;rid=$rid\">Back to $rname</a><br/>"; 
      echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
      }else{
      echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
      }
    }
    //////////////////////////////////////////profile stats
    else if($action=="prostats")
    {
        addonline(getuid_sid($sid),"Viewing User Stats","");
        echo "<head>";
        echo "<title>User Stats</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      if($who==""||$who==0)
      {
        $mnick = $_POST["mnick"];
        $who = getuid_nick($mnick);
      }
      echo "<p align=\"center\">";
      echo "<b>User Stats</b>";
      echo "</p>";
      echo "<p>";
      $uid = getuid_sid($sid);
      $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE authorid='".$who."'"));
      $tlink = "<a href=\"lists.php?action=tbuid&amp;sid=$sid&amp;who=$who\">$unol[0]</a>";
      echo "Topics: <b>$tlink</b><br/>";
      $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$who."'"));
      $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$who."'"));
      $plink = "<a href=\"lists.php?action=uposts&amp;sid=$sid&amp;who=$who\">$unol[0]</a>";
      echo "Posts: <b>$plink/$unop[0]</b><br/>";
      $noin = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$who."'"));
      $nout = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE byuid='".$who."'"));
      echo "PMs IN: <b>$noin[0]</b> - OUT: <b>$nout[0]</b><br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
      echo "Plusses: <b>$nopl[0]</b><br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT chmsgs FROM ibwf_users WHERE id='".$who."'"));
      echo "Chat Posts: <b>$nopl[0]</b><br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT battlep FROM ibwf_users WHERE id='".$who."'"));
      echo "Battle Points: <b>$nopl[0]</b><br/>";
      $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".$who."'"));
      if($judg[0]>0)
      {
      echo "<b>Battle Board Judge</b><br/>";
      }
      $nout = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shouter='".$who."'"));
      $nopl = mysql_fetch_array(mysql_query("SELECT shouts FROM ibwf_users WHERE id='".$who."'"));
      echo "Shouts: <b><a href=\"lists.php?action=shouts&amp;sid=$sid&amp;who=$who\">$nout[0]</a>/$nopl[0]</b><br/>";
      $nout = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_uploads WHERE uid='".$who."'"));
      echo "Files Uploaded: <b>$nout[0]</b><br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
      $jdt = date("d m y-H:i:s",$nopl[0]);
      echo "Last Active: <b>$jdt</b><br/>";
      $nopl = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$who."'"));
      $jdt = date("d m y-H:i:s",$nopl[0]);
      echo "Last Visit: <b>$jdt</b><br/>";
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$who."'"));
      if($noi[0]>0)
      {
      echo "<b>1 </b><a accesskey=\"1\" href=\"lists.php?action=ucl&amp;who=$who&amp;sid=$sid\">Clubs($noi[0])</a><br/>";
      }
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."'"));
       if($noi[0]>0)
       {
       echo "<b>2 </b><a accesskey=\"2\" href=\"lists.php?action=clm&amp;who=$who&amp;sid=$sid\">Member In $noi[0] Clubs</a><br/>";
       }
       if(ismod(getuid_sid($sid))||$judg[0]>0)
       {
       echo "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=batp&amp;who=$who&amp;sid=$sid\">Battle Points</a><br/>";
       }
      echo "<b>4 </b><a accesskey=\"4\" href=\"userfun.php?action=profile&amp;who=$who&amp;sid=$sid\">Fun And Games</a><br/>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<br/><b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    ////////////////////////////////////////// uxset
    else if($action=="uxset")
    {
        addonline(getuid_sid($sid),"Extended Settings","");
        echo "<head>";
        echo "<title>Extended Settings</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p>";
        echo "<a href=\"index.php?action=uadd&amp;sid=$sid\">&#187;My Address</a><br/>";
        echo "<a href=\"index.php?action=uper&amp;sid=$sid\">&#187;Personality</a><br/>";
        echo "<a href=\"index.php?action=umin&amp;sid=$sid\">&#187;More about me</a><br/>";
        echo "<a href=\"index.php?action=upre&amp;sid=$sid\">&#187;Preferences</a><br/>";
        
        
        echo "</p>";
        echo "<p align=\"center\">";
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////User Address
    
    else if($action=="uadd")
    {
        addonline(getuid_sid($sid),"My Address","");
        echo "<head>";
        echo "<title>My Adderss</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        $ainfo = mysql_fetch_array(mysql_query("SELECT country, city, street, phoneno, timezone FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo "<p>";
        echo "<small><img src=\"../images/point.gif\" alt=\"!\"/>Go to Preferences and choose buddies only if you want only your buddies to see your street and phone number<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>If you don't anyone to see these information just don't type them<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Example on timezone is 2 for +2 hours on GMT, or -2.5 for -2:30 on GMT<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>These info. will help you to meet friends and dates from where do you live<br/><br/></small>";
        echo "<form action=\"genproc.php?action=uadd&amp;sid=$sid\" method=\"post\">";
        echo "Contry: <input name=\"ucon\" value=\"$ucon\" maxlength=\"50\"><br/>";
        echo "City: <input name=\"ucit\" value=\"$ucit\" maxlength=\"50\"><br/>";
        echo "Street: <input name=\"ustr\" value=\"$ustr\" maxlength=\"50\"><br/>";
        echo "Timezone(e.g +2 or -2.5): <input name=\"utzn\" size=\"5\" value=\"0\" maxlength=\"5\"><br/>";
        echo "Phone No.: <input name=\"uphn\" value=\"$uphn\" maxlength=\"20\"><br/>";
        echo "<input type=\"Submit\" name=\"Submit\" value=\"Submit\"></form>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////User Preferences
    
    else if($action=="upre")
    {
        addonline(getuid_sid($sid),"Preferences","");
        echo "<head>";
        echo "<title>User Preferences</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        $ainfo = mysql_fetch_array(mysql_query("SELECT budsonly, sexpre FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo "<p>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Set buddies only to yes, so only your buddies can see your phone number, street, and real name<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Sex preference will help the correct people to find you";
        echo "<form action=\"genproc.php?action=upre&amp;sid=$sid\" method=\"post\">";
        echo "Buddies Only:<br/>";
        echo "<select name=\"ubon\" value=\"$ainfo[0]\">";
        echo "<option value=\"1\">Yes</option>";
        echo "<option value=\"0\">No</option>";
        echo "</select>";
        echo "<br/>Sex Preference:<br/>";
        echo "<select name=\"usxp\" value=\"$ainfo[1]\">";
        echo "<option value=\"F\">Females</option>";
        echo "<option value=\"M\">Males</option>";
        echo "<option value=\"B\">Both</option>";
        echo "</select>";
        echo "<br/><input type=\"Submit\" name=\"Submit\" value=\"Submit\"></form>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////User Personaliy
    
    else if($action=="uper")
    {
        addonline(getuid_sid($sid),"Personality","");
        echo "<head>";
        echo "<title>Personality</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        $ainfo = mysql_fetch_array(mysql_query("SELECT height, weight, realname, racerel, eyescolor, profession, hairtype FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo "<p>";
        echo "<form action=\"genproc.php?action=uper&amp;sid=$sid\" method=\"post\">";
        echo "Height: <input name=\"uhig\" value=\"$ainfo[0]\" maxlength=\"10\"><br/>";
        echo "Weight: <input name=\"uwgt\" value=\"$ainfo[1]\" maxlength=\"10\"><br/>";
        echo "Real Name: <input name=\"urln\" value=\"$ainfo[2]\" maxlength=\"100\"><br/>";
        echo "Ethnic Origin: <input name=\"ueor\" value=\"$ainfo[3]\" maxlength=\"100\"><br/>";
        echo "Eyes: <input name=\"ueys\" value=\"$ainfo[4]\" maxlength=\"10\"><br/>";
        echo "Hair: <input name=\"uher\" value=\"$ainfo[6]\" maxlength=\"50\"><br/>";
        echo "Profession: <input name=\"upro\" value=\"$ainfo[5]\" maxlength=\"100\"><br/>";
        echo "<input type=\"Submit\" name=\"Submit\" Value=\"Submit\"></form>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////User Personaliy
    
    else if($action=="umin")
    {
        addonline(getuid_sid($sid),"More About Me","");
        echo "<head>";
        echo "<title>More About Me</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        $ainfo = mysql_fetch_array(mysql_query("SELECT likes, deslikes, habitsb, habitsg, favsport, favmusic, moretext FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo "<p>";
        echo "<form action=\"genproc.php?action=umin&amp;sid=$sid\" method=\"post\">";
        echo "Likes: <input name=\"ulik\" value=\"$ainfo[0]\" maxlength=\"250\"><br/>";
        echo "Dislikes: <input name=\"udlk\" value=\"$ainfo[1]\" maxlength=\"250\"><br/>";
        echo "Bad Habbits: <input name=\"ubht\" value=\"$ainfo[2]\" maxlength=\"250\"><br/>";
        echo "Good Habbits: <input name=\"ught\" value=\"$ainfo[3]\" maxlength=\"250\"><br/>";
        echo "Favorite Sports: <input name=\"ufsp\" value=\"$ainfo[4]\" maxlength=\"100\"><br/>";
        echo "Favorite Music: <input name=\"ufmc\" value=\"$ainfo[5]\" maxlength=\"100\"><br/>";
        echo "More Text: <input name=\"umtx\" value=\"$ainfo[6]\" maxlength=\"500\"><br/>";
        echo "<input type=\"Submit\" name=\"Submit\" value=\"Submit\"></form>";
        echo "</p>";
        echo "<p align=\"center\">";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////G-Mail Settings
    
    else if($action=="gmset")
    {
        addonline(getuid_sid($sid),"GMail Settings","");
        echo "<head>";
        echo "<title>Gmail Settings</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        $ainfo = mysql_fetch_array(mysql_query("SELECT gmailun, gmailpw, gmailchk FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
        echo "<p>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Set these values only if you want to be auto-logged in your gmail account<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Put in the checking field the time you want $sitename to check your g-mail account<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Putting less than 20 minutes could slow your navigation throw $sitename, suggested period is 30 minutes<br/>";
        echo "<form action=\"genproc.php?action=gmset&amp;sid=$sid\" method=\"post\">";
        echo "G-Mail Username: <input name=\"ugun\" value=\"$ainfo[0]\" maxlength=\"100\"/><br/>";
        echo "G-Mail Password: <input name=\"ugpw\" value=\"$ainfo[1]\" maxlength=\"200\"/><br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Valid values 0 - 99 minutes, 0 will check your e-mail with every action you make<br/>";
        echo "G-Mail Checking: <input name=\"ugch\" style=\"-wap-input-format: '*N'\" size=\"2\" value=\"$ainfo[2]\" maxlength=\"2\"/><br/>";
        echo "<input type=\"submit\" name=\"submit\" value=\"Submit\"></form>";
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=cpanel&amp;sid=$sid\">User Settings</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
    //////////////////////////////////////////Give Game Plusses
    
    else if($action=="givegp")
    {
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Giving Game Plusses","");
        echo "<head>";
        echo "<title>Give Game Plusses</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      echo "<p align=\"center\">";
      echo "<b>Give GPs To ".getnick_uid($who)."</b><br/><br/>";
      $gps = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
      echo "You have $gps[0] GP's<br/><br/>";
      echo "GP's to give<br/>";
      echo "<form action=\"genproc.php?action=givegp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
      echo "<input name=\"tfgp\" style=\"-wap-input-format: '*N'\" maxlength=\"2\">";
      echo "<br/><input type=\"Submit\" Value=\"Give\" name=\"Give\"></form>";
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    //////////////////////////////////////////Give Battle points
    
    else if($action=="batp")
    {
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Giving Battle Points","");
        echo "<head>";
        echo "<title>Give Battle Points</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      echo "<p align=\"center\">";
      $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
      if(ismod(getuid_sid($sid))||$judg[0]>0)
      {
      echo "<b>Give/Take BPs To ".getnick_uid($who)."</b><br/><br/>";
      echo "<form action=\"genproc.php?action=batp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
      echo "<input name=\"tfbp\" style=\"-wap-input-format: '*N'\" maxlength=\"2\">";
      echo "<br/><input type=\"hidden\" name=\"giv\" value=\"1\">";
      echo "<input type=\"Submit\" name=\"Add\" Value=\"Add\"></form>";
        echo "<form action=\"genproc.php?action=batp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
      echo "<input name=\"tfbp\" style=\"-wap-input-format: '*N'\" maxlength=\"2\">";
      echo "<br/><input type=\"hidden\" name=\"giv\" value=\"0\">";
      echo "<input type=\"Submit\" name=\"Remove\" Value=\"Remove\"></form>";
      }else{
        echo "You Can't Do This";
      }
      echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    //////////////////////////////////////////Post Options
    
    else if($action=="pstopt")
    {
      $pid = $_GET["pid"];
      $page = $_GET["page"];
      $fid = $_GET["fid"];
        addonline(getuid_sid($sid),"Post Options","");
        $pinfo= mysql_fetch_array(mysql_query("SELECT uid,tid, text  FROM ibwf_posts WHERE id='".$pid."'"));
        $trid = $pinfo[0];
        $tid = $pinfo[1];
        $ptext = htmlspecialchars($pinfo[2]);
        echo "<head>";
        echo "<title>Post Options</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      echo "<p align=\"center\">";
      echo "<b>Post Options</b>";
      
      echo "</p>";
      echo "<p>";
      $trnick = getnick_uid($trid);
      echo "<b>1 </b><a accesskey=\"1\" href=\"inbox.php?action=sendpm&amp;sid=$sid&amp;who=$trid\">&#187;Send PM to $trnick</a><br/>";
      echo "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$trid\">&#187;View $trnick's Profile</a><br/>";
      //echo "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">&#187;Quote</a><br/>";
      echo "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=rpost&amp;sid=$sid&amp;pid=$pid\">&#187;Report</a><br/>";
      echo "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;page=$page\">&#171;Back to topic</a><br/>";
      if(ismod(getuid_sid($sid)))
      {
        echo "<br/>Text: ";
        echo "<form action=\"modproc.php?action=edtpst&amp;sid=$sid&amp;pid=$pid\" method=\"post\">";
        echo "<input name=\"ptext\" value=\"$ptext\" maxlength=\"500\">";
        echo "<br/><input type=\"Submit\" Value=\"Edit\" name=\"Edit\"></form>";
    
    echo "<br/><b>6 </b><a accesskey=\"6\" href=\"modproc.php?action=delp&amp;sid=$sid&amp;pid=$pid\">&#187;DELETE</a><br/>";
      }
      echo "</p>";
    echo "<p align=\"center\">";
      echo "<b>7 </b><a accesskey=\"7\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    
    else if($action=="tpcopt")
    {
        $tid = $_GET["tid"];
        addonline(getuid_sid($sid),"Topic Options","");
        $tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed  FROM ibwf_topics WHERE id='".$tid."'"));
        $trid = $tinfo[2];
        $ttext = htmlspecialchars($tinfo[3]);
        $tname = htmlspecialchars($tinfo[0]);
        echo "<head>";
        echo "<title>Toic Options</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      echo "<p align=\"center\">";
      echo "<b>Topic Options</b>";
      echo "</p>";
      echo "<p>";
      echo "Topic ID: <b>$tid</b><br/>";
      $trnick = getnick_uid($trid);
      echo "<b>1 </b><a accesskey=\"1\" href=\"inbox.php?action=sendpm&amp;sid=$sid&amp;who=$trid\">&#187;Send PM to $trnick</a><br/>";
      echo "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$trid\">&#187;View $trnick's Profile</a><br/>";
      //echo "<b>3 </b><a accesskey=\"3\" href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">&#187;Quote</a><br/>";
      $plid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
      if($plid[0]==0)
      {
      if(ismod($uid))
        {
      echo "<a href=\"index.php?action=pltpc&amp;sid=$sid&amp;tid=$tid\">&#187;Add Poll</a><br/>";
    }
    }else{
      if(ismod($uid))
      {
        echo "<a href=\"genproc.php?action=dltpl&amp;sid=$sid&amp;tid=$tid\">&#187;Delete Poll</a><br/>";
        }
    }
      echo "<b>4 </b><a accesskey=\"4\" href=\"genproc.php?action=rtpc&amp;sid=$sid&amp;tid=$tid\">&#187;Report</a><br/>";
      echo "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;page=1\">&#171;Back to topic</a><br/>";
      if(ismod(getuid_sid($sid)))
      {
        echo "<br/>Title: ";
        echo "<form action=\"modproc.php?action=rentpc&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
        echo "<input name=\"tname\" value=\"$tname\" maxlength=\"25\"/>";
        echo "<br/><input type=\"Submit\" Name=\"Rename\" Value=\"Rename\"></form>";
        echo "<br/>Text: ";
        echo "<form action=\"modproc.php?action=edttpc&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
        echo "<input name=\"ttext\" value=\"$ttext\" maxlength=\"500\"/>";
        echo "<br/><input type=\"Submit\" Name=\"Edit\" Value=\"Edit\"></form>";
    
    echo "<br/><a href=\"modproc.php?action=delt&amp;sid=$sid&amp;tid=$tid\">&#187;DELETE</a><br/>";
        echo "<br/>";
        if($tinfo[5]=='1')
        {
          $ctxt = "Open";
          $cact = "0";
        }else{
            $ctxt = "Close";
          $cact = "1";
        }
        echo "<a href=\"modproc.php?action=clot&amp;sid=$sid&amp;tid=$tid&amp;tdo=$cact\">&#187;$ctxt</a><br/>";
        if($tinfo[4]=='1')
        {
          $ptxt = "Unpin";
          $pact = "0";
        }else{
            $ptxt = "Pin";
          $pact = "1";
        }
      echo "<a href=\"modproc.php?action=pint&amp;sid=$sid&amp;tid=$tid&amp;tdo=$pact\">&#187;$ptxt</a><br/>";
      //echo "<a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">&#187;Quote</a><br/>";
      echo "<br/>Move to:<br/>";
      $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE clubid='0'");
      echo "<form action=\"modproc.php?action=mvt&amp;sid=$sid&amp;tid=$tid\" method=\"post\">";
      echo "<select name=\"mtf\">";
      while ($forum = mysql_fetch_array($forums))
      {
        echo "<option value=\"$forum[0]\">$forum[1]</option>";
      }
      echo "</select><br/>";
      echo "<input type=\"Submit\" Value=\"Move\" name=\"Move\"></form>";
      }
      echo "</p>";
    echo "<p align=\"center\">";
      echo "<b>7 </b><a accesskey=\"7\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
        	  echo "<b>8 </b><a accesskey=\"8\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
        	  echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    }
    else if ($action=="chat")           {
            addonline(getuid_sid($sid),"chat room list","index.php?action=chat");
            echo "<head>";
            echo "<title>Chatroom List</title>";
            echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
            echo "</head>";
            echo "<body>";
            //echo "<div><img src=\"../images/chat.gif\" alt=\"\"/></div>";
            echo popup($sid);
            echo "<p align=\"center\">";
            $rooms = mysql_query("SELECT id, name, perms, mage, chposts FROM ibwf_rooms WHERE static='1' AND clubid='0'");
            while ($room= mysql_fetch_array($rooms))
            {
              
              /*if(canenter($room[0], $sid))
              {*/
                $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
                echo "<a href=\"chat.php?sid=$sid&amp;rid=$room[0]\">$room[1]($noi[0])</a><br/>";
              /*}*/
              
            }
            echo "<br/>";
            echo "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=uchat&amp;sid=$sid\">Private Rooms</a><br/>";
            echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo "</p>";
            echo "</body>";
                                               }
    else if ($action=="uchat")           {
    addonline(getuid_sid($sid),"Chat Menu","");
        echo "<head>";
        echo "<title>Chat Menu</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
            echo "<p align=\"center\">";
            echo "<img src=\"../images/chat.gif\" alt=\"*\"/><br/>";
    		echo "</p>";
    echo "<p align=\"center\">";
         echo "<br/>";
            echo "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=chat&amp;sid=$sid\">Public Rooms</a><br/>";
            echo "<b>2 </b><a accesskey=\"2\" href=\"index.php?action=mkroom&amp;sid=$sid\">Create Room</a><br/><br/>";
            $rooms = mysql_query("SELECT id, name, pass FROM ibwf_rooms WHERE static='0'");
            $co=0;
            while ($room= mysql_fetch_array($rooms))
            {
                $co++;
              if(canenter($room[0], $sid))
              {
                $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
                if($room[2]=="")
                {
                echo "<a href=\"chat.php?sid=$sid&amp;rid=$room[0]\">".htmlspecialchars($room[1])."($noi[0])</a><br/>";
                }else{
    echo htmlspecialchars($room[1]);
                  //echo "($noi[0])";
    echo "<form action=\"chat.php\" method=\"get\">";
                  echo "<br/><input format=\"*x\" name=\"rpw\" maxlength=\"10\"/><br/>";
    echo "<input type=\"submit\" value=\"GO\"/>";
                  echo "<input type=\"hidden\" name=\"rid\" value=\"$room[0]\"/>";
                  echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
                  echo "</form>";
                }
              }
            }
            echo "<br/><br/><b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo "</p>";
            echo "</body>";
                                               }
    else if($action=="mkroom")
    {
        addonline(getuid_sid($sid),"Creating Chatroom","");
        echo "<head>";
        echo "<title>Create Room</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
            echo "<p>";
            echo "<small><img src=\"../images/point.gif\" alt=\"!\"/>Leave password empty if you dont want to lock the room</small><br/>";
            echo "<small><img src=\"../images/point.gif\" alt=\"!\"/>Don't make the password too personal, it's visible in the database</small><br/><br/>";
            echo "<form action=\"genproc.php?action=mkroom&amp;sid=$sid\" method=\"post\">";
            echo "Room Name: <input name=\"rname\" maxlength=\"30\"><br/>";
            echo "Password: <input name=\"rpass\" style=\"-wap-input-format: '*x'\" maxlength=\"10\"><br/>";
            echo "<input type=\"Submit\" name=\"Create\" Value=\"Create\"></form>";
            echo "</p>";
            echo "<p align=\"center\">";
            echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo "</p>";
            echo "</body>";
    }
                                               
    else if ($action=="funm")           {
    addonline(getuid_sid($sid),"Fun Menu","");
        echo "<head>";
        echo "<title>Fun n Games</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
            echo "<p align=\"center\">";
            echo "<img src=\"../images/roll.gif\" alt=\"*\"/><br/>";
            echo "Hello, so you want to have some creative fun? well you came into the right place";
            echo "</p>";
            echo "<p>";
    	  echo "<b>1 </b><a accesskey=\"1\" href=\"babe.php?sid=$sid\">&#187;ChatGirl</a><br/>";
            echo "<b>2 </b><a accesskey=\"2\" href=\"games.php?action=guessgm&amp;sid=$sid\">&#187;Guess The Number</a><br/>";
    	  echo "<b>4 </b><a accesskey=\"4\" href=\"games.php?action=hangman&amp;sid=$sid\">&#187;Hangman</a><br/>";
            echo "<b>5 </b><a accesskey=\"5\" href=\"games.php?action=scramble&amp;sid=$sid\">&#187;Word Scramble</a><br/>";
    
            //echo "&#187;Hangman<br/>";
            //echo "&#187;Dares Box<br/>";
            echo "</p>";
            echo "<p align=\"center\">";
            echo "<b>6 </b><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
            echo "<b>7 </b><a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
            echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo forumlink($sid,9);
    
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
            echo "</p>";
            echo "</body>";
                                               }
    ///////////////////////////////view blog
    
    else if($action=="viewblog")
    {
      $bid = $_GET["bid"];
      addonline(getuid_sid($sid),"Viewing Users Blog","");
        echo "<head>";
        echo "<title>View Blog</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      echo "<p>";
    
      $pminfo = mysql_fetch_array(mysql_query("SELECT btext, bname, bgdate,bowner, id FROM ibwf_blogs WHERE id='".$bid."'"));
        $bttl = htmlspecialchars($pminfo[1]);
        $btxt = parsemsg($pminfo[0], $sid);
        $bnick = getnick_uid($pminfo[3]);
      $vbbl = "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$pminfo[3]\">$bnick</a><br/>";
      echo "Club ID: <b>$bid</b><br/>";
        echo "<b>$bttl</b> by: $vbbl<br/>";
      echo "$btxt<br/>";
      $tmstamp = $pminfo[2];
      $tmdt = date("d m y - h:i:s", $tmstamp);
      echo "<small>$tmdt</small><br/><br/>";
      $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_brate WHERE uid='".$uid."' AND blogid='".$bid."'"));
      if($vb[0]==0)
      {
      echo "<form action=\"genproc.php?action=rateb&amp;sid=$sid&amp;bid=$pminfo[4]\" method=\"post\">";
      echo "<select name=\"brate\">";
      echo "<option value=\"1\">1</option>";
      echo "<option value=\"2\">2</option>";
      echo "<option value=\"3\">3</option>";
      echo "<option value=\"4\">4</option>";
      echo "<option value=\"5\">5</option>";
      echo "</select><br/>";
      echo "<input type=\"Submit\" Name=\"Rate\" Value=\"Rate\"></form>";
      }else{
        $rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(brate) as nofp FROM ibwf_brate WHERE blogid='".$bid."'"));
        $ther = $rinfo[1]/$rinfo[0];
        echo "Rate: $ther - Points: $rinfo[1]";
      }
      echo "</p>";
      echo "<p align=\"center\">";
      echo "<a href=\"lists.php?action=allbl&amp;sid=$sid\">Back to Blogs</a><br/>";
      $bnick = getnick_uid($pminfo[3]);
      echo "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$pminfo[3]\">Back to $bnick's Blogs</a><br/>";
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    
    }
    /////////////////////////////////Terms of use
    
    else if($action=="terms")
    {
      $uid =getuid_sid($sid);
      if($uid>0)
      {
      addonline(getuid_sid($sid),"Terms of use","");
      }
        echo "<head>";
        echo "<title>Terms Of Use</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
      echo "<p align=\"center\">";
      	echo "<img src=\"../images/point.gif\" alt=\"!\"/>This Site Is made for OVER 14's ONLY, and users found to be lying about their age in order to access the site will be deleted without warning. YOU HAVE BEEN WARNED!<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Posts containing racism, spamming, flooding Or hacking Information will be deleted immediately, and the posters will get warned or banned<br/>";
        echo "<img src=\"../images/point.gif\" alt=\"!\"/>Registering more than one nickname, could result in  all your accounts being deleted<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>Never give your username and password to anyone<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>Faking your personal information (like age, sex, location etc..) just to gain access to hidden forums and other content in here, could result in you being banned, or getting a warning at least<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>Harassment and racism will result in a ban, and an permanent IP-Ban if this behavior continues<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>Bumping topics (keep posting in them by the author of the topic just to keep it in first page) will cause these topics to be deleted and the penalty could vary between warning, or even a ban<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>You MUST speak in english on the Public parts of this site (shoutbox, and all chat rooms except user created and international rooms), but you are free to create your own chatroom and club in any language<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>No smoking in public, next to the pregnant ladies, or next to babies hehe<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>ALL Bans are logged as are ALL pms with any form of website links in them, any pms sent containing weblinks will be moderated and may result in a ban for the sending user for an appropriate length of time.<br/>";
      echo "<img src=\"../images/point.gif\" alt=\"!\"/>The most important rule is to have fun here and enjoy your stay ;)<br/>";
      echo "<br/>Remember, these rules were made for protecting you before protecting us, if you think they are a little restrictive then ask any online staff member(only if you logged in), Thank you<br/>";
        echo "</p>";
      echo "<p align=\"center\">";
      if($uid>0)
      {
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }else{
      echo "<b>0 </b><a accesskey=\"0\" href=\"index.php\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }
      echo "</p>";
      echo "</body>";
    }
    else{
      /////////////////////////Main Page Here
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo "</head>";
      echo "<body>";
      echo "<div><img src=\"../images/logo.gif\" alt=\"\"/><br/>";
      echo "".date("H:i")." - ".date("D jS M y")."</div>";
      echo "<p align=\"center\">";
      echo "Welcome to $sitename Community, please Feel Free To Browse and invite all your friends ;o)</p>";
      echo "<p align=\"center\">wap2.0/xhtml<br/>works with any pc browser n most mobiles</p>";
      echo "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"\"/></p>";
      echo "<form action=\"login.php\" method=\"get\"><p align=\"center\">";
      echo "<b>Username:</b><br/><input align=\"center\" name=\"loguid\" size=\"12\" maxlength=\"12\"/><br/>";
      echo "<b>Password:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
      echo "<input type=\"submit\" value=\"Login!\"></p></form>";
      echo "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"\"/></p>";
      echo "<p align=\"center\"><br/>Not registered yet? <br/><a href=\"register.php\">Register</a><br/>";
      echo "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo "</p>";
      echo "<p align=\"center\">";
      $onu = getnumonline();
      echo "Members Inside: $onu<br/><br/>";
      echo "<a href=\"../wap/index.php\">Wap 1.0(wml) Version</a></p>";
      echo mobads();
      echo "<div><b>&#169;2007<br/>$sitename</b></div>";
      echo "</body>";
    }
    ?>
    </html>
    Code:
    
    
    what problem u havin as i dont understand index.php no output show

    Comment


      #3
      you have some function that not correctly run..

      try to remove mobads();

      if mobads doest exist to core.php you should remove it to index.php

      remove all... search the word using your php text editor and erase it..

      Comment

      Working...
      X