genproc error

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

    genproc error

    hey guys im now getting headache of this damn genproc can anyone see where i made my mistake now when i update my settings or anything make a shout it shout a empty shout and the one u made and in profile it dnt update the settings
    Code:
    <?php
    include("xhtmlfunctions.php");
    header("Content-type: text/html; charset=ISO-8859-1");
    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    ?>
    
    <?php
    include("config.php");
    include("core.php");
    include("language.php");
    connectdb();
    $action = $_GET["action"];
    $sid = $_GET["sid"];
    $uid = getuid_sid($sid);
        if((islogged($sid)==false)||($uid==0))
        {
          $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          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 xhtmlfoot();
          exit();
        }
    if($action=="newtopic")
    {
      $fid = $_POST["fid"];
      $ntitle = $_POST["ntitle"];
      $tpctxt = $_POST["tpctxt"];
      if(!canaccess(getuid_sid($sid), $fid))
        {
      $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          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 xhtmlfoot();
          exit();
        }
      addonline(getuid_sid($sid),"Created New Topic","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          echo "<p align=\"center\">";
          $crdate = (time() - $timeadjust) + $timeadjust;
          //$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() - $timeadjust)-$ltopic[0] + $timeadjust;
            if($antiflood>$topic_af)
    {
      if((trim($ntitle)!="")||(trim($tpctxt)!=""))
          {
          $res = mysql_query("INSERT INTO ibwf_topics SET name='".$ntitle."', fid='".$fid."', authorid='".$uid."', text='".$tpctxt."', crdate='".$crdate."', lastpost='".$crdate."'");
         }
           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/>";
              $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
          echo "</p>";
      echo xhtmlfoot();
    }
    ////////////////////////////////////////////////////////////////
    else if($action=="upmood")
    {$pstyle = gettheme($sid);
    
          echo xhtmlhead("$stitle",$pstyle);
         addonline(getuid_sid($sid),"Updating My Mood","");
    $mmsg = $_POST["mmsg"];
    
          echo "<head>";
        echo "<title>Set OnlineList Mood</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/style.css\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
           $res = mysql_query("UPDATE ibwf_users SET setmood='".$mmsg."' WHERE id='".$uid."'");
      if($res)
            {
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Mood updated successfully<br/>";
            }else{
              echo "<img src=\"images/notok.gif\" alt=\"x\"/>Can't update your Mood<br/>";
            }
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    ////////////////////////////////////////////////////////////////
    else if($action=="rate")
    {
      $rate= mysql_real_escape_string( $_REQUEST["rate"] );
      $bid = mysql_real_escape_string( $_REQUEST["bid"] );
      $who = mysql_real_escape_string( $_REQUEST["who"] );
    
       addonline(getuid_sid($sid),"Rating a member","");
    
    
    if ($uid==$who)
    {
           $pstyle = gettheme($sid);
          echo xhtmlhead("Rate User",$pstyle);
          echo "<body>";
          echo "<p align=\"center\">";
          echo "You Cant Rate Yourself Silly<br/>";
      echo "<a href=\"index.php?action=main\">";
    echo "Main Page</a><br/>";
          echo "</p></body></html>";
          exit();
    }
    
       $pstyle = gettheme($sid);
          echo xhtmlhead("Rate User",$pstyle);
          echo "<body>";
           echo "<p align=\"center\">";
    
    $addplus = mysql_fetch_array(mysql_query("SELECT rate FROM ibwf_users WHERE id='".$who."'"));
    
    
    $add = $rate;
    $addplus = $add + $addplus[0];
    $res = mysql_query("UPDATE ibwf_users SET rate= '".$addplus."' WHERE id='".$who."'");
      if($res)
       {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/> rated successfully<br/>";
       }else {
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this user before<br/>";
       }
    
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Main Page</a><br/>";
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    //////////////////////////////////////////Bookmark Topic/////////////////////////
    
    else if($action=="bkmrk")
    
    {
    addonline(getuid_sid($sid),"Bookmarking a Topic","");
     $pstyle = gettheme($sid);
          echo xhtmlhead("Bookmarks",$pstyle);
        $tpcid = $_GET["tid"];
    
        $uid = getuid_sid($sid);
    
        $indiatime = time() + (addhours());
    
        $blah = "SELECT name FROM ibwf_topics WHERE id = '".$tpcid."'";
    
        $blah2 = mysql_query($blah);
    
        while($blah3=mysql_fetch_array($blah2)){
    
        $topicname=$blah3[0];
    
        }
    
    
    
        $sql = "SELECT COUNT(*) FROM ibwf_bookmarks WHERE userid='".$uid."'";
    
        $result = mysql_query($sql);
    
        while($blah4=mysql_fetch_array($result))
    
    {
    
        $used=$blah4[0];
    
    }
    
    
    
    
    
      if($used=='50')
    
    
    
    {
    
         echo "<img src=\"images/notok.gif\" alt=\"x\"/><b> Unable To Bookmark Topic!</b><br/>";
    
    
    
        echo "<br/>You have reached the limit of total Bookmarks Allowed!<br/>Delete existing bookmarks if you want to bookmark more topics!";;;;;
    
        echo "<br/><br/><a href=\"index.php?action=viewtpc&amp;tid=$tpcid&amp;sid=$sid\">Back To Topic</a><br/><br/>";
    
    
    
    
    
        echo "</div></div></font></body></html>";
    
        exit();
    
    }
    
    else {
    
      $res = "INSERT INTO `ibwf_bookmarks` (`userid` ,`topic` ,`name` ,`time`) VALUES ('".$uid."', '".$tpcid."', '".$topicname."', '".$indiatime."')";
    
      $result = mysql_query($res) or die("<img src=\"images/notok.gif\" alt=\"x\"/><b>Unable To Bookmark Topic!</b><br/><br/>
    
      <b>Possible Reasons could be -</b> <br/>»You Have Already Bookmarked This Topic!<br/>
    
      »You Have Reached The Limit Of Total Allowed Bookmarks!<br/>
    
     »Other Unknown Error!<br/>
    
     <br/><a href=\"index.php?action=viewtpc&amp;tid=$tpcid&amp;sid=$sid\">Back To Topic</a><br/><br/>
    
    </center></div></div></font></body></html>
    
     ");
    
    
    
      if($res)
    
     {
    
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Topic Bookmarked successfully!<br/>";
    
                echo "<br/><a href=\"index.php?action=viewtpc&amp;tid=$tpcid&amp;sid=$sid\">Back To Topic</a>";
    
                echo "<br/><br/><a href=\"index.php?action=bookmarks&amp;sid=$sid\">Go To Bookmarks</a><br/>";
    
    
    
     }
    
        else
    
            {
    
                echo "<img src=\"images/notok.gif\" alt=\"x\"/>Unable To Bookmark Topic!<br/>";
    
                echo "<br/><a href=\"index.php?action=viewtpc&amp;tid=$tpcid&amp;sid=$sid\">Back To Topic</a>";
    echo "<a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
            echo "</p>";
      echo xhtmlfoot();
              exit();
        }
    }}
    /////////////////////////Delete Bookmark////////////////////////
    else if($action=="kaltibkmrk")
    {
     $pstyle = gettheme($sid);
          echo xhtmlhead("Bookmarks",$pstyle);
    addonline(getuid_sid($sid),"Deleting a Bookmark","");
    
    $tpcid=$_GET["tpcid"];
    
    $sql="DELETE FROM `ibwf_bookmarks` WHERE `id`='$tpcid'";
    
    $res = mysql_query($sql);
    
    if($res){
    
    echo "<img src=\"images/ok.gif\" alt=\"O\"/>Bookmark deleted!";
    
    }else{
    
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Deleting Bookmark!";
    
    }
    
    echo "<br/><br/><center><a href=\"index.php?action=bookmarks&amp;sid=$sid\">Back To Bookmarks</a></center><br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
            echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    /////////////////////////////////////////////
    else if($action=="viewgallery")
    {
     $pstyle = gettheme($sid);
          echo xhtmlhead("View Gallery",$pstyle);
    addonline(getuid_sid($sid),"Gallery","");
    $act = $_GET["act"];
    $acts = ($act=="dis" ? 0 : 1);
    echo "<p align=\"center\">";
    //$uid = getuid_sid($sid);
    $res = mysql_query("UPDATE ibwf_users SET viewgallery='".$acts."' WHERE id='".$uid."'");
    if($res)
    {
    echo "<img src=\"images/ok.gif\" alt=\"o\"/>Gallery Made Private!<br/>";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>
    Gallery cant be made private!<br/>";
    }
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
            echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    
    /////////////////////////////////////////////
    else if($action=="viewinbox")
    {
    $pstyle = gettheme($sid);
          echo xhtmlhead("View Inbox",$pstyle);
    addonline(getuid_sid($sid),"Inbox","");
    $act = $_GET["act"];
    $acts = ($act=="dis" ? 0 : 1);
    echo "<p align=\"center\">";
    //$uid = getuid_sid($sid);
    $res = mysql_query("UPDATE ibwf_users SET viewinbox='".$acts."' WHERE id='".$uid."'");
    if($res)
    {
    echo "<img src=\"images/ok.gif\" alt=\"o\"/>Inbox Made private!<br/>";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>
    You cant make profile private!<br/>";
    }
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
            echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    
    else if($action=="addfile")
    {
    
    if(!getplusses(getuid_sid($sid))>24)
    {
    echo "<card id=\"main\" title=\"Downloads\">";
    echo "<p align=\"center\">";
    echo "Only 25+ plusses can add a vault item<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
    echo "</p>";
    echo xhtmlfoot();
    }
    $viname = $_POST["viname"];
    $vilink = $_POST["vilink"];
    //$qut = $_POST["qut"];
    addonline(getuid_sid($sid),"Vip panel","");
    echo "<card id=\"main\" title=\"Forum\">";
    echo "<p align=\"center\">";
    $crdate = time();
    //$uid = getuid_sid($sid);
    $res = false;
    
    if((trim($vilink)!="")&&(trim($viname)!=""))
    {
    $res = mysql_query("INSERT INTO ibwf_file SET uid='".$uid."', title='".mysql_escape_string($viname)."', pudt='".$crdate."', itemurl='".$vilink."'");
    }
    if($res)
    {
    echo "<img src=\"images/ok.gif\" alt=\"O\"/>adding file!";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Failed adding file!";
    }
    
    
    echo "<br/><br/>";
    echo "<a href=\"lists.php?action=file&amp;sid=$sid\">VIP Download</a><br/>";
    $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/> <a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
    
    }
    
    else if($action=="uploadfile")
    {
    
    if(!getplusses(getuid_sid($sid))>24)
    {
    echo "<card id=\"main\" title=\"Dodaj fajl\">";
    echo "<p align=\"center\">";
    echo "Treba vam minimum 25 pluseva da bi ste uploadovali fajl!<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
    echo "</p>";
    echo xhtmlfoot();
    }
    $flname = $_POST["flname"];
    $myfile = $_POST["myfile"];
    addonline(getuid_sid($sid),"Uploade file","");
    echo "<card id=\"main\" title=\"Forum\">";
    echo "<p align=\"center\">";
    $crdate = time();
    $res = false;
    
    if(trim($flname) != "")
    {
    $FileName = $_FILES["myfile"]["name"];
    $TempName = $_FILES["myfile"]["tmp_name"];
    $MoveTheFile = @move_uploaded_file($TempName, "./files/" . $FileName . "");
    if($MoveTheFile){
    echo "Fajl uploadovan!";
    mysql_query("INSERT INTO ibwf_file SET uid='".$uid."', title='".mysql_escape_string($flname)."', pudt='".$crdate."', itemurl='http://dreamerz.co.za/files/" . $FileName . "'");
    } else {
    echo "Nemoguce uploadovati fajl!";
    }}
    
    echo "<br/><br/>";
    echo "<a href=\"lists.php?action=file&amp;sid=$sid\">VIP Download</a><br/>";
    $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/> <a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
    
    }
    else if($action=="musi")
    {
    addonline(getuid_sid($sid),"Add music","");
    $act = $_GET["act"];
    $acts = ($act=="dis" ? 0 : 1);
    $pstyle = gettheme($sid);
    echo xhtmlhead("$nazivsajta",$pstyle);
    echo "<p align=\"center\">";
    //$uid = getuid_sid($sid);
    $res = mysql_query("UPDATE ibwf_users SET showmusic='".$acts."' WHERE id='".$uid."'");
    if($res)
    {
    echo "<img src=\"images/ok.gif\" alt=\"o\"/>Music Are Activated!<br/>";
    
    
    
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>Error Adding music to profile!<br/>";
    }
    echo "<br/><img src=\"images/home.gif\" alt=\"*\"/> <a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
    exit();
    }
    //////////////////////////////////////////
    else if($action=="upmusic")
    {
    addonline(getuid_sid($sid),"Updating music","");
    $musicid = $_GET["musicid"];
    
    $musiclink = $_POST["musiclink"];
    $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
    echo "<p align=\"center\">";
    //$uid = getuid_sid($sid);
    $musiclink = mysql_fetch_array(mysql_query("SELECT musiclink FROM ibwf_music WHERE id='".$musicid."'"));
    $res = mysql_query("UPDATE ibwf_users SET music='".$musiclink[0]."' WHERE id='".$uid."'");
    if($res)
    {
    echo "<img src=\"images/ok.gif\" alt=\"o\"/>Music Selected<br/>";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>Error!<br/>";
    }
    echo "<br/>";
    
    $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    
    echo "</p>";
    echo xhtmlfoot();
    exit();
    }
    /////////////////////////////////////////////
    else if($action=="viewpro")
    {
     $pstyle = gettheme($sid);
          echo xhtmlhead("View Profile",$pstyle);
    addonline(getuid_sid($sid),"Profil","");
    $act = $_GET["act"];
    $acts = ($act=="dis" ? 0 : 1);
    echo "<p align=\"center\">";
    //$uid = getuid_sid($sid);
    $res = mysql_query("UPDATE ibwf_users SET viewpro='".$acts."' WHERE id='".$uid."'");
    if($res)
    {
    echo "<img src=\"images/ok.gif\" alt=\"o\"/>Profile changed!<br/>";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>
    It's impossible to update your profile!<br/>";
    }
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
            echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    
    ////////////////////////////////////////////////////////////////
    
    else if($action=="updtthme")
    {
      addonline(getuid_sid($sid),"Update Profile theme","");
      $theme = $_POST["thms"];
      $size = $_POST["size"];
      $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 "<p align=\"center\">";
      echo mysql_error();
    if($res)
      {
      echo "<img src=\"images/ok.gif\" alt=\"o\"/>Updated<br/><br/><br/>";
      }else{
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!<br/><br/>";
      }
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    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]))
        {
      $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          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 "</card>";
          echo "</wml>";
          exit();
        }
      $reptxt = $_POST["reptxt"];
      $qut = $_POST["qut"];
      addonline(getuid_sid($sid),"Posted A reply","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          echo "<p align=\"center\">";
          $crdate = (time() - $timeadjust) + $timeadjust;
          $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() - $timeadjust)-$lpost[0] + $timeadjust;
            if($antiflood>$post_af)
    {
      if(trim($reptxt)!="")
          {
          $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'");
    }
          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."'");
            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/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;go=last\">";
    echo "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/><a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">";
    echo "$fname</a><br/>";
              $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
          echo "</p>";
      echo xhtmlfoot();
    
    }
    
    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","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("My Address",$pstyle);
        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 "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
    echo "Extended Settings</a><br/>";
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="gcp")
    {
        $clid = $_GET["clid"];
        $who = $_GET["who"];
        $giv = $_POST["giv"];
        $pnt = $_POST["pnt"];
        addonline(getuid_sid($sid),"Moderating Club Member","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Moderate Member",$pstyle);
        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\">";
    
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="gpl")
    {
        $clid = $_GET["clid"];
        $who = $_GET["who"];
        $pnt = $_POST["pnt"];
        addonline(getuid_sid($sid),"Moderating Club Member","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Moderate Member",$pstyle);
        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\">";
    
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if ($action=="upre")
    {
        $usds = $_POST["usds"];
        $usds = str_replace('"', "", $usds);
        $usds = str_replace("'", "", $usds);
        $ubon = $_POST["ubon"];
        $usxp = $_POST["usxp"];
        addonline(getuid_sid($sid),"Preferences","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Preferences",$pstyle);
        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 sitedscr='".$usds."', 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."', sitedscr='".$usds."', 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 "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
    echo "Extended Settings</a><br/>";
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if ($action=="gmset")
    {
        $ugun = $_POST["ugun"];
        $ugpw = $_POST["ugpw"];
        $ugch = $_POST["ugch"];
        addonline(getuid_sid($sid),"G-Mail Settings","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("G-Mail Settings",$pstyle);
        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() - $timeadjust) + (10*60*60))."' 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() - $timeadjust) + (10*60*60))."'");
            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 "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
    echo "Extended Settings</a><br/>";
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    ////////////thanks////////
    if($action=="thnx")
    {
      addonline(getuid_sid($sid),"Giving Thanks","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Give Thanks",$pstyle);
    	  $uid =getuid_sid($sid);
    	  $tid = $_GET["tid"];
    	  $author = $_GET["author"];
    	  $cowner = mysql_fetch_array(mysql_query("SELECT tearned FROM ibwf_users WHERE id='".$author."'"));
    	  $cowner2 = mysql_fetch_array(mysql_query("SELECT tgiven FROM ibwf_users WHERE id='".$uid."'"));
    		   $adit = ( $cowner[0]+"1");
    	    $given = mysql_query("UPDATE ibwf_users SET tearned='".$adit."' WHERE id='".$author."'");
    	   $addt2 = ( $cowner2[0]+"1");
    
      $given2 = mysql_query("UPDATE ibwf_users SET tgiven='".$addt2."' WHERE id='".$uid."'");
    
    	  $nick = getnick_uid($uid);
    		   $done = mysql_query("INSERT INTO thanksyou SET unid='".$uid."', tid='".$tid."', thanked='2'");
    	   $cowner = mysql_fetch_array(mysql_query("SELECT bywho FROM ibwf_topics WHERE id='".$tid."'"));
    	   $kgh = "$cowner[0] $nick";
    	   $res = mysql_query("UPDATE ibwf_topics SET bywho='".$kgh.",' , thanked='".$uid."' WHERE id='".$tid."'");
    	   if ($res){
    	    echo "<a href=\"index.php?action=viewtpc&tid=$tid&go=first&amp;sid=$sid\">";
    	    echo "Thanks Given Succesfully</a><br/>";
    	   }else{
    	   echo"database error.";
    	   }
    }
    ///////////////////////////////////////////////////////////
    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","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Personality",$pstyle);
        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 "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
    echo "Extended Settings</a><br/>";
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    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","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("More About Me",$pstyle);
        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 "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
    echo "Extended Settings</a><br/>";
            $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="mkroom")
    {
            $rname = mysql_escape_string($_POST["rname"]);
            $rpass = trim($_POST["rpass"]);
            addonline(getuid_sid($sid),"Creating Chatroom","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Create Room",$pstyle);
            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() - $timeadjust) + (10*60*60))."'");
            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 "<a href=\"index.php?action=uchat&amp;sid=$sid\"><img src=\"images/chat.gif\" alt=\"*\"/>Chatrooms</a><br/>";
            echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
            echo "</p>";
      echo xhtmlfoot();
    
    }
    ////////////////////////////////////////////////////////////////
    else if($action=="quizpanel")
    {
    $pstyle = gettheme($sid);
          echo xhtmlhead("Quiz",$pstyle);
       $question = $_POST["question"];
       $answer = $_POST["answer"];
    
         echo "<p align=\"center\">";
    
       $res = mysql_query("INSERT INTO ibwf_quiz SET question='".$question."', answer='".$answer."'");
          if($res)
          {
            echo "Question Added<br/>";
          }else{
            echo "Database Error<br/>";
          }
      echo "<a href=\"index.php?action=quizpanel&amp;type=send&amp;browse?start&amp;sid=$sid\">";
    echo "Quiz Panel</a><br/>";
       echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    ////////////////////////////////////////////////////////////////
    else if($action=="delquiz")
    {$pstyle = gettheme($sid);
          echo xhtmlhead("Quiz",$pstyle);
        $id = $_GET["id"];
    
      echo "<p align=\"center\">";
    
        $res = mysql_query("DELETE FROM ibwf_quiz WHERE id='".$id."'");
    
        if($res)
            {
                echo "Quiz Deleted<br/>";
            }else{
              echo "Database Error!<br/>";
            }
    
      echo "<br/><br/>";
    echo "<a href=\"index.php?action=quizpanel&amp;type=send&amp;browse?start&amp;sid=$sid\">";
    echo "Quiz Panel</a><br/>";
       echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    
    //////////////////////////////////////////Select Profile Moods
    else if($action=="uppmoods")
    {
        addonline(getuid_sid($sid),"Updating Profile Moods","");
        $pmoodid = $_GET["pmoodid"];
          echo "<head>";
          echo "<title>$sitename</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo "</head>";
    $pstyle = gettheme($sid);
          echo xhtmlhead("Moods",$pstyle);
          echo "<body>";
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
      $pmoodlnk = mysql_fetch_array(mysql_query("SELECT pmoodlink FROM ibwf_profilemood WHERE id='".$pmoodid."'"));
      $res = mysql_query("UPDATE ibwf_users SET pmood='".$pmoodlnk[0]."' WHERE id='".$uid."'");
      if($res)
            {
                echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Profile Mood Selected<br/>";
            }else{
              echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
            }
            echo "<br/>";
    
       echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    ///////////////////////////////////////Unban user
    
    else if($action=="lock")
    {
      $rid = $_GET["rid"];
    if(!iscowner(getuid_sid($sid), $rid))
        {
          echo "<title>Dreamerz</title>";
          echo "<p align=\"center\">";
          echo "lolz! Wotz ur doing? chuchu<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;type=send&amp;browse?start&amp;sid=$sid\">Main</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
     echo "<p align=\"center\">";
      $res = mysql_query("UPDATE ibwf_rooms SET locked='1' WHERE id='".$rid."'");
      if($res)
              {
                $unick = getnick_uid($who);
    
                echo "Room has been locked!";
              }else{
                echo "NAME ALREADY INSERTED";
              }
      echo "<br/><br/>";
    
     echo "<a href=\"index.php?action=chat&amp;browse?start&amp;sid=$sid\">";
    echo "Chat index</a><br/>";
       echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    
    ///////////////////////////////////////Unban user
    
    else if($action=="unlock")
    {
    
     $rid = $_GET["rid"];
     if(!iscowner(getuid_sid($sid), $rid))
        {
          echo "<title>Dreamerz</title>";
          echo "<p align=\"center\">";
          echo "lolz! Wotz ur doing? chuchu<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;type=send&amp;browse?start&amp;sid=$sid\">Main</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
      echo "<p align=\"center\">";
      $res = mysql_query("UPDATE ibwf_rooms SET locked='0' WHERE id='".$rid."'");
      if($res)
              {
    
    
                echo "Room has been unlocked!";
              }else{
                echo "Database Error";
              }
      echo "<br/><br/>";
    
     echo "<a href=\"index.php?action=chat&amp;browse?start&amp;sid=$sid\">";
    echo "Chat index</a><br/>";
    
         echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
       exit();
        }
    ////////////////////////////////////////////////////////////////
    else if($action=="signgb")
    {
        $who = $_POST["who"];
    
    if(!cansigngb(getuid_sid($sid), $who))
        {
      $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          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 xhtmlfoot();
          exit();
        }
      $msgtxt = $_POST["msgtxt"];
      //$qut = $_POST["qut"];
      addonline(getuid_sid($sid),"Signing a guestbook","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          echo "<p align=\"center\">";
          $crdate = (time() - $timeadjust) + $timeadjust;
          //$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 successfully added!";
    $pmtext = "Have being signed in your guest book  [br/][br/][small][b][i]    This is an automated message and do not respond to it[/i][/b] [/small]";
    $tm = time();
    $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$uid."', touid='".$who."', timesent='".$tm."'");
    
    
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Impossible to enter a message!";
          }
          echo "<br/><br/>";
              $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
          echo "</p>";
      echo xhtmlfoot();
    
       exit();
        }
    else if($action=="votepl")
    {
      //$uid = getuid_sid($sid);
      $plid = $_GET["plid"];
      $ans = $_GET["ans"];
      addonline(getuid_sid($sid),"Poll Voting ;)","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Poll Voting",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\";/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="dlpoll")
    {
      //$uid = getuid_sid($sid);
      addonline(getuid_sid($sid),"Deleting Poll","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Delete Poll",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="delan")
    {
      //$uid = getuid_sid($sid);
      addonline(getuid_sid($sid),"Deleting Announcement","");
      $pstyle = gettheme($sid);
          echo xhtmlhead("Delete Announcement",$pstyle);
    
      $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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="dlcl")
    {
      //$uid = getuid_sid($sid);
      addonline(getuid_sid($sid),"Deleting Club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Delete Club",$pstyle);
      $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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="pws")
    {
      //$uid = getuid_sid($sid);
      addonline(getuid_sid($sid),"Updating PWS","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("P.W.S",$pstyle);
      $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://$stitle.freehostia.com/chatforum/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 "<a href=\"users?".getnick_uid($uid)."\">View Your Site</a>";
        }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!";
        }
        echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="dltpl")
    {
      //$uid = getuid_sid($sid);
      $tid = $_GET["tid"];
      addonline(getuid_sid($sid),"Deleting Poll","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Delete Poll",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="reqjc")
    {
      //$uid = getuid_sid($sid);
      $clid = $_GET["clid"];
      addonline(getuid_sid($sid),"Joining A Club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Join Club",$pstyle);
        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";
    $clinfo = mysql_fetch_array(mysql_query("SELECT name, owner FROM ibwf_clubs WHERE id='".$clid."'"));
    $pmtext = "I wanna join your [club=$clid]$clinfo[0] [/club] club[br/][br/][small](this is an auto pm)[/small]";
    $tm = time();
    $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$uid."', touid='".$clinfo[1]."', timesent='".$tm."'");
    }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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="unjc")
    {
      //$uid = getuid_sid($sid);
      $clid = $_GET["clid"];
      addonline(getuid_sid($sid),"Unjoining club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Join Club",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="acm")
    {
      //$uid = getuid_sid($sid);
      $clid = $_GET["clid"];
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Adding a member to club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Add Member",$pstyle);
        echo "<p align=\"center\">";
     $uid = getuid_sid($sid);
    $cowner = mysql_fetch_array(mysql_query("SELECT owner, name 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";
    
    $pmtext = "You are now a member of the [club=$clid]$cowner[1] [/club] club[br/][br/][small](this is an auto pm)[/small]";
    $tm = time();
    $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$uid."', touid='".$who."', timesent='".$tm."'");
    
    
    
    }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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="accall")
    {
      //$uid = getuid_sid($sid);
      $clid = $_GET["clid"];
    
      addonline(getuid_sid($sid),"Adding a member to club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Add Member",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="denall")
    {
      //$uid = getuid_sid($sid);
      $clid = $_GET["clid"];
    
      addonline(getuid_sid($sid),"Adding a member to club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Add Member",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="dcm")
    {
      //$uid = getuid_sid($sid);
      $clid = $_GET["clid"];
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Deleting a member from club","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Delete Member",$pstyle);
        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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="crpoll")
    {
      addonline(getuid_sid($sid),"Creating Poll","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Create Poll",$pstyle);
        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() - $timeadjust) + (10*60*60))."'");
                  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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="pltpc")
    {
      $tid = $_GET["tid"];
      addonline(getuid_sid($sid),"Creating Poll","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("Create Poll",$pstyle);
        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() - $timeadjust) + (10*60*60))."'");
                  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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="addblg")
    {
    
    if(!getplusses(getuid_sid($sid))>50)
        {
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          echo "<p align=\"center\">";
          echo "Only 50+ Credits can add blogs<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
      echo xhtmlfoot();
          exit();
        }
      $msgtxt = $_POST["btitle"];
      $msgtxt = $_POST["msgtxt"];
      //$qut = $_POST["qut"];
      addonline(getuid_sid($sid),"Adding a blog","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          echo "<p align=\"center\">";
          $crdate = (time() - $timeadjust) + $timeadjust;
          //$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/>";
              $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
          echo "</p>";
      echo xhtmlfoot();
    
    }
    
    else if($action=="addvlt")
    {
    
    if(!getplusses(getuid_sid($sid))>24)
        {
            echo "<card id=\"main\" title=\"$stitle\">";
          echo "<p align=\"center\">";
          echo "Only 25+ plusses can add a vault item<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
      echo xhtmlfoot();
          exit();
        }
      $viname = $_POST["viname"];
      $vilink = $_POST["vilink"];
      //$qut = $_POST["qut"];
      addonline(getuid_sid($sid),"Adding a vault item","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
          echo "<p align=\"center\">";
          $crdate = (time() - $timeadjust);
          //$uid = getuid_sid($sid);
          $res = false;
    
          $ext = getext($vilink);
          if ($ext=="mp3" or $ext=="amr" or $ext=="wav") {
          $type = 1;
          }
          if ($ext=="jpg" or $ext=="gif" or $ext=="png" or $ext=="bmp") {
          $type = 2;
          }
          if ($ext=="jad" or $ext=="jar") {
          $type = 3;
          }
          if ($ext=="mpg" or $ext=="3gp" or $ext=="mp4") {
          $type = 4;
          }
          if((trim($vilink)!="")&&(trim($viname)!=""))
          {
          $res = mysql_query("INSERT INTO ibwf_vault SET uid='".$uid."', title='".mysql_escape_string($viname)."', pudt='".(time() - $timeadjust)."', itemurl='".$vilink."', type='".$type."'");
          }
          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/>";
              $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
          echo "</p>";
      echo xhtmlfoot();
    
    }
    /*
    //////////////////////////////////////////shout
    
    else if($action=="shout")
    {
      $shtxt = cleanQuery($_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 "<div align=\"center\">";
      {
          echo "<meta http-equiv=\"refresh\" content=\"2; url=main.php?time=";
          echo "".date("dmHis")."";
          echo "&amp;sid=$sid&amp;action=shout\">";
          }
    
        $who= cleanQuery($_GET["whoid"]);
        $whoid= cleanQuery($_GET["who"]);
        if(gettoken(getuid_sid($sid))<1)
        {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>You Need A token to shout!<br/><br/>";
            echo "<a href=\"index.php?action=main&amp;sid=$sid\">©$stitle</a>";
        echo "</div>";
        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 "<a href=\"index.php?action=main&amp;sid=$sid\">©$sitename</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        }
        if(strlen($shtxt)<5)
        {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>Error..<br/><br/><br/>";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">©$sitename</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        }
    
        $text = parsepm($shtxt, $sid);
        $nos = substr_count($text,"<img src=");
        if($nos>2)
        {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>error<br/><br/>";
        echo "<a href=\"main.php?action=shout&amp;sid=$sid\">Back Shout</a><br/>";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">©$stitle</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        }
        $tm = time();
        $lastsht = mysql_fetch_array(mysql_query("SELECT MAX(shtime) FROM ibwf_shouts WHERE shouter='".$uid."'"));
        $pmfl = $lastsht[0]+getpmaf();
        if($byuid==1)$pmfl=0;
        if($pmfl>$tm)
        {
        $rema = $pmfl - $tm;
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
        echo "Flood control: $rema Seconds<br/><br/>";
        echo "<a href=\"main.php?action=shout&amp;sid=$sid\">Back Shout</a><br/>";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">©$stitle</a>";
        echo "</div></body></html>";
        exit();
            }
         if(isblocked($shtxt,$uid))
        {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>Unknown error cannot shout!<br/>please try again later...<br/><br/>";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">©$sitename</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        } else{
    
        $tokan = mysql_fetch_array(mysql_query("SELECT tokan, name FROM ibwf_users WHERE id='".$uid."'"));
        $remainplus = $tokan[0]-1;
        $plussupdate = mysql_query("UPDATE ibwf_users SET tokan='".$remainplus."' WHERE id='".$uid."'");
        $shtm = time();
        $res = mysql_query("INSERT INTO ibwf_shouts SET shout='".$shtxt."', shouter='".$uid."', shtime='".$shtm."'");
        if($res)
        {
        $shts = mysql_fetch_array(mysql_query("SELECT shouts from ibwf_users WHERE id='".$uid."'"));
        $shts = $shts[0]+1;
        mysql_query("UPDATE ibwf_users SET shouts='".$shts."' WHERE id='".$uid."'");
    
        echo "<img src=\"../images/ok.gif\" alt=\"O\"/><br/>Shout added successfully<br/>";
        echo "Baki Shout Token Anda $remainplus";
        }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Database Error";
        }
    
    }
        echo "<br/><br/><a href=\"main.php?action=shout&amp;sid=$sid\">Back Shout</a><br/>";
       echo "<a href=\"index.php?action=main&amp;sid=$sid\">© $stitle</a>";
         echo "</div>";
          echo "</body>";
       exit();
        }
    */
    ////////////////////////////////////////////shout
    
    else if($action=="shout")
    {
      $shtxt = $_POST["shtxt"];
        addonline(getuid_sid($sid),"Shouting","");
    
    $pstyle = gettheme($sid);
          echo xhtmlhead("Shout",$pstyle);
        echo "<p align=\"center\">";
        echo "<meta http-equiv=Refresh content=0;url=index.php?action=main&amp;sid=$sid>";
               echo "<div class=\"bg\">";
        ?>
        <div class="head">Done</div>
        <?
    if(gettoken(getuid_sid($sid))<1)
        {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>You Need A token to shout!<br/><br/>";
            echo "<a href=\"index.php?action=main&amp;sid=$sid\">©$stitle</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        }
          $shtxt = $shtxt;
        //$uid = getuid_sid($sid);
        $shtm = (time() - $timeadjust) + $timeadjust;
        $res = mysql_query("INSERT INTO ibwf_shouts SET shout='".$shtxt."', shouter='".$uid."', shtime='".$shtm."'");
        if($res)
        {
        $shts = mysql_fetch_array(mysql_query("SELECT shouts from ibwf_users WHERE id='".$uid."'"));
        $shts = $shts[0]+1;
        mysql_query("UPDATE ibwf_users SET shouts='".$shts."' WHERE id='".$uid."'");
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Shout added successfully";
        }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
                    }
      ////// UNTILL HERE >>
        echo "<p align=\"center\">";
     echo "<div class=\"foot\"><a href=\"index.php?action=main&amp;sid=$sid\">Main menu</a>";
    
      echo "</p></div></div>";
      echo xhtmlfoot();
    exit();
    }
    //////////////////////////////////////////free shout
    
    else if($action=="shout1")
    {
      $shtxt = $_POST["shtxt"];
    
        addonline(getuid_sid($sid),"Shouting","");
    
          echo "<head>";
          echo "<title>$stitle</title>";
          echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo "</head>";
          echo "<body>";
    echo "<div align=\"center\">";
    $shtxt = $shtxt;
    //$uid = getuid_sid($sid);
    $shtm = time();
    $res = mysql_query("INSERT INTO ibwf_shouts1 SET shout='".$shtxt."', shouter='".$uid."', shtime='".$shtm."'");
    if($res)
    {
    $shts = mysql_fetch_array(mysql_query("SELECT shouts1 from ibwf_users WHERE id='".$uid."'"));
    $shts = $shts[0]+1;
    mysql_query("UPDATE ibwf_users SET shouts1='".$shts."' WHERE id='".$uid."'");
    $cow = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
    $cow = $cow[0]+20;
    mysql_query("UPDATE ibwf_users SET plusses='".$cow."' WHERE id='".$uid."'");
    echo "<img src=\"../images/ok.gif\" alt=\"\"/>Shout added successfully<br/>";
    echo "<a href=\"lists.php?action=shouts1&amp;sid=$sid\">Shoutroom</a>";
    }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Database Error";
    }
    
        echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\">© $stitle</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
    
        if(istrashed(getuid_sid($sid)))
        {
        echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>Error.<br/>.<br/><br/>";
        echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        }else{
        $shtm = time();
        if(!isblocked($shtxt,$uid))
        {
        $res = mysql_query("INSERT INTO ibwf_shouts1 SET shout='".$shtxt."', shouter='".$uid."', shtime='".$shtm."'");
    
        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 have spammed???<br/><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>ewanz</b> auto banned $user for spamming free 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/><a href=\"index.php?action=main&amp;sid=$sid\">© $stitle</a>";
         echo "</div>";
        echo "</body>";
       exit();
        }
    //////////////////////////////////////////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);
    $pstyle = gettheme($sid);
          echo xhtmlhead("Announce",$pstyle);
        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() - $timeadjust) + $timeadjust;
        $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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
        echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="rateb")
    {
      $brate = $_POST["brate"];
      $bid = $_GET["bid"];
      addonline(getuid_sid($sid),"Rating a blog","");
      //$uid = getuid_sid($sid);
    
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    
    }
    
    else if($action=="delfgb")
    {
        $mid = $_GET["mid"];
      addonline(getuid_sid($sid),"Deleting GB Message","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="delvlt")
    {
        $vid = $_GET["vid"];
      addonline(getuid_sid($sid),"Deleting Vault Item","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    else if($action=="delbl")
    {
        $bid = $_GET["bid"];
      addonline(getuid_sid($sid),"Deleting A Blog","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    else if($action=="rpost")
    {
      $pid = $_GET["pid"];
      addonline(getuid_sid($sid),"Reporting Post","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    
    
    }
    
    
    else if($action=="rtpc")
    {
      $tid = $_GET["tid"];
      addonline(getuid_sid($sid),"Reporting Topic","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    
    
    }
    
    ///////////////////////////////////////////////////////////////
    else if($action=="bud")
    {
      $todo = $_GET["todo"];
      $who = $_GET["who"];
      addonline(getuid_sid($sid),"Adding/Removing Buddy","");
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
        $unick = getnick_uid($uid);
        $tnick = getnick_uid($who);
      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() - $timeadjust) + (1*60*60))."'");
            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 Have accepted your request!";
    $pmtext = "Your Buddy Request Have been Accepted** [br/][br/]";
    $tm = time();
    $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$uid."', touid='".$who."', timesent='".$tm."'");
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>Added to your buddy list successfully!";
    }
    }
    else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>You can't add $tnick to your buddy list!";
    }
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>You can't add $tnick to your buddy list!";
    }
    }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 Is no longer your friend";
    $pmtext = "Dont wona be friends!** [br/][br/]";
    $tm = time();
    $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$uid."', touid='".$who."', timesent='".$tm."'");
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"x\"/>can't remove $tnick from your buddy list!";
    }
    
    }
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
     exit();
        }
    //////////////////////////////////////////Update buddy message
    else if($action=="upbmsg")
    {
        addonline(getuid_sid($sid),"Updating Buddy message","");
        $bmsg = $_POST["bmsg"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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 "<a href=\"lists.php?action=buds&amp;sid=$sid\">";
    echo "Buddies List</a><br/>";
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Select Avatar
    else if($action=="upav")
    {
        addonline(getuid_sid($sid),"Updating Avatar","");
        $avid = $_GET["avid"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
    
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    //////////////////////////////////////////////////////////////////////Give credits
    else if($action=="plusses")
    {
        addonline(getuid_sid($sid),"Sharing Credits","");
        $who = $_GET["who"];
        $ptg = $_POST["ptg"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
      $gpsf = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
      $gpst = mysql_fetch_array(mysql_query("SELECT plusses 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 plusses='".$gpst."' WHERE id='".$who."'");
      if($res)
            {
              $ad = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
              $res = mysql_query("UPDATE ibwf_users SET plusses='".$gpsf."' WHERE id='".$uid."'");
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Credits Updated Successfully<br/>";
    
    				$wintext = "".getnick_uid($uid)." Shared  $ptg Credits With u..Now U hv $gpst  credits![br/][i] p.s. note: This is an automatic pm from $stitle service centre[/i]";
    				$res = mysql_query("INSERT INTO ibwf_private SET text='".$wintext."', byuid='".$uid."', touid='".$who."', timesent='".time()."'");
            }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 Credits to give<br/>";
            }
    
            echo "<br/>";
    
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
     exit();
        }
    //////////////////////////////////////////Select Avatar
    else if($action=="upavg")
    {
        addonline(getuid_sid($sid),"Updating Avatar","");
        $avsrc = $_GET["avsrc"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
      $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 "<br/>";
    
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Select Avatar
    else if($action=="upcm")
    {
        addonline(getuid_sid($sid),"Updating Chatmood","");
        $cmid = $_GET["cmid"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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 "<a href=\"index.php?action=chat&amp;sid=$sid\">";
    echo "Chatrooms</a><br/>";
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Give GPs
    else if($action=="givegp")
    {
        addonline(getuid_sid($sid),"Giving Game Plusses","");
        $who = $_GET["who"];
        $ptg = $_POST["ptg"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/>";
    
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////// 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);
    $pstyle = gettheme($sid);
          echo xhtmlhead("Adding Club",$pstyle);
        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]<5)
          {
            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() - $timeadjust) + (10*60*60))."'");
                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() - $timeadjust) + (10*60*60))."'");
                    //$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() - $timeadjust) + (10*60*60))."', 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 5 clubs";
          }
          }else{
    
          echo "<img src=\"images/notok.gif\" alt=\"X\"/>You cant add clubs";
          }
    
    
        echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    //////////////////////////////////////////Give GPs
    else if($action=="batp")
    {
        addonline(getuid_sid($sid),"Giving Game Plusses","");
        $who = $_GET["who"];
        $ptg = $_POST["ptbp"];
        $giv = $_POST["giv"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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() - $timeadjust) + (10*60*60))."'");
                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/>";
    
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    /////////////////////////////Add remove from ignoire list
    
    else if($action=="ign")
    {
        addonline(getuid_sid($sid),"Updating ignore list","");
        $todo = $_GET["todo"];
        $who = $_GET["who"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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/><a href=\"lists.php?action=ignl&amp;sid=$sid\">";
    echo "Ignore List</a><br/>";
             $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Update profile
    else if($action=="uprof")
    {
        addonline(getuid_sid($sid),"Updating Settings","");
        $savat = $_POST["savat"];
        $semail = $_POST["semail"];
        $usite = $_POST["usite"];
        $ubday = $_POST["ubday"];
        $uloc = $_POST["uloc"];
        $usig = $_POST["usig"];
        $usex = $_POST["usex"];
       $rmsg = $_POST["rmsg"];
    	$umood = $_POST["umood"];
    $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
      $res = mysql_query("UPDATE ibwf_users SET avatar='".$savat."', email='".$semail."', site='".$usite."', birthday='".$ubday."', location='".$uloc."', signature='".$usig."', sex='".$usex."',fmsg='".$rmsg."', mood='".$umood."' 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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Update Site Settings
    else if($action=="ustset")
    {
        addonline(getuid_sid($sid),"Updating Settings","");
    
        $showcons = $_POST["showcons"];
        $showtime = $_POST["showtime"];
        $showshout = $_POST["showshout"];
        $theme = $_POST["theme"];
        $sitelang = $_POST["sitelang"];
        $showshortkey = $_POST["showshortkey"];
        $align2 = $_POST["align2"];
        $color = $_POST["color"];
    $ghost = $_POST["ghost"];
    $chat = $_POST["chat"];
            $shout = $_POST["shout"];
        $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
     $res = mysql_query("UPDATE ibwf_users SET hidden='".$ghost."' WHERE id='".$uid."'");
        $res = mysql_query("UPDATE ibwf_online SET hidden='".$ghost."' WHERE userid='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET showicon='".$showcons."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET showtime='".$showtime."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET showshout='".$showshout."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET themeid='".$theme."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET lang='".$sitelang."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET showshortkey='".$showshortkey."' WHERE id='".$uid."'");
     $res = mysql_query("UPDATE ibwf_users SET shout='".$shout."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET color='".$color."' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET align2='".$align2."' WHERE id='".$uid."'");
    
      if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"o\"/>Your Site Settings was updated successfully<br/>";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>Error updating your Site Settings<br/>";
      }
      echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Update profile
    else if($action=="shsml")
    {
        addonline(getuid_sid($sid),"Updating Smilies","");
        $act = $_GET["act"];
        $acts = ($act=="dis" ? 0 : 1);
        $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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 "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    //////////////////////////////////////////Change Password
    
    else if($action=="upwd")
    {
        addonline(getuid_sid($sid),"Updating Settings","");
        $npwd = $_POST["npwd"];
        $cpwd = $_POST["cpwd"];
        $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      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((strlen($npwd)<4) || (strlen($npwd)>15)){
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>Your password should be between 4 and 15 letters only<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/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p></card>";
    }
    else{
       $pstyle = gettheme($sid);
          echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      echo "I don't know how did you get into here, but there's nothing to show<br/><br/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    
    ?>
    Last edited by riderz; 01.04.10, 08:47.
    ________________
    Jacques
    jacques@gw-designs.co.za
    http://coding.biz.tm
    Come join and lets make it a place to learn all the noobies how to code
    __________________

    NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH
Working...
X