View file chat spall script/web/genproc.php

File size: 78.74Kb
<?
// -------------------------------------------------------------------------------------
$EnableGZipEncoding = true;
// -------------------------------------------------------------------------------------
// Helper function to detect if GZip is supported by client!
// If not supported the tricks are pointless
function acceptsGZip(){
    $accept = str_replace(" ","",
        strtolower($_SERVER['HTTP_ACCEPT_ENCODING'])
    );
    $accept = explode(",",$accept);
    return in_array("gzip",$accept);
}
// -------------------------------------------------------------------------------------
function playWithHtml($OutputHtml){
    // This will mess up HTML code like my site has done!
    // View the source to understand! All ENTERs are removed.
    // If your site has PREformated code this will break it!
    // Use regexp to find it and save it and place it back ...
    // or just uncomment the next line to keep enters
    // return $OutputHtml;
    return preg_replace("/\s+/"," ",$OutputHtml);
}
// -------------------------------------------------------------------------------------
function obOutputHandler($OutputHtml){
    global $EnableGZipEncoding;
    //-- Play with HTML before output
    $OutputHtml = playWithHtml($OutputHtml);
    //-- If GZIP not supported compression is pointless.
    // If headers were sent we can not signal GZIP encoding as
    // we will mess it all up so better drop it here!
    // If you disable GZip encoding to use plain output buffering we stop here too!
    if(!acceptsGZip() || headers_sent() || !$EnableGZipEncoding) return $OutputHtml;
    //-- We signal GZIP compression and dump encoded data
    header("Content-Encoding: gzip");
    return gzencode($OutputHtml);
}
// This code has to be before any output from your site!
// If output exists uncompressed HTML will be delivered!
ob_start("obOutputHandler");
// -------------------------------------------------------------------------------------
?>
<?php
header("Cache-Control: no-cache, must-revalidate");
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
include("config.php");
include("core.php");
connectdb();
$action = mysql_real_escape_string( $_GET["action"]);
$sid = mysql_real_escape_string( $_GET["sid"]);
$page = mysql_real_escape_string( $_GET["page"]);
$who = mysql_real_escape_string( $_GET["who"]);
$uid =mysql_real_escape_string(getuid_sid($sid));
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));

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();
    }
if($action=="newtopic")
{
  $fid = $_POST["fid"];
  $ntitle = $_POST["ntitle"];
  $tpctxt = $_POST["tpctxt"];
  if(!canaccess(getuid_sid($sid), $fid))
    {
      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 "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();
    }
if(istrashed(getuid_sid($sid)))
  {
      echo "<head>";
      echo "<title>$sitename</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/>Unknown error cannot create topic!<br/>please try again later...<br/><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>";
      echo "</html>";
      exit();
  }
  addonline(getuid_sid($sid),"Created New Topic","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      $crdate = time();
      //$uid = getuid_sid($sid);
      $texst = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE name LIKE '".$ntitle."' AND fid='".$fid."'"));
      if($texst[0]==0)
      {
        $res = false;
      
        $ltopic = mysql_fetch_array(mysql_query("SELECT crdate FROM ibwf_topics WHERE authorid='".$uid."' ORDER BY crdate DESC LIMIT 1"));
        global $topic_af;
        $antiflood = time()-$ltopic[0];
        if($antiflood>$topic_af)
{
  if((trim($ntitle)!="")||(trim($tpctxt)!=""))
      {
    if(!isblocked($ntitle,$uid)&&!isblocked($tpctxt,$uid))
    {

      $res = mysql_query("INSERT INTO ibwf_topics SET name='".$ntitle."', fid='".$fid."', authorid='".$uid."', text='".$tpctxt."', crdate='".$crdate."', lastpost='".$crdate."'");
    }else{
    $bantime = time() + (30*24*60*60);
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Post Topic<br/><br/>";
    echo "You just tried creating a topic with a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your plusses<br/>3. You are BANNED!";
        $user = getnick_sid($sid);
    mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='<b>Wap Desire</b> auto banned $user for spamming forums', actdt='".time()."'");
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$uid."'");
      echo "</body>";
      echo "</html>";
      exit();
  }
     }
       if($res)
      {
        $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
        $ups = $usts[0]+1;
        $upl = $usts[1]+1;
        mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
        $tnm = htmlspecialchars($ntitle);
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Topic <b>$tnm</b> Created Successfully";
        $tid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_topics WHERE name='".$ntitle."' AND fid='".$fid."'"));
        echo "<br/><br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid[0]\">";
echo "View Topic</a>";
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Creating New Thread";
      }
      }else{
        $af = $topic_af -$antiflood;
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
      }
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Topic Name already Exist";
      }

      



      $fname = getfname($fid);
      echo "<br/><br/><a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">";
echo "$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>";
}
//////////////////////////////////
else if($action=="updtthme")
{
  addonline(getuid_sid($sid),"Updating Theme","");
  $theme = $_POST["thms"];
 
  $uid = getuid_sid($sid);
  $exist = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE id='".$uid."'"));
if ($exist[0]>0)
  {
  $res = mysql_query("UPDATE ibwf_users SET theme='".$theme.".css' WHERE id='".$uid."'");
  }else{
  $res = mysql_query("UPDATE ibwf_users SET theme='".$theme.".css' WHERE id='".$uid."'");
  }
  echo "<head>";
  echo "<title>$sitename</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/".$theme.".css\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  echo mysql_error();
if($res)
  {
  echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Your theme has been updated successfully<br/><br/><br/>";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/><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=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  echo "</body>";
}
else if($action=="post")
{
    $tid = $_POST["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>$sitename</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 "<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>";
      echo "</html>";
      exit();
    }
if(istrashed(getuid_sid($sid)))
  {
      echo "<head>";
      echo "<title>$sitename</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/>Unknown error cannot create post!<br/>please try again later...<br/><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>";
      echo "</html>";
      exit();
  }
  $reptxt = $_POST["reptxt"];
  $qut = $_POST["qut"];
  addonline(getuid_sid($sid),"Posted A reply","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      $crdate = time();
      $fid = getfid($tid);
      //$uid = getuid_sid($sid);
      $res = false;
      $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));
      
      if(($closed[0]!='1')||(ismod($uid)))
      {
      
        $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1"));
        global $post_af;
        $antiflood = time()-$lpost[0];
        if($antiflood>$post_af)
{
  if(trim($reptxt)!="")
      {
    if(!isblocked($reptxt,$uid))
    {
      $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'");
    }else{
    $bantime = time() + (30*24*60*60);
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Post Reply<br/><br/>";
   echo "You just tried posting a reply with a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your plusses<br/>3. You are BANNED!";
        $user = getnick_sid($sid);
    mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='<b>Wap Desire</b> auto banned $user for spamming forums', actdt='".time()."'");
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$uid."'");
      echo "</body>";
      echo "</html>";
      exit();
  }
}
      if($res)
      {
        $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
        $res2 = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id='".$tid."'"));
	  $usr = getnick_uid($uid);
	  $tname = htmlspecialchars($res2[0]);
      if(($res2[1]!=$uid)&&(automsgs($res2[1]))){
	  $msg = "Your Topic [topic=$tid]$tname"."[/topic] has been Replied to by $usr [br/][small][i]p.s: this is an automated pm[/i][/small]";
	  autopm($msg, $res2[1]);
        }
        $ups = $usts[0]+1;
        $upl = $usts[1]+1;
        mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
        mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'");
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
        echo "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;go=last\">View Topic</a>";
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
      }
      }else{
$af = $post_af -$antiflood;
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
      }
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Topic is closed for posting";
      }
      
      $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>";
  
}

else if ($action=="uadd")
{
    $ucon = $_POST["ucon"];
    $ucit = $_POST["ucit"];
    $ustr = $_POST["ustr"];
    $utzn = $_POST["utzn"];
    $uphn = $_POST["uphn"];
    addonline(getuid_sid($sid),"My Address","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_xinfo WHERE uid='".$uid."'"));
    if($exs[0]>0)
    {
        $res = mysql_query("UPDATE ibwf_xinfo SET country='".$ucon."', city='".$ucit."', street='".$ustr."', timezone='".$utzn."', phoneno='".$uphn."' WHERE uid='".$uid."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Address Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }else{
        $res = mysql_query("INSERT INTO ibwf_xinfo SET uid='".$uid."', country='".$ucon."', city='".$ucit."', street='".$ustr."', timezone='".$utzn."', phoneno='".$uphn."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Address Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }
    echo "<b>0 </b><a accesskey=\"9\" href=\"index.php?action=uxset&amp;sid=$sid\">Extended 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>";
}

else if($action=="gcp")
{
    $clid = $_GET["clid"];
    $who = $_GET["who"];
    $giv = $_POST["giv"];
    $pnt = $_POST["pnt"];
    addonline(getuid_sid($sid),"Moderating Club Member","");
    echo "<head>";
    echo "<title>$sitename</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)
{
    $mpt = mysql_fetch_array(mysql_query("SELECT points FROM ibwf_clubmembers WHERE uid='".$who."' AND clid='".$clid."'"));
    if($giv=="1")
    {
      $pnt = $mpt[0]+$pnt;
    }else{
        $pnt = $mpt[0]-$pnt;
        if($pnt<0)$pnt=0;
    }
    $res = mysql_query("UPDATE ibwf_clubmembers SET points='".$pnt."' WHERE uid='".$who."' AND clid='".$clid."'");
    if($res)
    {
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Club points updated successfully!";
    }else{
      echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Database Error!";
    }
    }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"];
    $pnt = $_POST["pnt"];
    addonline(getuid_sid($sid),"Moderating Club Member","");
      echo "<head>";
      echo "<title>$sitename</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>";
      echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Because people misused the plusses thing, clubs owners cant give plusses anymore";
    
    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=="upre")
{
    $ubon = $_POST["ubon"];
    $usxp = $_POST["usxp"];
    addonline(getuid_sid($sid),"Preferences","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_xinfo WHERE uid='".$uid."'"));
    if($exs[0]>0)
    {
        $res = mysql_query("UPDATE ibwf_xinfo SET budsonly='".$ubon."', sexpre='".$usxp."' WHERE uid='".$uid."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Preferences Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }else{
        $res = mysql_query("INSERT INTO ibwf_xinfo SET uid='".$uid."', budsonly='".$ubon."', sexpre='".$usxp."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Preferences Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }
    echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=uxset&amp;sid=$sid\">Extended 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>";
}

else if ($action=="gmset")
{
    $ugun = $_POST["ugun"];
    $ugpw = $_POST["ugpw"];
    $ugch = $_POST["ugch"];
    addonline(getuid_sid($sid),"G-Mail Settings","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_xinfo WHERE uid='".$uid."'"));
    if($exs[0]>0)
    {
        $res = mysql_query("UPDATE ibwf_xinfo SET gmailun='".$ugun."', gmailpw='".$ugpw."', gmailchk='".$ugch."', gmaillch='".time()."' WHERE uid='".$uid."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Gmail Settings Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }else{
        $res = mysql_query("INSERT INTO ibwf_xinfo SET uid='".$uid."', gmailun='".$ugun."', gmailpw='".$ugpw."', gmailchk='".$ugch."', gmaillch='".time()."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>G-Mail Settings Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }
    echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=uxset&amp;sid=$sid\">Extended 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>";
}

else if ($action=="uper")
{
    $uhig = $_POST["uhig"];
    $uwgt = $_POST["uwgt"];
    $urln = $_POST["urln"];
    $ueor = $_POST["ueor"];
    $ueys = $_POST["ueys"];
    $uher = $_POST["uher"];
    $upro = $_POST["upro"];
    
    addonline(getuid_sid($sid),"Personality","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_xinfo WHERE uid='".$uid."'"));
    if($exs[0]>0)
    {
        $res = mysql_query("UPDATE ibwf_xinfo SET height='".$uhig."', weight='".$uwgt."', realname='".$urln."', eyescolor='".$ueys."', profession='".$upro."', racerel='".$ueor."',hairtype='".$uher."'  WHERE uid='".$uid."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Personal Info Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }else{
        $res = mysql_query("INSERT INTO ibwf_xinfo SET uid='".$uid."', height='".$uhig."', weight='".$uwgt."', realname='".$urln."', eyescolor='".$ueys."', profession='".$upro."', racerel='".$ueor."',hairtype='".$uher."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Personal Info Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }
    echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=uxset&amp;sid=$sid\">Extended 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>";
}

else if ($action=="umin")
{
    $ulik = $_POST["ulik"];
    $ulik = str_replace('"', "", $ulik);
    $ulik = str_replace("'", "", $ulik);
    $udlk = $_POST["udlk"];
    $udlk = str_replace('"', "", $udlk);
    $udlk = str_replace("'", "", $udlk);
    $ubht = $_POST["ubht"];
    $ubht = str_replace('"', "", $ubht);
    $ubht = str_replace("'", "", $ubht);
    $ught = $_POST["ught"];
    $ught = str_replace('"', "", $ught);
    $ught = str_replace("'", "", $ught);
    $ufsp = $_POST["ufsp"];
    $ufsp = str_replace('"', "", $ufsp);
    $ufsp = str_replace("'", "", $ufsp);
    $ufmc = $_POST["ufmc"];
    $ufmc = str_replace('"', "", $ufmc);
    $ufmc = str_replace("'", "", $ufmc);
    $umtx = $_POST["umtx"];
    $umtx = str_replace('"', "", $umtx);
    $umtx = str_replace("'", "", $umtx);
    addonline(getuid_sid($sid),"More about me","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_xinfo WHERE uid='".$uid."'"));
    if($exs[0]>0)
    {
        $res = mysql_query("UPDATE ibwf_xinfo SET likes='".$ulik."', deslikes='".$udlk."', habitsb='".$ubht."', habitsg='".$ught."', favsport='".$ufsp."', favmusic='".$ufmc."',moretext='".$umtx."'  WHERE uid='".$uid."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Info Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }else{
        $res = mysql_query("INSERT INTO ibwf_xinfo SET uid='".$uid."', likes='".$ulik."', deslikes='".$udlk."', habitsb='".$ubht."', habitsg='".$ught."', favsport='".$ufsp."', favmusic='".$ufmc."',moretext='".$umtx."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Info Updated Successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
        }
    }
    echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=uxset&amp;sid=$sid\">Extended 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>";
}

else if($action=="mkroom")
{
        $rname = mysql_escape_string($_POST["rname"]);
        $rpass = trim($_POST["rpass"]);
        addonline(getuid_sid($sid),"Creating Chatroom","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
        echo "<p align=\"center\">";
        if ($rpass=="")
        {
          $cns = 1;
        }else{
            $cns = 0;
        }
        $prooms = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rooms WHERE static='0'"));
        if($prooms[0]<10)
        {
        $res = mysql_query("INSERT INTO ibwf_rooms SET name='".$rname."', pass='".$rpass."', censord='".$cns."', static='0', lastmsg='".time()."'");
        if($res)
        {
          echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Room created successfully<br/><br/>";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Database Error!<br/><br/>";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>There's already 10 users rooms<br/><br/>";
        }
        echo "<b>9 </b><a accesskey=\"9\" href=\"index.php?action=uchat&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=="signgb")
{
    $who = $_POST["who"];
   
if(!cansigngb(getuid_sid($sid), $who))
    {
      echo "<head>";
      echo "<title>$sitename</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 "<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>";
      echo "</html>";
      exit();
    }
  $msgtxt = $_POST["msgtxt"];
  //$qut = $_POST["qut"];
  addonline(getuid_sid($sid),"Signing a guestbook","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      $crdate = time();
      //$uid = getuid_sid($sid);
      $res = false;

      if(trim($msgtxt)!="")
      {
        
      $res = mysql_query("INSERT INTO ibwf_gbook SET gbowner='".$who."', gbsigner='".$uid."', dtime='".$crdate."', gbmsg='".$msgtxt."'");
      }
      if($res)
      {
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
      }
      
      echo "<br/><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=="votepl")
{
  //$uid = getuid_sid($sid);
  $plid = $_GET["plid"];
  $ans = $_GET["ans"];
  addonline(getuid_sid($sid),"Poll Voting ;)","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $voted = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$plid."'"));
    if($voted[0]==0)
    {
        $res = mysql_query("INSERT INTO ibwf_presults SET uid='".$uid."', pid='".$plid."', ans='".$ans."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Thanx for your voting";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You already voted for this poll";
    }
  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=="dlpoll")
{
  //$uid = getuid_sid($sid);
  addonline(getuid_sid($sid),"Deleting Poll","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
        $res = mysql_query("UPDATE ibwf_users SET pollid='0' WHERE id='".$uid."'");
        if($res)
        {
          $res = mysql_query("DELETE FROM ibwf_presults WHERE pid='".$pid[0]."'");
		  $res = mysql_query("DELETE FROM ibwf_pp_pres WHERE pid='".$pid[0]."'");
          $res = mysql_query("DELETE FROM ibwf_polls WHERE id='".$pid[0]."'");
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Poll Deleted";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
  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=="delan")
{
  //$uid = getuid_sid($sid);
  addonline(getuid_sid($sid),"Deleting Announcement","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  $clid = $_GET["clid"];
  $anid = $_GET["anid"];
  $uid = getuid_sid($sid);
    echo "<p align=\"center\">";
    $pid = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE id='".$anid."' AND clid='".$clid."'"));
    if(($uid==$pid[0])&&($exs[0]>0))
    {
        $res = mysql_query("DELETE FROM ibwf_announcements WHERE id='".$anid."'");
        if($res)
        {

            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Announcement Deleted";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Yo can't delete this announcement!";
    }
  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=="dlcl")
{
  //$uid = getuid_sid($sid);
  addonline(getuid_sid($sid),"Deleting Club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  $clid = $_GET["clid"];
  $uid = getuid_sid($sid);
    echo "<p align=\"center\">";
    $pid = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    if($uid==$pid[0])
    {
        $res = deleteClub($clid);
        if($res)
        {
          
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Club Deleted";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Yo can't delete this club!";
    }
  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=="pws")
{
  //$uid = getuid_sid($sid);
  addonline(getuid_sid($sid),"Updating PWS","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  $imgt = $_POST["imgt"];
  $imgo = $_POST["imgo"];
  $smsg = $_POST["smsg"];
  $thms = $_POST["thms"];
  
  $uid = getuid_sid($sid);
    echo "<p align=\"center\">";
    if($imgt=="idc")
	{
		$imgo = "http://$sitename/rwidc.php?id=$uid";
	}else if($imgt == "avt")
	{
		$av = mysql_fetch_array(mysql_query("SELECT avatar FROM ibwf_users WHERE id='".$uid."'"));
		if(strpos($av[0], "http://")===false)
		{
			$av[0] = "../".$av[0];
		}
		$imgo = $av[0];
	}else if($imgt=="sml")
	{
		$sml = mysql_fetch_array(mysql_query("SELECT imgsrc FROM ibwf_smilies WHERE scode='".strtolower(trim($imgo))."'"));
		$imgo = "../".$sml[0];
	}else
	{
		$imgo = strtolower(trim($imgo));
	}
    $smsg = trim($smsg);
	$isu = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mypage WHERE uid='".$uid."'"));
	if ($isu[0]>0)
	{
		$res = mysql_query("UPDATE ibwf_mypage SET thid='".$thms."', mimg='".$imgo."', msg='".$smsg."' WHERE uid='".$uid."'");
	}else{
		$res = mysql_query("INSERT INTO ibwf_mypage SET uid='".$uid."', thid='".$thms."', mimg='".$imgo."', msg='".$smsg."'");
	}
	echo mysql_error();
    if($res)
    {
    echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Your Site updated successfully<br/><br/>";
	echo "<b>9 </b><a accesskey=\"9\" href=\"../users?".getnick_uid($uid)."\">View Your Site</a>";
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
    }
  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=="dltpl")
{
  //$uid = getuid_sid($sid);
  $tid = $_GET["tid"];
  addonline(getuid_sid($sid),"Deleting Poll","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
        $res = mysql_query("UPDATE ibwf_topics SET pollid='0' WHERE id='".$tid."'");
        if($res)
        {
          $res = mysql_query("DELETE FROM ibwf_presults WHERE pid='".$pid[0]."'");
          $res = mysql_query("DELETE FROM ibwf_polls WHERE id='".$pid[0]."'");
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Poll Deleted";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
  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=="reqjc")
{
  //$uid = getuid_sid($sid);
  $clid = $_GET["clid"];
  addonline(getuid_sid($sid),"Joining A Club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $isin = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid."'"));
    if($isin[0]==0){
        $res = mysql_query("INSERT INTO ibwf_clubmembers SET uid='".$uid."', clid='".$clid."', accepted='0', points='0', joined='".time()."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Request sent! the club owner should accept your request";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You already in this club or request sent and waiting for acception";
        }
  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=="unjc")
{
  //$uid = getuid_sid($sid);
  $clid = $_GET["clid"];
  addonline(getuid_sid($sid),"Unjoining club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $isin = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid."'"));
    if($isin[0]>0){
        $res = mysql_query("DELETE FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Unjoined club successfully";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You're not a member of this club!";
        }
  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=="acm")
{
  //$uid = getuid_sid($sid);
  $clid = $_GET["clid"];
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Adding a member to club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $cowner = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    if($cowner[0]==$uid){
        $res = mysql_query("UPDATE ibwf_clubmembers SET accepted='1' WHERE clid='".$clid."' AND uid='".$who."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Member added to your club";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This club ain't yours";
        }
  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=="accall")
{
  //$uid = getuid_sid($sid);
  $clid = $_GET["clid"];
  
  addonline(getuid_sid($sid),"Adding a member to club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $cowner = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    if($cowner[0]==$uid){
        $res = mysql_query("UPDATE ibwf_clubmembers SET accepted='1' WHERE clid='".$clid."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>All Members Accepted";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This club ain't yours";
        }
  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=="denall")
{
  //$uid = getuid_sid($sid);
  $clid = $_GET["clid"];
  
  addonline(getuid_sid($sid),"Adding a member to club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $cowner = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    if($cowner[0]==$uid){
        $res = mysql_query("DELETE FROM ibwf_clubmembers WHERE accepted='0' AND clid='".$clid."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>All Members Denied";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This club ain't yours";
        }
  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=="dcm")
{
  //$uid = getuid_sid($sid);
  $clid = $_GET["clid"];
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Deleting a member from club","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    $uid = getuid_sid($sid);
    $cowner = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    if($cowner[0]==$uid){
        $res = mysql_query("DELETE FROM ibwf_clubmembers  WHERE clid='".$clid."' AND uid='".$who."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Member deleted from your club";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This club ain't yours";
        }
  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=="crpoll")
{
  addonline(getuid_sid($sid),"Creating Poll","");
      echo "<head>";
      echo "<title>$sitename</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(getplusses(getuid_sid($sid))>=50)
    {
    $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
        if($pid[0] == 0)
        {
          $pques = $_POST["pques"];
          $opt1 = $_POST["opt1"];
          $opt2 = $_POST["opt2"];
          $opt3 = $_POST["opt3"];
          $opt4 = $_POST["opt4"];
          $opt5 = $_POST["opt5"];
          if((trim($pques)!="")&&(trim($opt1)!="")&&(trim($opt2)!=""))
          {
            $pex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_polls WHERE pqst LIKE '".$pques."'"));
            if($pex[0]==0)
            {
              $res = mysql_query("INSERT INTO ibwf_polls SET pqst='".$pques."', opt1='".$opt1."', opt2='".$opt2."', opt3='".$opt3."', opt4='".$opt4."', opt5='".$opt5."', pdt='".time()."'");
              if($res)
              {
                $pollid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_polls WHERE pqst='".$pques."' "));
                mysql_query("UPDATE ibwf_users SET pollid='".$pollid[0]."' WHERE id='".$uid."'");
                echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Your poll created successfully";
              }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Eroor!";
              }
                }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>There's already a poll with the same question";
          }

          }else{
             echo "<img src=\"../images/notok.gif\" alt=\"x\"/>The poll must have a question, and at least 2 options";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You already have a poll";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You should have at least 50 plusses to create a poll";

          }
  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=="pltpc")
{
  $tid = $_GET["tid"];
  addonline(getuid_sid($sid),"Creating Poll","");
      echo "<head>";
      echo "<title>$sitename</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((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)
        {
          $pques = $_POST["pques"];
          $opt1 = $_POST["opt1"];
          $opt2 = $_POST["opt2"];
          $opt3 = $_POST["opt3"];
          $opt4 = $_POST["opt4"];
          $opt5 = $_POST["opt5"];
          if((trim($pques)!="")&&(trim($opt1)!="")&&(trim($opt2)!=""))
          {
            $pex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_polls WHERE pqst LIKE '".$pques."'"));
            if($pex[0]==0)
            {
              $res = mysql_query("INSERT INTO ibwf_polls SET pqst='".$pques."', opt1='".$opt1."', opt2='".$opt2."', opt3='".$opt3."', opt4='".$opt4."', opt5='".$opt5."', pdt='".time()."'");
              if($res)
              {
                $pollid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_polls WHERE pqst='".$pques."' "));
                mysql_query("UPDATE ibwf_topics SET pollid='".$pollid[0]."' WHERE id='".$tid."'");
                echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Your poll created successfully";
              }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Eroor!";
              }
                }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>There's already a poll with the same question";
          }

          }else{
             echo "<img src=\"../images/notok.gif\" alt=\"x\"/>The poll must have a question, and at least 2 options";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This 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 "<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=="addblg")
{

if(!getplusses(getuid_sid($sid))>50)
    {
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "Only 50+ plusses can add blogs<br/><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>";
      echo "</html>";
      exit();
    }
  $msgtxt = $_POST["btitle"];
  $msgtxt = $_POST["msgtxt"];
  //$qut = $_POST["qut"];
  addonline(getuid_sid($sid),"Adding a blog","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      $crdate = time();
      //$uid = getuid_sid($sid);
      $res = false;

      if((trim($msgtxt)!="")&&(trim($btitle)!=""))
      {
      $res = mysql_query("INSERT INTO ibwf_blogs SET bowner='".$uid."', bname='".$btitle."', bgdate='".$crdate."', btext='".$msgtxt."'");
      }
      if($res)
      {
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
      }

      echo "<br/><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=="addvlt")
{

if(!getplusses(getuid_sid($sid))>24)
    {
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "Only 25+ plusses can add a vault item<br/><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>";
      echo "</html>";
      exit();
    }
  $viname = $_POST["viname"];
  $vilink = $_POST["vilink"];
  //$qut = $_POST["qut"];
  addonline(getuid_sid($sid),"Adding a vault item","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      $crdate = time();
      //$uid = getuid_sid($sid);
      $res = false;

      if((trim($vilink)!="")&&(trim($viname)!=""))
      {
      $res = mysql_query("INSERT INTO ibwf_vault SET uid='".$uid."', title='".mysql_escape_string($viname)."', pudt='".$crdate."', itemurl='".$vilink."'");
      }
      if($res)
      {
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Item added Successfully";
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error adding an item";
      }

      echo "<br/><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")
{
  $shtxt = $_POST["shtxt"];

    addonline(getuid_sid($sid),"Shouting","");

      echo "<head>";
      echo "<title>$sitename</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))<50)
    {
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You should have at least 50 plusses to shout!<br/><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>";
    echo "</html>";
    exit();
    }
    if(istrashed(getuid_sid($sid)))
    {
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>Unknown error cannot shout!<br/>please try again later...<br/><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>";
    echo "</html>";
    exit();
    }else{
    $shtm = time();
    if(!isblocked($shtxt,$uid))
    {
    $res = mysql_query("INSERT INTO ibwf_shouts SET shout='".$shtxt."', shouter='".$uid."', shtime='".$shtm."'");
    $cow = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
        $cow = $cow[0]-6;
        mysql_query("UPDATE ibwf_users SET plusses='".$cow."' WHERE id='".$uid."'");
    echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Shout added successfully";
    }else{
    $bantime = time() + (30*24*60*60);
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Post Shout Message<br/><br/>";
    echo "You just shouted a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your plusses<br/>3. You are BANNED!";
        $user = getnick_sid($sid);
    mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='<b>Netfever</b> auto banned $user for spamming shoutbox', actdt='".time()."'");
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$uid."'");
    echo "</body>";
    echo "</html>";
    exit;
  }
}

    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>";
}

//////////////////////////////////////////Announce

else if($action=="annc")
{
  $antx = $_POST["antx"];
  $clid = $_GET["clid"];
    addonline(getuid_sid($sid),"Announcing","");
$cow = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    $uid = getuid_sid($sid);
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    if($cow[0]!=$uid)
    {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This is not your club!";
    }else{
      $shtxt = $shtxt;
    //$uid = getuid_sid($sid);
    $shtm = time();
    $res = mysql_query("INSERT INTO ibwf_announcements SET antext='".$antx."', clid='".$clid."', antime='".$shtm."'");
    if($res)
    {
    echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Announcement Added!";
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Database Error";
    }
            }
    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=="rateb")
{
  $brate = $_POST["brate"];
  $bid = $_GET["bid"];
  addonline(getuid_sid($sid),"Rating a blog","");
  //$uid = getuid_sid($sid);
  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_brate WHERE uid='".$uid."' AND blogid='".$bid."'"));
  if($vb[0]==0)
  {
    $res = mysql_query("INSERT INTO ibwf_brate SET uid='".$uid."', blogid='".$bid."', brate='".$brate."'");
    if($res)
    {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Blog rated successfully<br/>";
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
    }
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this blog before<br/>";
  }
  echo "<br/><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></body>";
  
}

else if($action=="delfgb")
{
    $mid = $_GET["mid"];
  addonline(getuid_sid($sid),"Deleting GB Message","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  if(candelgb(getuid_sid($sid), $mid))
  {
    $res = mysql_query("DELETE FROM ibwf_gbook WHERE id='".$mid."'");
    if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Message Deleted From Guestbook<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You can't delete this message";
  }
  echo "<br/><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></body>";
}

else if($action=="delvlt")
{
    $vid = $_GET["vid"];
  addonline(getuid_sid($sid),"Deleting Vault Item","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  $itemowner = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_vault WHERE id='".$vid."'"));
  if(ismod(getuid_sid($sid))||getuid_sid($sid)==$itemowner[0])
  {
    $res = mysql_query("DELETE FROM ibwf_vault WHERE id='".$vid."'");
    if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Item Deleted From Vault<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You can't delete this item";
  }
  echo "<br/><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></body>";
}

else if($action=="delbl")
{
    $bid = $_GET["bid"];
  addonline(getuid_sid($sid),"Deleting A Blog","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  if(candelbl(getuid_sid($sid), $bid))
  {
    $res = mysql_query("DELETE FROM ibwf_blogs WHERE id='".$bid."'");
    if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Blog Deleted<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You can't delete this blog";
  }
  echo "<br/><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></body>";
}
else if($action=="rpost")
{
  $pid = $_GET["pid"];
  addonline(getuid_sid($sid),"Reporting Post","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  $pinfo = mysql_fetch_array(mysql_query("SELECT reported FROM ibwf_posts WHERE id='".$pid."'"));
          if($pinfo[0]=="0")
          {
          $str = mysql_query("UPDATE ibwf_posts SET reported='1' WHERE id='".$pid."' ");
          if($str)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Post reported to mods successfully";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't report post at the moment";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Post is already reported";
          }
          echo "<br/><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></body>";
        
        
}


else if($action=="rtpc")
{
  $tid = $_GET["tid"];
  addonline(getuid_sid($sid),"Reporting Topic","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  $pinfo = mysql_fetch_array(mysql_query("SELECT reported FROM ibwf_topics WHERE id='".$tid."'"));
          if($pinfo[0]=="0")
          {
          $str = mysql_query("UPDATE ibwf_topics SET reported='1' WHERE id='".$tid."' ");
          if($str)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Topic reported to mods successfully";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't report topic at the moment";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Topic is already reported";
          }
          echo "<br/><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></body>";


}

else if($action=="bud")
{
  $todo = $_GET["todo"];
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Adding/Removing Buddy","");
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
    $unick = getnick_uid($uid);
    $tnick = getnick_uid($who);
if(isignored($uid, $who))
    {
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>";
    echo "Cannot buddy $tnick they have ignored you...<br/><br/>";
    echo "<b>9 </b><a accesskey=\"9\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist</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></body></html>";
    exit();
    }
  if($todo=="add")
  {
    if(budres($uid,$who)!=3){
    if(arebuds($uid,$who))
    {
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/>$tnick is already your buddy<br/>";
    }else if(budres($uid, $who)==0)
    {
        $res = mysql_query("INSERT INTO ibwf_buddies SET uid='".$uid."', tid='".$who."', reqdt='".time()."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>A request has been sent to $tnick<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick to your buddy list<br/>";
        }
    }
else if(budres($uid, $who)==1)
    {
        $res = mysql_query("UPDATE ibwf_buddies SET agreed='1' WHERE uid='".$who."' AND tid='".$uid."'");
        if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>$tnick Added to your buddy list successfully<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick to your buddy list<br/>";
        }
    }
    else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick to your buddy list<br/>";
    }
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick to your buddy list<br/>";
    }
  }else if($todo="del")
  {
    
        
      
      $res= mysql_query("DELETE FROM ibwf_buddies WHERE (uid='".$uid."' AND tid='".$who."') OR (uid='".$who."' AND tid='".$uid."')");
      if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>$tnick removed from your buddy list<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>can't remove $tnick from your buddy list<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></body>";
}

//////////////////////////////////////////Update buddy message
else if($action=="upbmsg")
{
    addonline(getuid_sid($sid),"Updating Buddy message","");
    $bmsg = $_POST["bmsg"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $res = mysql_query("UPDATE ibwf_users SET budmsg='".$bmsg."' WHERE id='".$uid."'");
  if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Buddy message updated successfully<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>can't update your buddy message<br/>";
        }
        echo "<br/>";
echo "<b>9 </b><a accesskey=\"9\" href=\"lists.php?action=buds&amp;sid=$sid\">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>";
}

//////////////////////////////////////////Select Avatar
else if($action=="upav")
{
    addonline(getuid_sid($sid),"Updating Avatar","");
    $avid = $_GET["avid"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $avlnk = mysql_fetch_array(mysql_query("SELECT avlink FROM ibwf_avatars WHERE id='".$avid."'"));
  $res = mysql_query("UPDATE ibwf_users SET avatar='".$avlnk[0]."' WHERE id='".$uid."'");
  if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Avatar Selected<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
        echo "<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>";
}

//////////////////////////////////////////Select Avatar
else if($action=="upcm")
{
    addonline(getuid_sid($sid),"Updating Chatmood","");
    $cmid = $_GET["cmid"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $res = mysql_query("UPDATE ibwf_users SET chmood='".$cmid."' WHERE id='".$uid."'");
  if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Mood Selected<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
        echo "<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>";
}

//////////////////////////////////////////Give GPs
else if($action=="givegp")
{
    addonline(getuid_sid($sid),"Giving Game Plusses","");
    $who = $_GET["who"];
    $ptg = $_POST["ptg"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $gpsf = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"));
  $gpst = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$who."'"));
  if($gpsf[0]>=$ptg){
    $gpsf = $gpsf[0]-$ptg;
    $gpst = $gpst[0]+$ptg;
    $res = mysql_query("UPDATE ibwf_users SET gplus='".$gpst."' WHERE id='".$who."'");
  if($res)
        {
          $res = mysql_query("UPDATE ibwf_users SET gplus='".$gpsf."' WHERE id='".$uid."'");
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Game Plusses Updated Successfully<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
      }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You don't have enough GPs to give<br/>";
        }

        echo "<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>";
}

//////////////////// add club

else if($action=="addcl")
{
    addonline(getuid_sid($sid),"Adding Club","");
    $clnm = trim($_POST["clnm"]);
    $clnm = str_replace("$", "", $clnm);
    $clds = trim($_POST["clds"]);
    $clds = str_replace("$", "", $clds);
    $clrl = trim($_POST["clrl"]);
    $clrl = str_replace("$", "", $clrl);
    $cllg = trim($_POST["cllg"]);
    $cllg = str_replace("$", "", $cllg);
      echo "<head>";
      echo "<title>$sitename</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(getplusses($uid)>=500)
    {
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
      if($noi[0]<3)
      {
        if(($clnm=="")||($clds=="")||($clrl==""))
        {
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Please be sure to fill, club name, description and rules";
        }else{
          $nmex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE name LIKE '".$clnm."'"));
          if($nmex[0]>0)
          {
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Club Name Already exist";
          }else{
            $res = mysql_query("INSERT INTO ibwf_clubs SET name='".$clnm."', owner='".$uid."', description='".$clds."', rules='".$clrl."', logo='".$cllg."', plusses='0', created='".time()."'");
            if($res)
            {
              $clid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_clubs WHERE owner='".$uid."' AND name='".$clnm."'"));
                echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Congratulations! you have your own club, your own rules, message board, chatroom, announcements board, 50 club points also for you";
                mysql_query("INSERT INTO ibwf_clubmembers SET uid='".$uid."', clid='".$clid[0]."', accepted='1', points='50', joined='".time()."'");
                //$ups = getplusses($uid);
                //$ups += 5;
                //mysql_query("UPDATE ibwf_users SET plusses='".$ups."' WHERE id='".$uid."'");
                $fnm = $clnm;
                $cnm = $clnm;
                mysql_query("INSERT INTO ibwf_forums SET name='".$fnm."', position='0', cid='0', clubid='".$clid[0]."'");
                mysql_query("INSERT INTO ibwf_rooms SET name='".$cnm."', pass='', static='1', mage='0', chposts='0', perms='0', censord='0', freaky='0', lastmsg='".time()."', clubid='".$clid[0]."'");
            }else{
                echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Database Error!";
            }
          }
        }
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You already have 3 clubs";
      }
      }else{

      echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You cant add clubs";
      }

    
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 GPs
else if($action=="batp")
{
    addonline(getuid_sid($sid),"Giving Game Plusses","");
    $who = $_GET["who"];
    $ptg = $_POST["ptbp"];
    $giv = $_POST["giv"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
  $gpst = mysql_fetch_array(mysql_query("SELECT battlep FROM ibwf_users WHERE id='".$who."'"));
  if(ismod(getuid_sid($sid))||$judg[0]>0)
  {
    if ($giv=="1")
    {
        $gpst = $gpst[0]+$ptg;
    }else{
        $gpst = $gpst[0]-$ptg;
        if($gpst<0)$gpst=0;
    }
    $res = mysql_query("UPDATE ibwf_users SET battlep='".$gpst."' WHERE id='".$who."'");
  if($res)
        {
          $vnick = getnick_uid($who);
          if ($giv=="1")
          {
            $ms1 = " Added $ptg points to ";
          }else{
            $ms1 = " removed $ptg points from ";
          }

          mysql_query("INSERT INTO ibwf_mlog SET action='bpoints', details='<b>".getnick_uid(getuid_sid($sid))."</b> $ms1  $vnick', actdt='".time()."'");
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Battle Points Updated Successfully<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }
      }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't do this<br/>";
        }

        echo "<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>";
}

/////////////////////////////Add remove from ignoire list

else if($action=="ign")
{
    addonline(getuid_sid($sid),"Updating ignore list","");
    $todo = $_GET["todo"];
    $who = $_GET["who"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $tnick = getnick_uid($who);
  if($todo=="add")
  {
    if(ignoreres($uid, $who)==1)
    {
      $res= mysql_query("INSERT INTO ibwf_ignore SET name='".$uid."', target='".$who."'");
    if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>$tnick was added successfully to your ignore list<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Error Updating Database<br/>";
        }
    }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't Add $tnick to your ignore list<br/>";
    }
  }else if($todo="del")
  {
    if(ignoreres($uid, $who)==2)
    {
      $res= mysql_query("DELETE FROM ibwf_ignore WHERE name='".$uid."' AND target='".$who."'");
      if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>$tnick was deleted successfully from your ignore list<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Error Updating Database<br/>";
        }
      }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>$tnick is not ignored by you<br/>";
      }
  }
  echo "<br/><b>9 </b><a accesskey=\"9\" href=\"lists.php?action=ignl&amp;sid=$sid\">Ignore 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>";
}

//////////////////////////////////////////Update profile
else if($action=="uprof")
{
    addonline(getuid_sid($sid),"Updating Settings","");
    $savat = $_POST["savat"];
    $semail = $_POST["semail"];
    $ubday = $_POST["ubday"];
    $uloc = $_POST["uloc"];
    $usig = $_POST["usig"];
    $usex = $_POST["usex"];
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $res = mysql_query("UPDATE ibwf_users SET avatar='".$savat."', email='".$semail."', birthday='".$ubday."', location='".$uloc."', signature='".$usig."', sex='".$usex."' WHERE id='".$uid."'");
  if($res)
  {
    echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Your profile was updated successfully<br/>";
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Error updating your profile<br/>";
  }
  echo "<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></body>";
}
////////////////////////////////////////SELECT AVATAR
else if($action=="upavg")
{
  $avsrc = $_GET["avsrc"];

  addonline(getuid_sid($sid),"Updating Avatar - xHTML:v3","");
  echo "<head>";
      echo "<title>Updating Avatar - xHTML:v3</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";  
  $res = mysql_query("UPDATE ibwf_users SET avatar='".$avsrc."' WHERE id='".$uid."'");
  if($res)
        {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Avatar Selected<br/>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
        }

  echo "</p>";
  
  echo "</body>";
}

//////////////////////////////////////////Update profile
else if($action=="shsml")
{
    addonline(getuid_sid($sid),"Updating Smilies","");
    $act = $_GET["act"];
    $acts = ($act=="dis" ? 0 : 1);
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  //$uid = getuid_sid($sid);
  $res = mysql_query("UPDATE ibwf_users SET hvia='".$acts."' WHERE id='".$uid."'");
  if($res)
  {
    echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Smilies Visibility updated successfully<br/>";
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Error updating your profile<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></body>";
}

//////////////////////////////////////////Change Password

else if($action=="upwd")
{
  addonline(getuid_sid($sid),"Updating Password","");
  $opwd = $_POST["opwd"];
  $npwd = $_POST["npwd"];
  $cpwd = $_POST["cpwd"];
  $pwd = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_users WHERE id='".$uid."'"));
  $epwd = md5($opwd);
  echo "<head>";
  echo "<title>$sitename</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($npwd!=$cpwd)
  {
  echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Your Password And Confirm Password Doesn't Match<br/>";
  }else if($epwd!=$pwd[0]){
  echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Your Old Password Is Incorrect<br/>";
  }else if((strlen($npwd)<3) || (strlen($npwd)>15)){
  echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Your Password Should Be Between 3 And 15 Characters<br/>";
  }else{
    $pwd = md5($npwd);
    $res = mysql_query("UPDATE ibwf_users SET pass='".$pwd."' WHERE id='".$uid."'");
    if($res)
  {
    echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Your password was updated successfully<br/>";
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Error updating your password<br/>";
  }
  }
  echo "<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></body>";
}
else{
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  echo "I don't know how did you get into here, but there's nothing to show<br/><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></body>";
}
?>
</html>