Chatroom problem

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

    Chatroom problem

    hi am having a problem with my chatroom when any body includin me uses smilies in a chat it says this "oi! pablo no spamming" y is that can u tell me how to fix that please?

    #2
    Originally posted by Pablo View Post
    hi am having a problem with my chatroom when any body includin me uses smilies in a chat it says this "oi! pablo no spamming" y is that can u tell me how to fix that please?
    i guess this is lava script.. or its mod..
    so open chat.php and READ entire file to understand it..
    other than that... learn to post topic in proper forum
    It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
    ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
    ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
    キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

    Comment


      #3
      or simple take chat.php from other similar script
      <?php unlink('World/Europe/Romania.country'); ?>

      Comment


        #4
        i have done that like a million times and i still get the same thing

        Comment


          #5
          in core you will see spam site take out who your linkin too lol
          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
          Visit: WapMasterz Coming Back Soon!
          _______
          SCRIPTS FOR SALE BY SUBZERO
          Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
          FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
          _______
          Info & Tips
          php.net
          w3schools.com

          Comment


            #6
            lol just read the coding.. .and see whats tha occurrences that triger off that msg....perhaps its cause the smiles in include http .com etc. . and those words are forbidden in the spam function. .

            R.M.C
            ----------
            PHP Adovocate B)

            Comment


              #7
              where can i find the spam function in core?

              Comment


                #8
                dont link your smilies to other sites basically.
                Wapchat4u


                Topsites4u

                Comment


                  #9
                  Originally posted by Pablo View Post
                  where can i find the spam function in core?
                  you've been told... READ chat.php... and READ core.php !
                  study how those two files cooperate to prevent multi smilie usage !
                  It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                  ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                  ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                  キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                  Comment


                    #10
                    just simple dont add smilies in ur database as http://domain.com/smilies/bla.gif but for example add it as smilies/bla.gif ....

                    problem solved...:D
                    Last edited by alesh; 06.05.09, 19:52. Reason: blah
                    sigpiceeeeerrr....

                    Comment


                      #11
                      bro its no linking any thing bro there smilies like this they should show

                      Comment


                        #12
                        Open notepad find http or .com
                        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                        Visit: WapMasterz Coming Back Soon!
                        _______
                        SCRIPTS FOR SALE BY SUBZERO
                        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                        _______
                        Info & Tips
                        php.net
                        w3schools.com

                        Comment


                          #13
                          dnt understand sub

                          Comment


                            #14
                            Originally posted by Pablo View Post
                            dnt understand sub
                            post here your core.php and chat.php:mad:
                            It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                            ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                            ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                            キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                            Comment


                              #15
                              this is my core.....


                              <?php
                              include("config.php");
                              //include("gmprc.php");
                              //session_start();
                              if(!get_magic_quotes_gpc())
                              {
                              $_GET = array_map('trim', $_GET);
                              $_POST = array_map('trim', $_POST);
                              $_COOKIE = array_map('trim', $_COOKIE);

                              $_GET = array_map('addslashes', $_GET);
                              $_POST = array_map('addslashes', $_POST);
                              $_COOKIE = array_map('addslashes', $_COOKIE);
                              }

                              function connectdb()
                              {
                              global $dbname, $dbuser, $dbhost, $dbpass;
                              $conms = @mysql_connect($dbhost,$dbuser,$dbpass); //connect mysql
                              if(!$conms) return false;
                              $condb = @mysql_select_db($dbname);
                              if(!$condb) return false;
                              return true;
                              }
                              /////register form
                              function getnewgml($uid)
                              {
                              /*
                              global $onver;
                              if($onver)
                              {
                              $doit = false;
                              $gmi = mysql_fetch_array(mysql_query("SELECT gmailun, gmailpw, gmailchk, gmaillch, timezone FROM ibwf_xinfo WHERE uid='".$uid."'"));
                              $cancheck = $gmi[2]*60;
                              $cancheck += $gmi[3];
                              if(time()>=$cancheck)
                              {
                              $doit = true;
                              }
                              if(trim($gmi[0])!="" && trim($gmi[1])!="")
                              {
                              $doit = true;
                              }
                              if ($doit)
                              {
                              if($cancheck+60>time())
                              {
                              mysql_query("UPDATE ibwf_xinfo SET gmaillch='".time()."' WHERE uid='".$uid."'");
                              }
                              return getnewm($gmi[0],$gmi[1],$gmi[4]);

                              }
                              return 0;

                              }else{
                              return 0;
                              }
                              */
                              }

                              function rating($uid)
                              {
                              $info=mysql_fetch_array(mysql_query("SELECT * FROM ibwf_users WHERE id='".$uid."'"));
                              $posts = $info["posts"];
                              $plusses = $info["plusses"];
                              $gplus = $gplus["gplus"];
                              $shouts = $shouts["shouts"];
                              $tot = $posts+$plusses+$gplus+$shouts;
                              if($tot<100){return "<img src=\"images/half.gif\" alt=\"\"/>";}
                              if($tot<250){return "<img src=\"images/one.gif\" alt=\"\"/>";}
                              if($tot<500){return "<img src=\"images/onehalf.gif\" alt=\"\"/>";}
                              if($tot<750){return "<img src=\"images/two.gif\" alt=\"\"/>";}
                              if($tot<2500){return "<img src=\"images/twohalf.gif\" alt=\"\"/>";}
                              if($tot<50000){return "<img src=\"images/three.gif\" alt=\"\"/>";}
                              if($tot<75000){return "<img src=\"images/threehalf.gif\" alt=\"\"/>";}
                              if($tot<100000){return "<img src=\"images/four.gif\" alt=\"\"/>";}
                              if($tot<150000){return "<img src=\"images/fourhalf.gif\" alt=\"\"/>";}
                              if($tot>=200000){return "<img src=\"images/five.gif\" alt=\"\"/>";}
                              if($tot>=250000){return "<img src=\"images/fivehalf.gif\" alt=\"\"/>";}
                              if($tot<300000){return "<img src=\"images/six.gif\" alt=\"\"/>";}
                              if($tot<400000){return "<img src=\"images/sixhalf.gif\" alt=\"\"/>";}
                              if($tot<450000){return "<img src=\"images/seven.gif\" alt=\"\"/>";}
                              }

                              function findcard($tcode)
                              {
                              $st =strpos($tcode,"[card=");
                              if ($st === false)
                              {
                              return $tcode;
                              }else
                              {
                              $ed =strpos($tcode,"[/card]");
                              if($ed=== false)
                              {
                              return $tcode;
                              }
                              }
                              $texth = substr($tcode,0,$st);
                              $textf = substr($tcode,$ed+7);
                              $msg = substr($tcode,$st+10,$ed-$st-10);
                              $cid = substr($tcode,$st+6,3);
                              $words = explode(' ',$msg);
                              $msg = implode('+',$words);
                              return "$texth<br/><img src=\"pmcard.php?cid=$cid&amp;msg=$msg\" alt=\"$cid\"/><br/>$textf";
                              }
                              function saveuinfo($sid)
                              {

                              $headers = apache_request_headers();
                              $alli = "";
                              foreach ($headers as $header => $value)
                              {
                              $alli .= "$header: $value <br />\n";
                              }
                              $alli .= "IP: ".$_SERVER['REMOTE_ADDR']."<br/>";
                              $alli .= "REFERRER: ".$_SERVER['HTTP_REFERER']."<br/>";
                              $alli .= "REMOTE HOST: ".getenv('REMOTE_HOST')."<br/>";
                              $alli .= "PROX: ".$_SERVER['HTTP_X_FORWARDED_FOR']."<br/>";
                              $alli .= "HOST: ".getenv('HTTP_X_FORWARDED_HOST')."<br/>";
                              $alli .= "SERV: ".getenv('HTTP_X_FORWARDED_SERVER')."<br/>";
                              if(trim($sid)!="")
                              {
                              $uid = getuid_sid($sid);
                              $fname = "tmp/".getnick_uid($uid).".rwi";
                              $out = fopen($fname,"w");
                              fwrite($out,$alli);
                              fclose($out);
                              }

                              //return 0;
                              }
                              function registerform($ef)
                              {
                              $ue = $errl = $pe = $ce = "";
                              switch($ef)
                              {
                              case 1:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type a new UserID";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 2:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your password";
                              $pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 3:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your password again";
                              $ce = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 4:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID is invalid";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 5:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Password is invalid";
                              $pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 6:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Passwords doesn't match";
                              $ce = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 7:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID must be 4 characters or more";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 8:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Password must be 4 characters or more";
                              $pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 9:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID already in use, choose a different one";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 10:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Unknown mysql error try registering later";

                              break;
                              case 11:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID must start with a letter from a-z";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 12:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID is reserved for admins of the site";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              case 13:
                              $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please choose an appropriate nickname";
                              $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
                              break;
                              }
                              $rform = "<small>$errl</small><br/><br/>";
                              $rform .= "$ue UserID: <input name=\"tfuid\" format=\"*x\" maxlength=\"15\"/><br/>";
                              $rform .= "$pe Password: <input type=\"password\" name=\"tfpwd\" format=\"*x\" maxlength=\"30\"/><br/>";
                              $rform .= "$ce Password: <input type=\"password\" name=\"tfcpw\" format=\"*x\" maxlength=\"30\"/><br/>";
                              $rform .= "Birthday: <input name=\"tfbdy\" format=\"*x\" maxlength=\"30\"/><br/>";
                              $rform .= "Sex:";
                              $rform .= "<select name=\"opsex\" value=\"S\">";
                              $rform .= "<option value=\"M\">Male</option>";
                              $rform .= "<option value=\"F\">Female</option>";
                              $rform .= "<option value=\"S\">Shemale</option>";
                              $rform .= "</select><br/>";
                              $rform .= "Location: <input name=\"tfloc\" maxlength=\"100\"/><br/>";
                              $rform .= "<anchor>Register";
                              $rform .= "<go href=\"register.php\" method=\"post\">";
                              $rform .= "<postfield name=\"uid\" value=\"$(tfuid)\"/>";
                              $rform .= "<postfield name=\"pwd\" value=\"$(tfpwd)\"/>";
                              $rform .= "<postfield name=\"cpw\" value=\"$(tfcpw)\"/>";
                              $rform .= "<postfield name=\"bdy\" value=\"$(tfbdy)\"/>";
                              $rform .= "<postfield name=\"usx\" value=\"$(opsex)\"/>";
                              $rform .= "<postfield name=\"ulc\" value=\"$(tfloc)\"/>";
                              $rform .= "</go></anchor>";
                              return $rform;
                              }


                              function getalert($sid){

                              if (alertstat($sid)==1){

                              $userid = getuid_sid($sid);

                              $count = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_private WHERE touid = $userid AND unread='1'"));

                              if($count[0]>0){

                              $lastmsg_id = mysql_fetch_array(mysql_query("SELECT MIN(id) FROM ibwf_private WHERE touid = $userid AND unread='1'"));

                              $pminfo = mysql_fetch_array(mysql_query("SELECT text, timesent, byuid, reported FROM ibwf_private WHERE id = $lastmsg_id[0]"));

                              if(isonline($pminfo[2])){

                              $iml = "<img src=\"images/onl.gif\" alt=\"On\"/>";

                              }else{

                              $iml = "<img src=\"images/ofl.gif\" alt=\"Off\"/>";

                              }

                              $msgtxt = "

                              <div class=\"boxed\">

                              <div class=\"boxedTitle\">

                              <h1 align=\"center\" class=\"boxedTitleText\"><b>Message Alert</b>

                              </h1>

                              </div>

                              <div class=\"boxedContent\">

                              ";

                              $msgtxt .= "<small><b>From</b>: $iml<a href=\"index.php?action=viewuser&amp;who=$pminfo[2]&amp;sid=$sid\">".getnick_uid($pminfo[2])."</a><br/>";

                              $tmstamp = $pminfo[1] + addhours();

                              $tmdt = date("d/m/Y h:i:s A", $tmstamp);

                              $diff1=time()-$pminfo[1];

                              $msgtxt .= "<b>Sent</b>: $tmdt<br/>".gettimemsg($diff1)."<br/>";

                              $pmtext = parsepm($pminfo[0], $sid);

                              if(isspam($pmtext)){

                              if(($pminfo[3]=="0") && ($pminfo[2]!=1)){

                              mysql_query("UPDATE ibwf_private SET reported='1' WHERE id='".$pmid."'");

                              }

                              }

                              $msgtxt .= "<b>Message</b>:<br/>".$pmtext;

                              $msgtxt .= "<u><br/>Reply:</u>:<br/>";

                              $msgtxt .= "<form action=\"inbxproc.php?action=sendpm&amp;who=$pminf o[2]&amp;sid=$sid\" method=\"post\"><textarea id=\"inputText\" name=\"pmtext\"></textarea><br/>";

                              $msgtxt .= "<input id=\"inputButton\" type=\"submit\" value=\"Send\"/>";

                              $msgtxt .= "</form>";

                              $msgtxt .= "<br/><a href=\"inbox.php?action=main&amp;sid=$sid\">Go to Inbox</a><br/></small></div></div>";

                              mysql_query("UPDATE ibwf_private SET unread='0' WHERE id = $lastmsg_id[0]");

                              echo $msgtxt;

                              return;

                              }

                              else {

                              return "";

                              }

                              }

                              else {

                              return "";

                              }

                              }function getppp($uid){

                              $ppp = mysql_fetch_array(mysql_query("SELECT ppp FROM ibwf_users WHERE id = $uid"));

                              return $ppp[0];

                              }
                              function alertstat($sid){

                              $userid=getuid_sid($sid);

                              if(!$userid){

                              return 0;

                              }

                              $alerstat = mysql_fetch_array(mysql_query("SELECT alert FROM ibwf_users WHERE id = $userid"));

                              return $alerstat[0];

                              }


                              //////////////////////////////////////////// Search Id
                              function generate_srid($svar1,$svar2="", $svar3="", $svar4="", $svar5="")
                              {

                              $res = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_search WHERE svar1 like '".$svar1."' AND svar2 like '".$svar2."' AND svar3 like '".$svar3."' AND svar4 like '".$svar4."' AND svar5 like '".$svar5."'"));
                              if($res[0]>0)
                              {
                              return $res[0];
                              }
                              mysql_query("INSERT INTO ibwf_search SET svar1='".$svar1."', svar2='".$svar2."', svar3='".$svar3."', svar4='".$svar4."', svar5='".$svar5."', stime='".time()."'");
                              $res = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_search WHERE svar1 like '".$svar1."' AND svar2 like '".$svar2."' AND svar3 like '".$svar3."' AND svar4 like '".$svar4."' AND svar5 like '".$svar5."'"));
                              return $res[0];
                              }

                              function candelvl($uid, $item)
                              {
                              $candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_vault WHERE id='".$item."'"));
                              if($uid==$candoit[0]||ismod($uid))
                              {
                              return true;
                              }
                              return false;
                              }

                              /////////////////////////////////// GET RATE

                              function geturate($uid)
                              {
                              $pnts = 0;
                              //by blogs, posts per day, chats per day, gb signatures
                              if(ismod($uid))
                              {
                              return 5;
                              }
                              $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$uid."'"));
                              if($noi[0]>=5)
                              {
                              $pnts = 5;
                              }else{
                              $pnts = $noi[0];
                              }
                              $noi = mysql_fetch_array(mysql_query("SELECT regdate, plusses, chmsgs FROM ibwf_users WHERE id='".$uid."'"));
                              $rwage = ceil((time()- $noi[0])/(24*60*60));
                              $ppd = ceil($noi[1]/$rwage);
                              if($ppd>=20)
                              {
                              $pnts+=5;
                              }else{
                              $pnts += floor($ppd/4);
                              }
                              $cpd = ceil($noi[2]/$rwage);
                              if($cpd>=100)
                              {
                              $pnts+=5;
                              }else{
                              $pnts += floor($cpd/20);
                              }
                              return floor($pnts/3);



                              }
                              ///////////////////////////////////function isuser

                              function isuser($uid)
                              {
                              $cus = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE id='".$uid."'"));
                              if($cus[0]>0)
                              {
                              return true;
                              }
                              return false;
                              }
                              ////////////////////////////////////////////Can access forum

                              function canaccess($uid, $fid)
                              {
                              $fex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_forums WHERE id='".$fid."'"));
                              if($fex[0]==0)
                              {
                              return false;
                              }
                              $persc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_acc WHERE fid='".$fid."'"));
                              if($persc[0]==0)
                              {
                              $clid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
                              if($clid[0]==0)
                              {
                              return true;
                              }else{
                              if(ismod($uid))
                              {
                              return true;
                              }else{
                              $ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."'"));
                              if($ismm[0]>0)
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              }

                              }else{
                              $gid = mysql_fetch_array(mysql_query("SELECT gid FROM ibwf_acc WHERE fid='".$fid."'"));
                              $gid = $gid[0];
                              $ginfo = mysql_fetch_array(mysql_query("SELECT autoass, mage, userst, posts, plusses FROM ibwf_groups WHERE id='".$gid."'"));
                              if($ginfo[0]=="1")
                              {
                              $uperms = mysql_fetch_array(mysql_query("SELECT birthday, perm, posts, plusses FROM ibwf_users WHERE id='".$uid."'"));


                              if($ginfo[2]==3)
                              {

                              if(iscoder($uid))
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              if($ginfo[2]==5)
                              {

                              if(ishedmodr($uid))
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              if($ginfo[2]==6)
                              {

                              if(ishedadm($uid))
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }

                              if($ginfo[2]==4)
                              {

                              if(isowner($uid))
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              if($ginfo[2]==2)
                              {

                              if(isadmin($uid))
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }

                              if($ginfo[2]==1)
                              {

                              if(ismod($uid))
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              if($uperms[1]>$ginfo[2])
                              {
                              return true;
                              }
                              $acc = true;
                              if(getage($uperms[0])< $ginfo[1])
                              {
                              $acc = false;
                              }
                              if($uperms[2]<$ginfo[3])
                              {
                              $acc = false;
                              }
                              if($uperms[3]<$ginfo[4])
                              {
                              $acc = false;
                              }

                              }
                              }
                              return $acc;
                              }

                              function unhtmlspecialchars2( $string )
                              {
                              $string = str_replace ( '&amp;', '&', $string );
                              $string = str_replace ( '&#039;', '\'', $string );
                              $string = str_replace ( '&quot;', '"', $string );
                              $string = str_replace ( '&lt;', '<', $string );
                              $string = str_replace ( '&gt;', '>', $string );
                              $string = str_replace ( '&uuml;', '?', $string );
                              $string = str_replace ( '&Uuml;', '?', $string );
                              $string = str_replace ( '&auml;', '?', $string );
                              $string = str_replace ( '&Auml;', '?', $string );
                              $string = str_replace ( '&ouml;', '?', $string );
                              $string = str_replace ( '&Ouml;', '?', $string );
                              return $string;
                              }

                              function getuage_sid($sid)
                              {
                              $uid = getuid_sid($sid);
                              $uage = mysql_fetch_array(mysql_query("SELECT birthday FROM ibwf_users WHERE id='".$uid."'"));
                              return getage($uage[0]);
                              }

                              function canenter($rid, $sid)
                              {
                              $rperm = mysql_fetch_array(mysql_query("SELECT mage, perms, chposts, clubid FROM ibwf_rooms WHERE id='".$rid."'"));
                              $uperm = mysql_fetch_array(mysql_query("SELECT birthday, chmsgs FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
                              if($rperm[3]!=0)
                              {
                              if(ismod(getuid_sid($sid)))
                              {
                              return true;
                              }else{
                              $ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".getuid_sid($sid)."' AND clid='".$rperm[3]."'"));
                              if($ismm[0]>0)
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              }

                              if($rperm[1]==1)
                              {
                              return ismod(getuid_sid($sid));
                              }
                              if($rperm[1]==4)
                              {
                              return isowner(getuid_sid($sid));
                              }
                              if($rperm[1]==5)
                              {
                              return ishedmodr(getuid_sid($sid));
                              }
                              if($rperm[1]==6)
                              {
                              return ishedadm(getuid_sid($sid));
                              }
                              if($rperm[1]==3)
                              {
                              return iscoder(getuid_sid($sid));
                              }
                              if($rperm[1]==2)
                              {
                              return isadmin(getuid_sid($sid));
                              }

                              if(getuage_sid($sid)<$rperm[0])
                              {
                              return false;
                              }
                              if($uperm[1]<$rperm[2])
                              {
                              return false;
                              }
                              return true;
                              }

                              //////////////// GALLERY
                              function candelgal($uid, $item)
                              {
                              $candoit = mysql_fetch_array(mysql_query("SELECT uid FROM fun_gallery WHERE id='".$item."'"));
                              if($uid==$candoit[0]||ismod($uid))
                              {
                              return true;
                              }
                              return false;
                              }

                              /////////////////////////////////////////////popups on

                              function popupson($who)
                              {
                              $res = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE id='".$who."' AND popmsg='1'"));
                              if($res[0]>0)
                              {
                              return true;
                              }
                              return false;
                              }


                              ///////////////////clear data


                              function cleardata()
                              {
                              $timeto = 120;
                              $timenw = time();
                              $timeout = $timenw - $timeto;
                              $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");
                              $timeto = 300;
                              $timenw = time();
                              $timeout = $timenw - $timeto;
                              $exec = mysql_query("DELETE FROM ibwf_chat WHERE timesent<'".$timeout."'");
                              $timeto = 60*60;
                              $timenw = time();
                              $timeout = $timenw - $timeto;
                              $exec = mysql_query("DELETE FROM ibwf_search WHERE stime<'".$timeout."'");

                              ///delete expired rooms
                              $timeto = 5*60;
                              $timenw = time();
                              $timeout = $timenw - $timeto;
                              $rooms = mysql_query("SELECT id FROM ibwf_rooms WHERE static='0' AND lastmsg<'".$timeout."'");
                              while ($room=mysql_fetch_array($rooms))
                              {
                              $ppl = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
                              if($ppl[0]==0)
                              {
                              $exec = mysql_query("DELETE FROM ibwf_rooms WHERE id='".$room[0]."'");
                              }
                              }
                              $lbpm = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='lastbpm'"));
                              $td = date("Y-m-d");
                              //echo $lbpm[0];

                              if ($td!=$lbpm[0])
                              {
                              //echo "boo";
                              $sql = "SELECT id, name, birthday FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate())";
                              $ppl = mysql_query($sql);
                              while($mem = mysql_fetch_array($ppl))
                              {
                              $msg = "[card=008]to you $mem[1]"."[/card] waplink team wish you a day full of joy and happiness and many happy returns. Happy birthday and we wish for you to see many many more[br/]*fireworks*[br/][small]p.s: this is an automated pm[/small]";
                              autopm($msg, $mem[0]);
                              }
                              mysql_query("UPDATE ibwf_settings SET value='".$td."' WHERE name='lastbpm'");
                              }

                              }

                              ///////////////////////////////////////get file ext.

                              function getext($strfnm)
                              {
                              $str = trim($strfnm);
                              if (strlen($str)<4){
                              return $str;
                              }
                              for($i=strlen($str);$i>0;$i--)
                              {
                              $ext .= substr($str,$i,1);
                              if(strlen($ext)==3)
                              {
                              $ext = strrev($ext);
                              return $ext;
                              }
                              }
                              }

                              ///////////////////////////////////////get extension icon

                              function getextimg($ext)
                              {
                              $ext = strtolower($ext);
                              switch ($ext)
                              {
                              case "jpg":
                              case "gif":
                              case "png":
                              case "bmp":
                              return "<img src=\"images/image.gif\" alt=\"image\"/>";
                              break;
                              case "zip":
                              case "rar":
                              return "<img src=\"images/pack.gif\" alt=\"package\"/>";
                              break;
                              case "amr":
                              case "wav":
                              case "mp3":
                              return "<img src=\"images/music.gif\" alt=\"music\"/>";
                              break;
                              case "mpg":
                              case "3gp":
                              return "<img src=\"images/video.gif\" alt=\"video\"/>";
                              break;
                              default:
                              return "<img src=\"images/other.gif\" alt=\"!\"/>";
                              break;
                              }
                              }

                              ///////////////////////////////////////Add to chat

                              function addtochat($uid, $rid)
                              {
                              $timeto = 120;
                              $timenw = time();
                              $timeout = $timenw - $timeto;
                              $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");
                              $res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'");
                              if(!$res)
                              {
                              mysql_query("UPDATE ibwf_chonline SET lton='".time()."', rid='".$rid."' WHERE uid='".$uid."'");
                              }
                              }
                              ////////////////////////////////////////////is mod

                              function ismod($uid)
                              {
                              $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));

                              if($perm[0]>0)
                              {
                              return true;
                              }
                              }

                              ////////////////////////////////////////////is mod

                              function candelgb($uid,$mid)
                              {
                              $minfo = mysql_fetch_array(mysql_query("SELECT gbowner, gbsigner FROM ibwf_gbook WHERE id='".$mid."'"));
                              if($minfo[0]==$uid)
                              {
                              return true;
                              }
                              if($minfo[1]==$uid)
                              {
                              return true;
                              }
                              return false;
                              }

                              ////////////////////////////////////////////Spam filter

                              function isspam($text)
                              {
                              $sfil[0] = "www.";
                              $sfil[1] = "http:";
                              $text = str_replace(" ", "", $text);
                              $text = strtolower($text);
                              for($i=0;$i<count($sfil);$i++)
                              {

                              $nosf = substr_count($text,$sfil[$i]);
                              if($nosf>0)
                              {
                              return true;
                              }
                              }

                              return false;
                              }

                              ///////////////////////////////////get page from go

                              function getpage_go($go,$tid)
                              {
                              if(trim($go)=="")return 1;
                              if($go=="last")return getnumpages($tid);
                              $counter=1;

                              $posts = mysql_query("SELECT id FROM ibwf_posts WHERE tid='".$tid."'");
                              while($post=mysql_fetch_array($posts))
                              {
                              $counter++;
                              $postid = $post[0];
                              if($postid==$go)
                              {
                              $tore = ceil($counter/5);
                              return $tore;
                              }
                              }
                              return 1;
                              }

                              ////////////////////////////get number of topic pages

                              function getnumpages($tid)
                              {
                              $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
                              $nops = $nops[0]+1; //where did the 1 come from? the topic text, duh!
                              $nopg = ceil($nops/5); //5 is the posts to show in each page
                              return $nopg;
                              }
                              ////////////////////////////////////////////can delete a blog?

                              function candelbl($uid,$bid)
                              {
                              $minfo = mysql_fetch_array(mysql_query("SELECT bowner FROM ibwf_blogs WHERE id='".$bid."'"));
                              if(ismod($uid))
                              {
                              return true;
                              }
                              if($minfo[0]==$uid)
                              {
                              return true;
                              }

                              return false;
                              }

                              //////////////////////////////////////////////////RAVEBABE
                              function PostToHost($host, $path, $data_to_send)
                              {

                              $result = "";
                              $fp = fsockopen($host,80,$errno, $errstr, 30);
                              if( $fp)
                              {
                              fputs($fp, "POST $path HTTP/1.0\n");
                              fputs($fp, "Host: $host\n");
                              fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
                              fputs($fp, "Content-length: " . strlen($data_to_send) . "\n");
                              fputs($fp, "Connection: close\n\n");
                              fputs($fp, $data_to_send);

                              while(!feof($fp)) {
                              $result .= fgets($fp, 12;
                              }
                              fclose($fp);

                              return $result;
                              }


                              }

                              /////////////////////////Get user plusses

                              function getplusses($uid)
                              {
                              $plus = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
                              return $plus[0];
                              }
                              /////////////////////////Can uid sign who's guestbook?

                              function cansigngb($uid, $who)
                              {
                              if(arebuds($uid, $who))
                              {
                              return true;
                              }
                              if($uid==$who)
                              {
                              return false; //imagine if someone signed his own gbook o.O
                              }
                              if(getplusses($uid)>=75)
                              {
                              return true;
                              }
                              return false;
                              }
                              /////////////////////////////////////////////Are buds?

                              function arebuds($uid, $tid)
                              {
                              $res = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='1'"));
                              if($res[0]>0)
                              {
                              return true;
                              }
                              return false;
                              }

                              //////////////////////////////////function get n. of buds

                              function getnbuds($uid)
                              {
                              $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));
                              return $notb[0];
                              }

                              /////////////////////////////get no. of requists

                              function getnreqs($uid)
                              {
                              $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE tid='".$uid."' AND agreed='0'"));
                              return $notb[0];
                              }


                              /////////////////////////////get no. of online buds

                              function getonbuds($uid)
                              {
                              $counter =0;
                              $buds = mysql_query("SELECT uid, tid FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'");
                              while($bud=mysql_fetch_array($buds))
                              {
                              if($bud[0]==$uid)
                              {
                              $tid = $bud[1];
                              }else{
                              $tid = $bud[0];
                              }
                              if(isonline($tid))
                              {
                              $counter++;
                              }
                              }
                              return $counter;
                              }

                              /////////////////////////////////////////////Function shoutbox

                              function getshoutbox($sid)
                              {
                              $shbox = "<small>";
                              $shbox .= "<b>*Voice*Box*</b>";
                              $lshout = mysql_fetch_array(mysql_query("SELECT shout, shouter, id FROM ibwf_shouts ORDER BY shtime DESC LIMIT 1"));
                              $shnick = getnick_uid($lshout[1]);
                              $shbox .= "<br/><i><a href=\"index.php?action=viewuser&amp;sid=$sid&amp; who=$lshout[1]\">".$shnick."</a></i>: ";
                              $text = parsepm($lshout[0], $sid);
                              $shbox .= $text;
                              $shbox .= "<br/>";
                              $shbox .= "<a href=\"lists.php?action=shouts&amp;sid=$sid\">more </a>, ";
                              $shbox .= "<a href=\"index.php?action=shout&amp;sid=$sid\">shout </a>";
                              if (ismod(getuid_sid($sid)))
                              {
                              $shbox .= ", <a href=\"modproc.php?action=delsh&amp;sid=$sid&amp;s hid=$lshout[2]\">delete</a>";
                              }
                              //$shbox .= "<br/>";
                              $shbox .= "</small>";
                              return $shbox;
                              }
                              /////////////////////////////////////////////get tid frm post id

                              function gettid_pid($pid)
                              {
                              $tid = mysql_fetch_array(mysql_query("SELECT tid FROM ibwf_posts WHERE id='".$pid."'"));
                              return $tid[0];
                              }

                              ///////////////////////////////////////////is trashed?

                              function istrashed($uid)
                              {
                              $del = mysql_query("DELETE FROM ibwf_penalties WHERE timeto<'".time()."'");
                              $not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='0'"));
                              if($not[0]>0)
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }

                              ///////////////////////////////////////////is shielded?

                              function isshield($uid)
                              {
                              $not = mysql_fetch_array(mysql_query("SELECT shield FROM ibwf_users WHERE id='".$uid."'"));
                              if($not[0]=='1')
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }

                              /////////////////////////////////////////////function pop up msg
                              function popup($sid)
                              {
                              $uid = getuid_sid($sid);
                              $unreadpopup=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups WHERE unread='1' AND touid='".$uid."'"));


                              if ($unreadpopup[0]>0)
                              {
                              $popsenabled=mysql_fetch_array(mysql_query("SELECT popmsg FROM ibwf_users WHERE id='".$uid."'"));
                              if($popsenabled[0]==1)
                              {
                              $pminfo = mysql_fetch_array(mysql_query("SELECT id, text, byuid, timesent, touid, reported FROM ibwf_popups WHERE unread='1' AND touid='".$uid."'"));
                              $pmfrm = getnick_uid($pminfo[2]);
                              $ncl = mysql_query("UPDATE ibwf_popups SET unread='0' WHERE id='".$pminfo[0]."'");
                              $popmsgbox .= "<center><strong>POP-UP Message From $pmfrm</strong>";
                              $popmsgbox .= "<br/>";
                              $tmstamp = $pminfo[3];
                              $tmdt = date("d m Y - H:i:s", $tmstamp);
                              $popmsgbox .= "Sent At: $tmdt<br/>";
                              $pmtext = parsepm($pminfo[1], $sid);
                              $pmtext = str_replace("/llfaqs","<a href=\"lists.php?action=faqs&amp;sid=$sid\">$siten ame F.A.Qs</a>", $pmtext);
                              $pmtext = str_replace("/reader",getnick_uid($pminfo[4]), $pmtext);
                              $pmid=$pminfo[0];
                              $popmsgbox .= "Message: $pmtext";
                              $popmsgbox .= "<br/>Send Reply to $pmfrm<br/></center>";
                              $popmsgbox .= "<form action=\"inbxproc.php?action=sendpopup&amp;who=$pm info[2]&amp;sid=$sid&amp;pmid=$pminfo[0]\" method=\"post\">";
                              $popmsgbox .= "<center><input name=\"pmtext\" maxlength=\"500\"/><br/>";
                              $popmsgbox .= "<input type=\"Submit\" name=\"submit\" Value=\"Send\"></center></form>";
                              // $res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'");
                              $location = mysql_fetch_array(mysql_query("SELECT placedet FROM ibwf_online WHERE userid='".$uid."'"));
                              $popmsgbox .= "<center><a href=\"$location[0]&amp;sid=$sid\">Skip Msg</a><br/>";
                              $popmsgbox .= "<a href=\"inbxproc.php?action=rptpop&amp;sid=$sid&amp ;pmid=$pminfo[0]\">Report</a></center>";
                              }
                              }
                              return $popmsgbox;
                              }

                              ///////////////////////////////////////////Get IP

                              function getip_uid($uid)
                              {
                              $not = mysql_fetch_array(mysql_query("SELECT ipadd FROM ibwf_users WHERE id='".$uid."'"));
                              return $not[0];

                              }

                              ///////////////////////////////////////////Get Browser

                              function getbr_uid($uid)
                              {
                              $not = mysql_fetch_array(mysql_query("SELECT browserm FROM ibwf_users WHERE id='".$uid."'"));
                              return $not[0];

                              }

                              ///////////////////////////////////////////is trashed?

                              function isbanned($uid)
                              {
                              $del = mysql_query("DELETE FROM ibwf_penalties WHERE timeto<'".time()."'");
                              $not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_penalties WHERE uid='".$uid."' AND (penalty='1' OR penalty='2')"));

                              if($not[0]>0)
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }


                              /////////////////////////////////////////////get tid frm post id

                              function gettname($tid)
                              {
                              $tid = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_topics WHERE id='".$tid."'"));
                              return $tid[0];
                              }

                              /////////////////////////////////////////////get tid frm post id

                              function getfid_tid($tid)
                              {
                              $fid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
                              return $fid[0];
                              }

                              /////////////////////////////////////////////is ip banned

                              function isipbanned($ipa, $brm)
                              {

                              $pinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$ipa."' AND browserm='".$brm."'"));
                              if($pinf[0]>0)
                              {
                              return true;
                              }
                              return false;
                              }

                              ////////////////get number of pinned topics in forum

                              function getpinned($fid)
                              {
                              $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned ='1'"));
                              return $nop[0];
                              }

                              /////////////////////////////////////////////can bud?

                              function budres($uid, $tid)
                              {
                              //3 = can't bud
                              //2 = already buds
                              //1 = request pended
                              //0 = can bud
                              if($uid==$tid)
                              {
                              return 3;
                              }

                              if (arebuds($uid, $tid))
                              {
                              return 2;
                              }
                              $req = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='0'"));
                              if($req[0]>0)
                              {
                              return 1;
                              }
                              $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$tid."' OR tid='".$tid."') AND agreed='1'"));
                              global $max_buds;
                              if($notb[0]>=$max_buds)
                              {

                              return 3;
                              }
                              $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));
                              global $max_buds;
                              if($notb[0]>=$max_buds)
                              {

                              return 3;
                              }
                              return 0;
                              }
                              ////////////////////////////////////////////Session expiry time

                              function getsxtm()
                              {
                              $getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sesexp'"));
                              return $getdata[0];
                              }

                              ////////////////////////////////////////////Get bud msg

                              function getbudmsg($uid)
                              {
                              $getdata = mysql_fetch_array(mysql_query("SELECT budmsg FROM ibwf_users WHERE id='".$uid."'"));
                              return $getdata[0];
                              }

                              ////////////////////////////////////////////Get forum name

                              function getfname($fid)
                              {
                              $fname = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_forums WHERE id='".$fid."'"));
                              return $fname[0];
                              }
                              ////////////////////////////////////////////PM antiflood time

                              function getpmaf()
                              {
                              $getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='pmaf'"));
                              return $getdata[0];
                              }

                              ////////////////////////////////////////////PM antiflood time

                              function getfview()
                              {
                              $getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='fview'"));
                              return $getdata[0];
                              }

                              ////////////////////////////////////////////get forum message

                              function getfmsg()
                              {
                              $getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='4ummsg'"));
                              return $getdata[0];
                              }

                              //////////////////////////////////////////////is online

                              function isonline($uid)
                              {
                              $uon = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE userid='".$uid."'"));
                              if($uon[0]>0)
                              {
                              return true;
                              }else
                              {
                              return false;
                              }
                              }
                              ///////////////////////////if registration is allowed

                              function canreg()
                              {
                              $getreg = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='reg'"));
                              if($getreg[0]=='1')
                              {
                              return true;
                              }else
                              {
                              return false;
                              }
                              }

                              ///////////////////////////////////////////Get Forum ID

                              function getfid($topicid)
                              {
                              $fid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$topicid."'"));
                              return $fid[0];
                              }
                              ////////////////////////////////////////////Parse PM
                              ////anti spam
                              function parsepm($text, $sid="")
                              {
                              $text = htmlspecialchars($text);
                              $sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
                              if ($sml[0]=="1")
                              {
                              $text = getsmilies($text);
                              }
                              $text = getbbcode($text, $sid);
                              $text = findcard($text);
                              return $text;
                              }


                              ////////////////////////////////////////////Parse other msgs

                              function parsemsg($text,$sid="")
                              {
                              $text = htmlspecialchars($text);
                              $sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
                              if ($sml[0]=="1")
                              {
                              $text = getsmilies($text);
                              }
                              $text = getbbcode($text, $sid);
                              $text = findcard($text);
                              return $text;
                              }
                              ///////////////////////////////////////////Is site blocked

                              function isblocked($str,$sender)
                              {
                              if(ismod($sender))
                              {
                              return false;
                              }
                              $str = str_replace(" ","",$str);
                              $sites[0] = ".com";
                              $sites[1] = ".c0m";
                              $sites[2] = ".Com";
                              $sites[3] = ".net";
                              $sites[4] = ".org";
                              $sites[5] = "co.za";
                              $sites[6] = "wen.ru";
                              $sites[7] = "wen.su";
                              $sites[8] = ".uk";
                              $sites[8] = ".to";
                              $sites[9] = ",com";
                              $sites[10] = ",net";
                              $sites[11] = ",freehostia,com";
                              $sites[12] = ",uni.cc";
                              $sites[13] = ",co.cc";
                              $sites[14] = ",fiz.su";
                              $sites[15] = ",cogia.net";
                              $sites[16] = ",vibeslink";
                              $sites[17] = ",jamvibez";
                              $sites[18] = ",fiz-su";
                              $sites[19] = ",Vibeslink. Net23 . Net";
                              for($i=0;$i<count($sites);$i++)
                              {
                              $nosf = substr_count($str,$sites[$i]);
                              if($nosf>0)
                              {
                              return true;
                              }
                              }
                              return false;
                              }

                              ///////////////////////////////////////////Is pm starred

                              function isstarred($pmid)
                              {
                              $strd = mysql_fetch_array(mysql_query("SELECT starred FROM ibwf_private WHERE id='".$pmid."'"));
                              if($strd[0]=="1")
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              ////////////////////////////////////////////IS LOGGED?

                              function islogged($sid)
                              {
                              //delete old sessions first

                              $deloldses = mysql_query("DELETE FROM ibwf_ses WHERE expiretm<'".time()."'");
                              //does sessions exist?
                              $sesx = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE id='".$sid."'"));

                              if($sesx[0]>0)
                              {
                              if(!isuser(getuid_sid($sid)))
                              {
                              return false;
                              }
                              //yip it's logged in
                              //first extend its session expirement time
                              $xtm = time() + (60*getsxtm());
                              $extxtm = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE id='".$sid."'");
                              return true;
                              }else{
                              //nope its session must be expired or something
                              return false;
                              }
                              }

                              ////////////////////////Get user nick from session id

                              function getnick_sid($sid)
                              {
                              $uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
                              $uid = $uid[0];
                              return getnick_uid($uid);
                              }


                              ////////////////////////Get user id from session id

                              function getuid_sid($sid)
                              {
                              $uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
                              $uid = $uid[0];
                              return $uid;
                              }

                              /////////////////////Get total number of pms

                              function getpmcount($uid,$view="all")
                              {
                              if($view=="all"){
                              $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
                              }else if($view =="snt")
                              {
                              $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE byuid='".$uid."'"));
                              }else if($view =="str")
                              {
                              $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND starred='1'"));
                              }else if($view =="urd")
                              {
                              $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND unread='1'"));
                              }
                              return $nopm[0];
                              }

                              function deleteClub($clid)
                              {
                              $fid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$clid."'"));
                              $fid = $fid[0];
                              $topics = mysql_query("SELECT id FROM ibwf_topics WHERE fid=".$fid."");
                              while($topic = mysql_fetch_array($topics))
                              {
                              mysql_query("DELETE FROM ibwf_posts WHERE tid='".$topic[0]."'");
                              }
                              mysql_query("DELETE FROM ibwf_topics WHERE fid='".$fid."'");
                              mysql_query("DELETE FROM ibwf_forums WHERE id='".$fid."'");
                              mysql_query("DELETE FROM ibwf_rooms WHERE clubid='".$clid."'");
                              mysql_query("DELETE FROM ibwf_clubmembers WHERE clid='".$clid."'");
                              mysql_query("DELETE FROM ibwf_announcements WHERE clid='".$clid."'");
                              mysql_query("DELETE FROM ibwf_clubs WHERE id=".$clid."");
                              return true;
                              }

                              function deleteMClubs($uid)
                              {
                              $uclubs = mysql_query("SELECT id FROM ibwf_clubs WHERE owner='".$uid."'");
                              while($uclub=mysql_fetch_array($uclubs))
                              {
                              deleteClub($uclub[0]);
                              }
                              }
                              //////////////////////Function add user to online list :P

                              function addonline($uid,$place,$plclink)
                              {
                              /////delete inactive users
                              $tm = time();
                              $timeout = $tm - 420; //time out = 5 minutes
                              $deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
                              ///now try to add user to online list
                              $res = mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='".$uid."'");
                              $res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'");
                              if(!$res)
                              {
                              //most probably userid already in the online list
                              //so just update the place and time
                              $res = mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."' WHERE userid='".$uid."'");


                              }
                              $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));

                              $result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));

                              if($result[0]>=$maxmem[0])
                              {
                              $tnow = date("D d M Y - H:i");
                              mysql_query("UPDATE ibwf_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");
                              }
                              $maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
                              if($maxtoday[0]==0||$maxtoday=="")
                              {
                              mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'");
                              $maxtoday[0]=1;
                              }
                              if($result[0]>=$maxtoday[0])
                              {
                              mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
                              }
                              }

                              /////////////////////Get members online

                              function getnumonline()
                              {
                              $nouo = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online "));
                              return $nouo[0];
                              }

                              //////////////////////////////////////is ignored

                              function isignored($tid, $uid)
                              {
                              $ign = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ignore WHERE target='".$tid."' AND name='".$uid."'"));
                              if($ign[0]>0)
                              {
                              return true;
                              }
                              return false;
                              }

                              ///////////////////////////////////////////GET IP

                              function getip()
                              {
                              if (getenv('HTTP_X_FORWARDED_FOR'))
                              {
                              $ip=getenv('HTTP_X_FORWARDED_FOR');
                              }
                              else
                              {
                              $ip=getenv('REMOTE_ADDR');
                              }
                              return $ip;
                              }

                              //////////////////////////////////////////ignore result

                              function ignoreres($uid, $tid)
                              {
                              //0 user can't ignore the target
                              //1 yes can ignore
                              //2 already ignored
                              if($uid==$tid)
                              {
                              return 0;
                              }
                              if(ismod($tid))
                              {
                              //you cant ignore staff members
                              return 0;
                              }
                              if(arebuds($tid, $uid))
                              {
                              //why the hell would anyone ignore his bud? o.O
                              return 0;
                              }
                              if(isignored($tid, $uid))
                              {
                              return 2; // the target is already ignored by the user
                              }
                              return 1;
                              }

                              ///////////////////////////////////////////Function getage

                              function getage($strdate)
                              {
                              $dob = explode("-",$strdate);
                              if(count($dob)!=3)
                              {
                              return 0;
                              }
                              $y = $dob[0];
                              $m = $dob[1];
                              $d = $dob[2];
                              if(strlen($y)!=4)
                              {
                              return 0;
                              }
                              if(strlen($m)!=2)
                              {
                              return 0;
                              }
                              if(strlen($d)!=2)
                              {
                              return 0;
                              }
                              $y += 0;
                              $m += 0;
                              $d += 0;
                              if($y==0) return 0;
                              $rage = date("Y") - $y;
                              if(date("m")<$m)
                              {
                              $rage-=1;

                              }else{
                              if((date("m")==$m)&&(date("d")<$d))
                              {
                              $rage-=1;
                              }
                              }
                              return $rage;
                              }

                              /////////////////////////////////////////getavatar

                              function getavatar($uid)
                              {
                              $av = mysql_fetch_array(mysql_query("SELECT avatar FROM ibwf_users WHERE id='".$uid."'"));
                              return $av[0];
                              }

                              /////////////////////////////////////////Can see details?

                              function cansee($uid, $tid)
                              {
                              if($uid==$tid)
                              {
                              return true;
                              }
                              if(ismod($uid))
                              {
                              return true;
                              }
                              return false;
                              }

                              //////////////////////////gettimemsg

                              function gettimemsg($sec)
                              {
                              $ds = floor($sec/60/60/24);
                              if($ds > 0)
                              {
                              return "$ds days";
                              }
                              $hs = floor($sec/60/60);
                              if($hs > 0)
                              {
                              return "$hs hours";
                              }
                              $ms = floor($sec/60);
                              if($ms > 0)
                              {
                              return "$ms minutes";
                              }
                              return "$sec Seconds";
                              }
                              /////////////////////////////////////////get status

                              function getstatus($uid)
                              {
                              $info= mysql_fetch_array(mysql_query("SELECT perm, plusses FROM ibwf_users WHERE id='".$uid."'"));
                              if(isbanned($uid))
                              {
                              return "BANNED!";
                              }
                              if($info[0]=='6')
                              {
                              return "Vice President!";
                              } if($info[0]=='5')
                              {
                              return "Head Mod!";
                              } if($info[0]=='4')
                              {
                              return "Owner_President!";
                              }else if($info[0]=='3')
                              {
                              return "Coder!";
                              }else if($info[0]=='2')
                              {
                              return "Admin!";
                              }else if($info[0]=='1')
                              {
                              return "Moderator!";
                              }else{
                              if($info[1]<10)
                              {
                              return "New Wapper";
                              }else if($info[1]<25)
                              {
                              return "Wapper";
                              }else if($info[1]<50)
                              {
                              return "L1 Wapper";
                              }else if($info[1]<75)
                              {
                              return "Gangster Wapper";
                              }else if($info[1]<250)
                              {
                              return "Real Star Wapper";
                              }else if($info[1]<500)
                              {
                              return "Invincible";
                              }else if($info[1]<750)
                              {
                              return "Unwapperable";
                              }else if($info[1]<1000)
                              {
                              return "Zone Wapper";
                              }else if($info[1]<1500)
                              {
                              return "Hot Head!";
                              }else if($info[1]<2000)
                              {
                              return "Krazy!";
                              }else if($info[1]<2500)
                              {
                              return "REAL COLD Wapper";
                              }else if($info[1]<3000)
                              {
                              return "Unstopable!";
                              }else if($info[1]<4000)
                              {
                              return "Master";
                              }else if($info[1]<5000)
                              {
                              return "L1 Master";
                              }else if($info[1]<10000)
                              {
                              return "L2 Master";
                              }else
                              {
                              return "MASTER Wapper!";
                              }
                              }
                              }


                              /////////////////////Get Page Jumber
                              function getjumper($action, $sid,$pgurl)
                              {
                              $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
                              $rets .= "<anchor>[GO]";
                              $rets .= "<go href=\"$pgurl.php\" method=\"get\">";
                              $rets .= "<postfield name=\"action\" value=\"$action\"/>";
                              $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
                              $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
                              $rets .= "</go></anchor>";

                              return $rets;
                              }
                              /////////////////////Get unread number of pms

                              function getunreadpm($uid)
                              {
                              $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND unread='1'"));
                              return $nopm[0];
                              }

                              //////////////////////GET USER NICK FROM USERID

                              function getnick_uid($uid)
                              {
                              $unick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
                              return $unick[0];
                              }

                              ///////////////////////////////////////////////Get the smilies

                              function getsmilies($text)
                              {
                              $sql = "SELECT * FROM ibwf_smilies";
                              $smilies = mysql_query($sql);
                              while($smilie=mysql_fetch_array($smilies))
                              {
                              $scode = $smilie[1];
                              $spath = $smilie[2];
                              $text = str_replace($scode,"<img src=\"$spath\" alt=\"$scode\"/>",$text);
                              }
                              return $text;
                              }

                              ////////////////////////////////////////////check nicks

                              function checknick($aim)
                              {
                              $chk =0;
                              $aim = strtolower($aim);
                              $nicks = mysql_query("SELECT id, name, nicklvl FROM ibwf_nicks");

                              while($nick=mysql_fetch_array($nicks))
                              {
                              if($aim==$nick[1])
                              {
                              $chk = $nick[2];
                              }else if(substr($aim,0,strlen($nick[1]))==$nick[1])
                              {
                              $chk = $nick[2];
                              }else{
                              $found = strpos($aim, $nick[1]);
                              if($found!=0)
                              {
                              $chk = $nick[2];
                              }
                              }
                              }
                              return $chk;
                              }

                              function autopm($msg, $who)
                              {
                              mysql_query("INSERT INTO ibwf_private SET text='".$msg."', byuid='1', touid='".$who."', unread='1', timesent='".time()."'");

                              }

                              ////////////////////////////////////////////////////Register

                              function register($name,$pass,$usex,$bday,$uloc, $ubr)
                              {
                              $execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");

                              if (mysql_num_rows($execms)>0){
                              return 1;
                              }else{
                              $pass = md5($pass);
                              $reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$bday."', sex='".$usex."', location='".$uloc."', regdate='".time()."', ipadd='".getip()."', browserm='".$ubr."'");

                              if ($reg)
                              {
                              $uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$name."'"));
                              $msg = "-Hello- /reader -welcome- Thanks for joining Waplink. I would like to welcome you to our BIG happy family ![br/][br/]Please read Users FAQ,.[br/][br/]Contact our Staff Members if you have other problems.[br/][br/][br/][br/]Post in the forums, use chatrooms or play games to get more plusses in order to shout, make a club....etc. [br/]Have fun at Waplink and remember to tell your friends about this site. ENJOY YOUR TIME HERE! [br/]Note: This is an automatic PM. Please Dont reply to it";
                              $msg = mysql_escape_string($msg);
                              autopm($msg, $uid[0]);
                              return 0;
                              }else{
                              return 2;

                              }
                              }

                              }

                              /////////////////////// GET ibwf_users user id from nickname

                              function getuid_nick($nick)
                              {
                              $uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$nick."'"));
                              return $uid[0];
                              }

                              /////////////////////////////////////////Is admin?

                              function isadmin($uid)
                              {
                              $admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
                              if($admn[0]=='2')
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              /////////////////////////////////////////Is head mod?

                              function ishedmodr($uid)
                              {
                              $admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
                              if($admn[0]=='5')
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              /////////////////////////////////////////Is head admin?

                              function ishedadm($uid)
                              {
                              $admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
                              if($admn[0]=='6')
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              /////////////////////////////////////////Is owner?

                              function isowner($uid)
                              {
                              $ownr = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
                              if($ownr[0]=='4')
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              /////////////////////////////////////////Is coder?

                              function iscoder($uid)
                              {
                              $ownr = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
                              if($ownr[0]=='3')
                              {
                              return true;
                              }else{
                              return false;
                              }
                              }
                              ///////////////////////////////////parse bbcode

                              function getbbcode($text, $sid="")
                              {
                              $text=preg_replace("/\[b\](.*?)\[\/b\]/i","<b>\\1</b>", $text);
                              $text=preg_replace("/\[i\](.*?)\[\/i\]/i","<i>\\1</i>", $text);
                              $text=preg_replace("/\[u\](.*?)\[\/u\]/i","<u>\\1</u>", $text);
                              $text=preg_replace("/\[big\](.*?)\[\/big\]/i","<big>\\1</big>", $text);
                              $text=preg_replace("/\[small\](.*?)\[\/small\]/i","<small>\\1</small>", $text);
                              $text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"$1\">$2</a>",$text);
                              $text = preg_replace("/\[topic\=(.*?)\](.*?)\[\/topic\]/is","<a href=\"index.php?action=viewtpc&amp;tid=$1&amp;sid =$sid\">$2</a>",$text);
                              $text = preg_replace("/\[club\=(.*?)\](.*?)\[\/club\]/is","<a href=\"index.php?action=gocl&amp;clid=$1&amp;sid=$ sid\">$2</a>",$text);
                              $text = preg_replace("/\[blog\=(.*?)\](.*?)\[\/blog\]/is","<a href=\"index.php?action=viewblog&amp;bid=$1&amp;si d=$sid\">$2</a>",$text);
                              //$text = ereg_replace("http://[A-Za-z0-9./=?-_]+","<a href=\"\\0\">\\0</a>", $text);
                              if(substr_count($text,"[br/]")<=3){
                              $text = str_replace("[br/]","<br/>",$text);
                              }
                              //$text = str_replace("2wap","2crapforwap",$text);
                              //$text = str_replace("2WAP","2crapforwap",$text);
                              //$text = str_replace("2wAp","2crapforwap",$text);
                              //$text = str_replace("2w4p","2crapforwap",$text);
                              //$text = str_replace("2waP","2crapforwap",$text);
                              //$text = str_replace("2Wap","2crapforwap",$text);
                              $text = str_replace("hiphop4u","britneyspears",$text);
                              $text = str_replace("HIPHOP4U","britneyspears",$text);
                              $text = str_replace("HiPhOp4U","britneyspears",$text);
                              $text = str_replace("hIpHoP4u","britneyspears",$text);
                              $text = str_replace("Hiphop4U","britneyspears",$text);
                              $text = str_replace("Hiphop4u","britneyspears",$text);
                              $text = str_replace("HipHop4u","britneyspears",$text);
                              $text = str_replace("hh4u","britneyspears",$text);
                              $text = str_replace("HH4U","britneyspears",$text);
                              $text = str_replace("Hh4u","britneyspears",$text);
                              $text = str_replace("hH4U","britneyspears",$text);
                              $text = str_replace("HH4u","britneyspears",$text);
                              $text = str_replace("hh4U","britneyspears",$text);
                              $text = str_replace("free hostia","i suck dick for a living",$text);
                              return $text;
                              }


                              //////////////////////////////////////////my profile
                              function mypro($uid, $tid)
                              {
                              if($uid==$tid)
                              {
                              return true;
                              }
                              }

                              //////////////////////////////////////////////////MISC FUNCTIONS
                              function spacesin($word)
                              {
                              $pos = strpos($word," ");
                              if($pos === false)
                              {
                              return false;
                              }else
                              {
                              return true;
                              }
                              }

                              /////////////////////////////////Number of registered members
                              function regmemcount()
                              {
                              $rmc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
                              return $rmc[0];
                              }
                              ///////

                              ///////////////////////////function counter

                              function addvisitor()
                              {
                              $cc = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='Counter'"));
                              $cc = $cc[0]+1;
                              $res = mysql_query("UPDATE ibwf_settings SET value='".$cc."' WHERE name='Counter'");
                              }

                              function scharin($word)
                              {
                              $chars = "abcdefghijklmnopqrstuvwxyz0123456789-_";
                              for($i=0;$i<strlen($word);$i++)
                              {
                              $ch = substr($word,$i,1);
                              $nol = substr_count($chars,$ch);
                              if($nol==0)
                              {
                              return true;
                              }
                              }
                              return false;
                              }

                              function isdigitf($word)
                              {
                              $chars = "abcdefghijklmnopqrstuvwxyz";
                              $ch = substr($word,0,1);
                              $sres = ereg("[0-9]",$ch);

                              $ch = substr($word,0,1);
                              $nol = substr_count($chars,$ch);
                              if($nol==0)
                              {
                              return true;
                              }


                              return false;

                              }

                              function getAd()
                              {
                              echo '<p align="center"><small>AD: ';

                              $mob_mode = 'live';
                              $mob_alternate_link = 'http://waplink.freehostia.com';


                              $mob_contents = '';
                              $mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
                              $mob_ip = urlencode($_SERVER['REMOTE_ADDR']);

                              if ($mob_mode=='test')
                              $mob_m = "&m";

                              $mob_url = 'http://ads.admob.com/ad_source.php?s=a146c1a1f699d41&u='.$mob_ua.'&i='. $mob_ip.$mob_m;

                              @$mob_ad_serve = fopen($mob_url,'r');

                              if ($mob_ad_serve) {
                              while (!feof($mob_ad_serve))
                              $mob_contents .= fread($mob_ad_serve,1024);
                              fclose($mob_ad_serve);
                              }
                              $mob_link = explode("><",$mob_contents);

                              $mob_ad_text = $mob_link[0];
                              $mob_ad_link = $mob_link[1];

                              if (isset($mob_ad_link) && ($mob_ad_link !='')) {

                              echo '<a href="'. $mob_ad_link .'">'. $mob_ad_text . '</a>';
                              }
                              else {

                              echo $mob_alternate_link;
                              }

                              //echo "http://waplink.freehostia.com";
                              echo '</small></p>';
                              }





                              this is my chat.php

                              <?php
                              header("Content-type: text/vnd.wap.wml");
                              header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // expires in the past
                              header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Last modified, right now
                              header("Cache-Control: no-cache, must-revalidate"); // Prevent caching, HTTP/1.1
                              header("Pragma: no-cache");
                              print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
                              echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
                              //8152
                              ?>
                              <wml>
                              <head>
                              <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
                              <meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
                              </head>
                              <?php

                              include("config.php");
                              include("core.php");
                              connectdb();
                              $action=$_GET["action"];
                              $id=$_GET["id"];
                              $sid = $_GET["sid"];
                              $rid=$_GET["rid"];
                              $rpw=$_GET["rpw"];
                              $uid = getuid_sid($sid);

                              $uexist = isuser($uid);

                              if((islogged($sid)==false)||!$uexist)
                              {
                              echo "<card id=\"main\" title=\"lavalair.net\">";
                              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 "</card>";
                              echo "</wml>";
                              exit();
                              }

                              if(isbanned($uid))
                              {
                              echo "<card id=\"main\" title=\"lavalair.net\">";
                              echo "<p align=\"center\">";
                              echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
                              echo "You are <b>Banned</b><br/>";
                              $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
                              $remain = $banto[0]- time();
                              $rmsg = gettimemsg($remain);
                              echo "Time to finish your penalty: $rmsg<br/><br/>";
                              //echo "<a href=\"index.php\">Login</a>";
                              echo "</p>";
                              echo "</card>";
                              echo "</wml>";
                              exit();
                              }
                              $isroom = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rooms WHERE id='".$rid."'"));
                              if($isroom[0]==0)
                              {
                              echo "<card id=\"main\" title=\"lavalair.net\">";
                              echo "<p align=\"center\">";
                              echo "This room doesn't exist anymore<br/>";
                              echo ":P see in another room<br/><br/>";
                              echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatro oms</a>";
                              echo "</p>";
                              echo "</card>";
                              echo "</wml>";
                              exit();
                              }
                              $passworded = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_rooms WHERE id='".$rid."'"));
                              if($passworded[0]!="")
                              {
                              if($rpw!=$passworded[0])
                              {
                              echo "<card id=\"main\" title=\"lavalair.net\">";
                              echo "<p align=\"center\">";
                              echo "You can't enter this room<br/>";
                              echo ":P stay away<br/><br/>";
                              echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatro oms</a>";
                              echo "</p>";
                              echo "</card>";
                              echo "</wml>";
                              exit();
                              }
                              }
                              if(!canenter($rid,$sid))
                              {
                              echo "<card id=\"main\" title=\"lavalair.net\">";
                              echo "<p align=\"center\">";
                              echo "You can't enter this room<br/>";
                              echo ":P stay away<br/><br/>";
                              echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatro oms</a>";
                              echo "</p>";
                              echo "</card>";
                              echo "</wml>";
                              exit();
                              }
                              addtochat($uid, $rid);
                              //This Chat Script is by Ra'ed Far'oun
                              //raed_mfs@yahoo.com
                              //want to see main menu...
                              $timeto = 300;
                              $timenw = time();
                              $timeout = $timenw-$timeto;
                              $deleted = mysql_query("DELETE FROM ibwf_chat WHERE timesent<".$timeout."");

                              if ($action=="")
                              {

                              echo "<card id=\"chat\" title=\"lavalair.net\" ontimer=\"chat.php?time=";
                              echo date('dmHis');
                              echo "&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw";

                              echo "\">";

                              //start of main card

                              echo "<timer value=\"200\"/><p align=\"center\">";
                              addonline($uid,"Chatrooms","");
                              echo "<small>
                              <a href=\"chat.php?action=say&amp;sid=$sid&amp;rid=$r id&amp;rpw=$rpw\">options</a>, ";
                              echo "<a href=\"chat.php?time=";
                              echo date('dmHis');
                              echo "&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw";
                              echo "\">refresh</a>";

                              /*
                              if(getuid_sid($sid)==2)
                              {
                              echo "<a href=\"wtai://wp/mc;+972545565459\">Call me</a><br/>";
                              }
                              */
                              $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'"));
                              $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
                              $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
                              if ($unreadinbox[0]>0)
                              {
                              echo "<br/><a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox$ unrd</a>";
                              }
                              echo "</small></p>";
                              $message=$_POST["message"];
                              $who = $_POST["who"];
                              $rinfo = mysql_fetch_array(mysql_query("SELECT censord, freaky FROM ibwf_rooms WHERE id='".$rid."'"));
                              if (trim($message) != "")
                              {
                              $nosm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE msgtext='".$message."'"));
                              if($nosm[0]==0){

                              $chatok = mysql_query("INSERT INTO ibwf_chat SET chatter='".$uid."', who='".$who."', timesent='".time()."', msgtext='".$message."', rid='".$rid."';");
                              $lstmsg = mysql_query("UPDATE ibwf_rooms SET lastmsg='".time()."' WHERE id='".$rid."'");

                              $hehe=mysql_fetch_array(mysql_query("SELECT chmsgs FROM ibwf_users WHERE id='".$uid."'"));
                              $totl = $hehe[0]+1;
                              $msgst= mysql_query("UPDATE ibwf_users SET chmsgs='".$totl."' WHERE id='".$uid."'");
                              if($rinfo[1]==2)
                              {
                              //oh damn i gotta post this message to ravebabe
                              //will it succeed?
                              $botid = "eeb070e74e366473";
                              $hostname = "www.pandorabots.com";
                              $hostpath = "/pandora/talk-xml";
                              $sendData = "botid=".$botid."&input=".urlencode($message)."&cu stid=".$custid;

                              $result = PostToHost($hostname, $hostpath, $sendData);

                              $pos = strpos($result, "custid=\"");
                              $pos = strpos($result, "<that>");
                              if ($pos === false) {
                              $reply = "";
                              } else {
                              $pos += 6;
                              $endpos = strpos($result, "</that>", $pos);
                              $reply = unhtmlspecialchars2(substr($result, $pos, $endpos - $pos));
                              $reply = mysql_escape_string($reply);
                              }

                              $chatok = mysql_query("INSERT INTO ibwf_chat SET chatter='8152', who='', timesent='".time()."', msgtext='".$reply." @".getnick_uid($uid)."', rid='".$rid."';");
                              }
                              }
                              $message = "";
                              }

                              echo "<p>";
                              echo "<small>";
                              $chats = mysql_query("SELECT chatter, who, timesent, msgtext, exposed FROM ibwf_chat WHERE rid='".$rid."' ORDER BY timesent DESC, id DESC");
                              $counter=0;

                              while($chat = mysql_fetch_array($chats))
                              {
                              $canc = true;


                              if($counter<10)
                              {
                              if(istrashed($chat[0])){
                              if($uid!=$chat[0])
                              {
                              $canc = false;
                              }
                              }
                              //////good
                              if(isignored($chat[0],$uid)){
                              $canc = false;
                              }
                              //////////good
                              if($chat[0]!=$uid)
                              {
                              if($chat[1]!=0)
                              {
                              if($chat[1]!=$uid)
                              {
                              $canc = false;
                              }
                              }
                              }
                              if($chat[4]=='1' && ismod($uid))
                              {
                              $canc = true;
                              }
                              if($canc)
                              {
                              $cmid = mysql_fetch_array(mysql_query("SELECT chmood FROM ibwf_users WHERE id='".$chat[0]."'"));

                              $iml = "";
                              if(($cmid[0]!=0))
                              {
                              $mlnk = mysql_fetch_array(mysql_query("SELECT img, text FROM ibwf_moods WHERE id='".$cmid[0]."'"));
                              $iml = "<img src=\"$mlnk[0]\" alt=\"$mlnk[1]\"/>";

                              }
                              $chnick = getnick_uid($chat[0]);
                              $optlink = $iml.$chnick;
                              if(($chat[1]!=0)&&($chat[0]==$uid))
                              {
                              ///out
                              $iml = "<img src=\"moods/out.gif\" alt=\"!\"/>";
                              $chnick = getnick_uid($chat[1]);
                              $optlink = $iml."PM to ".$chnick;
                              }
                              if($chat[1]==$uid)
                              {
                              ///out
                              $iml = "<img src=\"moods/in.gif\" alt=\"!\"/>";
                              $chnick = getnick_uid($chat[0]);
                              $optlink = $iml."PM by ".$chnick;
                              }
                              if($chat[4]=='1')
                              {
                              ///out
                              $iml = "<img src=\"moods/point.gif\" alt=\"!\"/>";
                              $chnick = getnick_uid($chat[0]);
                              $tonick = getnick_uid($chat[1]);
                              $optlink = "$iml by ".$chnick." to ".$tonick;
                              }

                              $ds= date("H.i.s", $chat[2]);
                              $text = parsepm($chat[3], $sid);
                              $nos = substr_count($text,"<img src=");
                              if(isspam($text))
                              {

                              }
                              else if($nos>1000000){
                              $chnick = getnick_uid($chat[0]);
                              echo "Chat System:»*Hey! $chnick, U Can Only Use 2 Smilies Per Msg!*";

                              }else{
                              $sres = substr($chat[3],0,3);

                              if($sres == "/me")
                              {
                              $chco = strlen($chat[3]);
                              $goto = $chco - 3;
                              $rest = substr($chat[3],3,$goto);
                              $tosay = parsepm($rest, $sid);

                              echo "<b><i>*$chnick $tosay*</i></b><br/>";
                              }else{

                              $tosay = parsepm($chat[3], $sid);

                              if($rinfo[0]==1)
                              {
                              $tosay = str_replace("****","*this word rhymes with duck*",$tosay);
                              $tosay = str_replace("****","*dont swear*",$tosay);
                              $tosay = str_replace("dick","*ooo! you dirty person*",$tosay);
                              $tosay = str_replace("pussy","*angel flaps*",$tosay);
                              $tosay = str_replace("cock","*daddy stick*",$tosay);
                              $tosay = str_replace("can i be a mod","*im sniffing staffs ass*",$tosay);
                              $tosay = str_replace("can i be admin","*im a big ass kisser*",$tosay);

                              $tosay = str_replace("ginger","*the cute arsonist*",$tosay);
                              $tosay = str_replace("neon","*the cute but evil princess*",$tosay);
                              $tosay = str_replace("kaas","*the cheese boy*",$tosay);
                              $tosay = str_replace("slut","*s+m freak*",$tosay);
                              $tosay = str_replace("kahla","*lyrical lizard*",$tosay);


                              }

                              if($rinfo[1]==1)
                              {
                              $tosay = htmlspecialchars($chat[3]);
                              $tosay = strrev($tosay);
                              }
                              echo "<a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$ chat[0]&amp;rid=$rid&amp;rpw=$rpw\">$optlink</a>&#187;$ds<br/>";
                              echo $tosay."<br/>";
                              }
                              }

                              $counter++;
                              }
                              }
                              }
                              echo "</small>";
                              echo "</p>";

                              echo "<p align=\"center\">";
                              $chatters=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline where rid='".$rid."'"));
                              echo "<br/><a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid =$rid&amp;rpw=$rpw\">Who's Inside($chatters[0])</a><br/>";
                              echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatro oms</a><br/>";
                              echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a></p>";

                              echo "</card>";
                              }
                              /////////////////////////////////////////////////////SAY
                              else if ($action=="say") {
                              echo "<card id=\"say\" title=\"lavalair.net\">";

                              addonline($uid,"Writing Chat Message","");

                              echo "<p>Message:<input name=\"message\" type=\"text\" value=\"\" maxlength=\"255\"/><br/>";
                              echo "<small><anchor>&#171;Say";
                              echo "<go href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw \" method=\"post\">";
                              echo "<postfield name=\"message\" value=\"$(message)\"/>";
                              echo "</go></anchor></small><br/>";
                              echo "<small><a href=\"lists.php?action=chmood&amp;sid=$sid&amp;pa ge=1\">&#187;Chat mood</a></small><br/>";
                              echo "<small><a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid =$rid&amp;rpw=$rpw\">&#187;Who's Inside</a></small><br/>";
                              echo "<small><a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw \">&#171;Chatroom</a></small></p>";
                              //end

                              echo "<p align=\"center\"><a href=\"index.php?action=chat&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></p>";

                              echo "</card>";
                              }
                              ////////////////////////////////////////////
                              /////////////////////////////////////////////////////SAY2
                              else if ($action=="say2") {
                              echo "<card id=\"say\" title=\"lavalair.net\">";
                              echo "<p align=\"center\">";
                              $unick = getnick_uid($who);
                              echo "<b>Private to $unick</b>";
                              echo "</p>";

                              addonline($uid,"Writing chat message","");

                              echo "<p>Message:<input name=\"message\" type=\"text\" value=\" \" maxlength=\"255\"/><br/>";
                              echo "<small><anchor>&#171;Private";
                              echo "<go href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw \" method=\"post\">";
                              echo "<postfield name=\"message\" value=\"$(message)\"/>";
                              echo "<postfield name=\"who\" value=\"$who\"/>";
                              echo "</go></anchor></small><br/>";
                              echo "<small><a href=\"index.php?action=viewuser&amp;sid=$sid&amp; who=$who\">&#187;View $unick's Profile</a></small><br/>";
                              echo "<small><a href=\"chat.php?action=expose&amp;sid=$sid&amp;who =$who&amp;rid=$rid&amp;rpw=$rpw\">&#187;Expose $unick</a></small><br/>";

                              echo "<small><a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid =$rid&amp;rpw=$rpw\">&#187;Who's Inside</a></small><br/>";
                              echo "<small><a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw \">&#171;Chatroom</a></small></p>";
                              //end

                              echo "<p align=\"center\"><a href=\"index.php?action=chat&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></p>";

                              echo "</card>";
                              }
                              ////////////////////////////////////////////
                              //////////////////////////////inside//////////
                              else if ($action=="inside") {

                              addonline($uid,"Chat inside list","");
                              echo "<card id=\"main\" title=\"Inside list\">";
                              echo "<p align=\"center\"><br/>";
                              $inside=mysql_query("SELECT DISTINCT * FROM ibwf_chonline WHERE rid='".$rid."' and uid IS NOT NULL");

                              while($ins=mysql_fetch_array($inside))
                              {
                              $unick = getnick_uid($ins[1]);
                              $userl = "<small><a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$ ins[1]&amp;rid=$rid&amp;rpw=$rpw\">$unick</a>, </small>";
                              echo "$userl";
                              }
                              echo "<br/><br/>";
                              echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw \">&#171;Chatroom</a><br/>";
                              echo "<br/><a href=\"index.php?action=chat&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></p>";

                              echo "</card>";
                              }
                              else if ($action=="expose") {

                              addonline($uid,"Chat inside list","");
                              echo "<card id=\"main\" title=\"Inside list\">";
                              echo "<p align=\"center\"><br/>";
                              mysql_query("UPDATE ibwf_chat SET exposed='1' WHERE chatter='".$who."' AND who='".$uid."'");
                              $unick = getnick_uid($who);
                              echo "$unick messages to you have been exposed to staff";
                              echo "<br/><br/>";
                              echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw \">&#171;Chatroom</a><br/>";
                              echo "<br/><a href=\"index.php?action=chat&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></p>";

                              echo "</card>";
                              }


                              ?>
                              </wml>

                              Comment

                              Working...
                              X