Chatroom help

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

    Chatroom help

    Im trying to make the chatroom to show 20 messages but it dnt keep the messages just delete it automatic how can i get it right
    Code:
    <?php
    include("config.php");
    include("core.php");
    include("xhtmlfunctions.php");
    //session_start();
    
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
    
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Rccwap</title>
    <meta name="description" content="LDS Christian Social Community on Mobile" />
    <meta name="keywords" content="lds, mormon, wapsite, christian, social community" />
    <link rel="shortcut icon" href="/images/favicon.ico" />
    <link rel="icon" href="/images/favicon.gif" type="image/gif" />
    
    
    
    <?php
    
    connectdb();
    $action=$_GET["action"];
    $id=$_GET["id"];
    $sid = $_GET["sid"];
    $rid=$_GET["rid"];
    $rpw=$_GET["rpw"];
    $chat=$_GET["chat"];
    $who=$_GET["who"];
    $unick=$_GET["unick"];
    $uid = getuid_sid($sid);
     $spin=$_GET["spin"];
      $idn=$_GET["idn"];
    $cancel=$_GET["cancel"];
     $uexist = isuser($uid);
    $time = date('dmHis');
    echo gettheme($sid);
    getbrip($sid);
    if((islogged($sid)==false)||!$uexist)
        {
          echo "<p align=\"center\">";
          echo "You are not logged in<br/>";
          echo "Or Your session has been expired<br/><br/>";
          echo "<a href=\"index.php\">Login</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        
    if(isbanned($uid))
        {
          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 "</body>";
          echo "</html>";
          exit();
        }
      $isroom = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rooms WHERE id='".$rid."'"));
        if($isroom[0]==0)
        {
     
          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&amp;type=send&amp;browse?start\">Chatrooms</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
        $passworded = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_rooms WHERE id='".$rid."'"));
        if($passworded[0]!="")
        {
          if($rpw!=$passworded[0])
          {
    
          echo "<p align=\"center\">";
          echo "You can't enter this room<br/>";
          echo "Stay away<br/><br/>";
          echo "<a href=\"index.php?action=chat&amp;sid=$sid&amp;type=send&amp;browse?start\">Chatrooms</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
          }
        }
          if(!canenter($rid,$sid))
        {
          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\">Chatrooms</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
      if(!inside($uid, $rid))
        {
     if(!iscowner($uid, $rid))
        {
    if(locked($uid, $rid))
        {
          echo "<p align=\"center\">";
          echo "This room is locked!<br/>";
          echo ":P Stay outside<br/><br/>";
          echo "<a href=\"index.php?action=chat&amp;sid=$sid&amp;type=send&amp;browse?start\">Chatrooms</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
    }
    }
     if(kick($uid, $rid))
        {
    
          echo "<p align=\"center\">";
          echo "You have been kicked from this room hekhek!<br/>";
          echo ":P Stay outside<br/><br/>";
          echo "<a href=\"index.php?action=chat&amp;sid=$sid&amp;type=send&amp;browse?start\">Chatrooms</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          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 "<meta http-equiv=\"refresh\" content=\"80; URL= chat.php?action=$action&amp;sid=$sid&amp;rid=$rid\"/>";
            echo "<timer value=\"3600\"/><p align=\"left\">";  
                         
     addonline($uid,"Chatrooms","");
       getalert($sid);
    boxstart("Chatrooms");
    echo "<a href=\"chat.php?time=";
    echo date('dmHis');
    echo "&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw";
    echo "\">refresh</a><br/>";
    echo "Message:<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\"><input id=\"inputText\" name=\"message\" type=\"text\" value=\"\" maxlength=\"2550\"/><br/>";
    echo "<input id=\"inputButton\" type=\"submit\" value=\"Send\"/>";
    echo "</form>";
    //$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 "</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) != ""){
    
    $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(iscowner($uid, $rid))
                 {		
         if(!locked($uid, $rid))
        {
         
          echo "<a href=\"genproc.php?action=lock&amp;sid=$sid&amp;rid=$rid&amp;browse?start\">Lock</a><br/>";
        }else{
            echo "<a href=\"genproc.php?action=unlock&amp;sid=$sid&amp;rid=$rid&amp;browse?start\">Unlock</a><br/>";
        }
    }
    if(have())
        {
    if($rid==804)
            {
    
    $range_result = mysql_query( " SELECT MAX(`id`) AS max_id , MIN(`id`) AS min_id FROM `ibwf_quiz` ");
    $range_row = mysql_fetch_object( $range_result ); 
    $random = mt_rand( $range_row->min_id , $range_row->max_id );
    $result = mysql_query( " SELECT question, answer, id FROM `ibwf_quiz` WHERE `id` >= $random LIMIT 0,1 ");
    while($rpgds=mysql_fetch_array($result))
      {
    
     $winner =$rpgds[0];
    $winner2 =$rpgds[1];
    }
    
     $tm = time();
     $time = mysql_fetch_array(mysql_query("SELECT MAX(displaytime) FROM ibwf_quizrooms ORDER by id LIMIT 1"));
      $pmfl = $time[0]+60;
      if($pmfl<$tm)
      {
       mysql_query("INSERT INTO ibwf_chat SET  chatter='133', who='', timesent='".time()."', msgtext='Nobody got the correct answer. Next question.', rid='".$rid."';");
    mysql_query("INSERT INTO ibwf_quizrooms SET  displaytime='".time()."', question='".$winner."', answer='".$winner2."';");
     
     }else{
    $quiz = mysql_query("SELECT question, answer, id FROM ibwf_quizrooms ORDER BY id DESC LIMIT 1");
     while($rpgds=mysql_fetch_array($quiz))
      {
     $question =$rpgds[0];
    $question2 =$rpgds[1];
    $question3 =$rpgds[2];
    }
    
    echo "system: $question"; 
    $rema = $pmfl - $tm;
    if ($rema==60)  
    {
    $kano ="100";
    
    }else if ($rema==59)  
    {
    
    $kano ="100";
    }else if ($rema==58)  
    {
    
    $kano ="90";
    }else if ($rema==57)  
    {
    
    $kano ="90";
    }else if ($rema==56)  
    {
    
    $kano ="80";
    }else if ($rema==55)  
    {
    
    $kano ="80";
    }else if ($rema==54)  
    {
    
    $kano ="80";
    }else if ($rema==53)  
    {
    
    $kano ="70";
    }else if ($rema==52)  
    {
    
    $kano ="70";
    }else if ($rema==51)  
    {
    
    $kano ="60";
    }else if ($rema==50)  
    {
    
    $kano ="50";
    }else if ($rema==49)  
    {
    
    $kano ="40";
    }else if ($rema==48)  
    {
    
    $kano ="40";
    }else if ($rema==47)  
    {
    
    $kano ="40";
    }else if ($rema==46)  
    {
    
    $kano ="40";
    }else if ($rema==45)  
    {
    
    $kano ="38";
    }else if ($rema==44)  
    {
    
    $kano ="38";
    }else if ($rema==43)  
    {
    
    $kano ="38";
    }else if ($rema==42)  
    {
    
    $kano ="38";
    }else if ($rema==41)  
    {
    
    $kano ="35";
    }else if ($rema==40)  
    {
    
    $kano ="35";
    }else if ($rema==39)  
    {
    
    $kano ="35";
    }else if ($rema==38)  
    {
    
    $kano ="35";
    }else if ($rema==37)  
    {
    
    $kano ="35";
    }else if ($rema==36)  
    {
    
    $kano ="35";
    }else if ($rema==35)  
    {
    
    $kano ="35";
    }else if ($rema==34)  
    {
    
    $kano ="35";
    }else if ($rema==33)  
    {
    
    $kano ="35";
    }else if ($rema==32)  
    {
    
    $kano ="35";
    }else if ($rema==31)  
    {
    
    $kano ="33";
    }else if ($rema==30)  
    {
    
    $kano ="33";
    }else if ($rema==29)  
    {
    
    $kano ="33";
    }else if ($rema==28)  
    {
    
    $kano ="33";
    }else if ($rema==27)  
    {
    
    $kano ="33";
    }else if ($rema==26)  
    {
    
    $kano ="33";
    }else if ($rema==25)
    {
    $kano ="33";
    }else if ($rema==24)  
    {
    
    $kano ="30";
    }else if ($rema==23)  
    {
    
    $kano ="30";
    }else if ($rema==22)  
    {
    
    $kano ="30";
    }else if ($rema==21)  
    {
    
    $kano ="26";
    }else if ($rema==20)  
    {
    
    $kano ="26";
    }else if ($rema==19)  
    {
    
    $kano ="26";
    }else if ($rema==18)  
    {
    
    $kano ="26";
    }else if ($rema==17)  
    {
    
    $kano ="25";
    }else if ($rema==16)  
    {
    
    $kano ="25";
    }else if ($rema==15)  
    {
    
    $kano ="25";
    }else if ($rema==14)  
    {
    
    $kano ="20";
    }else if ($rema==13)  
    {
    
    $kano ="20";
    }else if ($rema==12)  
    {
    
    $kano ="20";
    }else if ($rema==11)  
    {
    
    $kano ="20";
    }else if ($rema==10)  
    {
    
    $kano ="18";
    }else if ($rema==9)  
    {
    
    $kano ="17";
    }else if ($rema==8)  
    {
    
    $kano ="17";
    }else if ($rema==7)  
    {
    
    $kano ="16";
    }else if ($rema==6)  
    {
    
    $kano ="15";
    }else if ($rema==5)  
    {
    
    $kano ="13";
    }else if ($rema==4)  
    {
    
    $kano ="10";
    }else if ($rema==3)  
    {
    
    $kano ="6";
    }else if ($rema==2)  
    {
    
    $kano ="5";
    }else if ($rema==1)  
    {
    
    $kano ="4";
    }else if ($rema==0)  
    {
    
    $kano ="0";
    }
    echo " Time Left to answer:$rema seconds.REWARD: $kano Plusses and GP.";
    }
    }
    }
        if($rid==1)
            { 
    
    echo "<a href=\"chat.php?action=reset&amp;sid=$sid&amp;rid=1\">CLEAR DATA</a><br/>";
    }
    if($rid==2)
            { 
    
    $tries2 = mysql_fetch_array(mysql_query("SELECT cards FROM ibwf_spincard"));
    $mama2= $tries2[0];
    if($mama2>0)
     {
    if($spin==1)
            {
    
      $tm = time();
      $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(spintime) FROM ibwf_users WHERE id='".$uid."'"));
      $pmfl = $lastpm[0]+15;
      if($pmfl<$tm)
      {
    
         }else{
    
    $rema = $pmfl - $tm;
    echo "Chat system:&#187;*you can spin cards again after <b>$rema</b> seconds.*<br/>";
    }
    if(!spinned($uid))
        {
    $rpgd = mysql_query("SELECT id, no FROM ibwf_getcards ORDER by RAND() LIMIT 1");
     while($rpgds=mysql_fetch_array($rpgd))
      {
     
    $cards =$rpgds[1];
    }
     if(getplusses(getuid_sid($sid))<10)
        {
            echo "You need 10 plusses in order to spin the wheel!";
        }else{
     mysql_query("UPDATE ibwf_users SET cards=cards+'$cards' WHERE id='".$uid."'");
     mysql_query("UPDATE ibwf_spincard SET cards=cards-'$cards'");
     mysql_query("UPDATE ibwf_users SET plusses=plusses-'1' WHERE id='".$uid."'");
     mysql_query("UPDATE ibwf_users SET spintime='".time()."' WHERE id='".$uid."'");
     mysql_query("UPDATE ibwf_users SET spinned='1' WHERE id='".$uid."'");
    $mycards = mysql_fetch_array(mysql_query("SELECT cards FROM ibwf_users WHERE id='".$uid."'"));
    echo "Chat system:&#187;*you got $cards card(s) for that spin wait after 20 sec to spin cards again. You have $mycards[0] total of cards.*<br/>";
      }
    
    }
    }else{
    
      $tm = time();
      $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(spintime) FROM ibwf_users WHERE id='".$uid."'"));
      $pmfl = $lastpm[0]+20;
      if($pmfl<$tm)
      {
    mysql_query("UPDATE ibwf_users SET spinned='0' WHERE id='".$uid."'");
    $cinfo = mysql_fetch_array(mysql_query("SELECT cards from ibwf_spincard"));
    echo "system</a>&#187;There are $cinfo[0] remaining cards. Click <a href=\"chat.php?spin=1&amp;sid=$sid&amp;rid=$rid\">spin the wheel</a> spin cards to get some cards. Each spin will cost 1 plusses, if you got the highest number of cards after the remaining cards goes to zero, you will get the 1000 plusses prize more info for game info.<br/>";
         }else{
    
    $rema = $pmfl - $tm;
    echo "Chat system:&#187;*you can spin cards again after <b>$rema</b> seconds.*<br/>";
    }
    }
    }else{
    $rpgd = mysql_query("SELECT id, cards FROM ibwf_users ORDER by cards DESC LIMIT 1");
     while($rpgds=mysql_fetch_array($rpgd))
      {
     $winner =$rpgds[0];
    $winner2 =$rpgds[1];
    }
     $unick2 = getnick_uid($winner);
    mysql_query("UPDATE ibwf_spincard SET cards='500'");
    mysql_query("INSERT INTO ibwf_chat SET  chatter='133', timesent='".time()."', msgtext='$unick2 got $winner2 cards, and the 1000 plusses prize', perm='".$perm[0]."', rid='".$rid."';");
    mysql_query("UPDATE ibwf_users SET plusses=plusses+'1000' WHERE id='".$winner."'");
    mysql_query("UPDATE ibwf_users SET cards='0'");
    mysql_query("UPDATE ibwf_users SET spintime='0'");
    }
    }
          if($cancel==1)
            {
    mysql_query("UPDATE ibwf_private SET unread='0' WHERE id='".$idn."'");
    }
    $unreadinbox=mysql_fetch_array(mysql_query("SELECT byuid, text, id 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)
            {
    $text = parsepm($unreadinbox[1], $sid);
    $by = getnick_uid($unreadinbox[0]);
    echo "<b>$by: </b>$text<br/>";
      echo "REPLY:<br/>";
     echo "<form action=\"chat.php?action=sendpm&amp;who=$unreadinbox[0]&amp;sid=$sid&amp;rid=$rid\" method=\"post\">";
      echo "<input name=\"pmtext\" maxlength=\"500\"/><br/>";
      echo "<input type=\"submit\" value=\"Send\"/>";
      echo "</form>";
    echo "<br/><a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw&amp;cancel=1&amp;idn=$unreadinbox[2]&amp;time=$time\">Cancel</a>";
       }
    
       if($rid==1)
            {    
         $uid = getuid_sid($sid);
    
    $nopop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_jnp WHERE touid='".$uid."' AND reply='1'"));
    if($nopop[0]>0)
    {  
     $ncl = mysql_fetch_array(mysql_query("SELECT id, bet, byuid, touid FROM ibwf_jnp WHERE touid='".$uid."' ORDER BY id DESC LIMIT 1"));
    $by = getnick_uid($ncl[2]);
    echo "Jack en Poy challenge from $by BET: $ncl[1]<br/>";
     echo "<form action=\"chat.php?action=jnp&amp;sid=$sid&amp;rid=$rid&amp;time=$time\" method=\"post\">"; 
        echo "JNP Challenge: <select name=\"kamay\">";
     echo "<option value=\"0\">Decline</option>";
     echo "<option value=\"1\">Paper</option>";
      echo "<option value=\"2\">Scissors</option>";
      echo "<option value=\"3\">Rock</option>";
      echo "</select>";
    echo "<input type=\"hidden\" name=\"who\" value=\"$ncl[2]\"/>";
    echo "<input type=\"hidden\" name=\"poy\" value=\"$ncl[0]\"/>";
    echo "<input type=\"submit\" value=\"Send\"/>";    
    echo "</form>";
    }
    }
            $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){
                $perm = mysql_fetch_array(mysql_query("SELECT perm, id FROM ibwf_users WHERE perm>'0' AND id='".$uid."'"));
     
    
    if($rid==804)
        {
    $tid = correct($message,$question3);
      if($tid==0)
        {
     $by = getnick_uid($uid);
     mysql_query("INSERT INTO ibwf_chat SET  chatter='133', timesent='".time()."', msgtext='$by sorry your answer is incorrect.Please try again', rid='".$rid."'");
      mysql_query("UPDATE ibwf_users SET plusses=plusses-'3' WHERE id='".$uid."'");
        }else{
    $range_result = mysql_query( " SELECT MAX(`id`) AS max_id , MIN(`id`) AS min_id FROM `ibwf_quiz` ");
    $range_row = mysql_fetch_object( $range_result ); 
    $random = mt_rand( $range_row->min_id , $range_row->max_id );
    $result = mysql_query( " SELECT question, answer, id FROM `ibwf_quiz` WHERE `id` >= $random LIMIT 0,1 ");
    while($rpgds=mysql_fetch_array($result))
      {
    
     $winner =$rpgds[0];
    $winner2 =$rpgds[1];
    }
     mysql_query("DELETE FROM ibwf_quiz WHERE id='".$question3."'");
    mysql_query("INSERT INTO ibwf_quizrooms SET  displaytime='".time()."', question='".$winner."', answer='".$winner2."';");
    
     $by = getnick_uid($uid);
        mysql_query("INSERT INTO ibwf_chat SET  chatter='133', who='".$who."', timesent='".time()."', msgtext='$by you are correct. [b]$message [/b] you got $kano plusses. Next question', rid='".$rid."'");
     mysql_query("UPDATE ibwf_users SET plusses=plusses+'$kano' WHERE id='".$uid."'");
     mysql_query("UPDATE ibwf_users SET gplus=gplus+'$kano' WHERE id='".$uid."'");
     mysql_query("DELETE FROM ibwf_quizrooms WHERE id='".$question3."'");
    
    }
     }
      $chatok = mysql_query("INSERT INTO ibwf_chat SET  chatter='".$uid."', who='".$who."', timesent='".time()."', msgtext='".$message."', perm='".$perm[0]."', 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($rid!==2)
            { 
    if($rid!==1)
            { 
                $hehe2=mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
                $totl2 = $hehe2[0]+1;
                $msgst2= mysql_query("UPDATE ibwf_users SET plusses='".$totl2."' WHERE id='".$uid."'");
    }
    }
    if($rinfo[1]==2)
                {
                  //oh damn i gotta post this message to ravebabe :(
                  //will it succeed?
                  $botid = "f71659fb4e369b0f";
                  $hostname = "www.pandorabots.com";
                  $hostpath = "/pandora/talk-xml";
                  $sendData = "botid=".$botid."&input=".urlencode($message)."&custid=".$custid;
                  
                  $result = PostToHost($hostname, $hostpath, $sendData);
                  
                  $pos = strpos($result, "custid=\"");
                  $pos = strpos($result, "<that>");
        	if ($pos === false) {
        		$reply = "";
        	} else {
        		$pos += 20;
        		$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='14', 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<20)
                    {
                      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[5]==3)
             {
            $chat[5] = "&#185;";
           
       }else if($chat[5]==2)
          {
          $chat[5] = "&#178;";
          }else if($chat[5]==1)
          {
            $chat[5] = "&#179;";
          }else if($chat[5]==0)
          {
            $chat[5] = "";
         }
                    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))
                      {
    echo "<br/>";                    
    $chnick = getnick_uid($chat[0]);
                        echo "<b>Nephi (bot):<i> No spamming $chnick!</i></b><br/>";
                      }
                      else if($nos>2){
     echo "<br/>";                    
    $chnick = getnick_uid($chat[0]);
                        echo "<b>Nephi (bot):<i> $chnick, you can only use 2 smilies per message.</i></b><br/>";
                      }else{
                        $sres = substr($chat[3],0,3);
                        
     $sres = substr($chat[3],0,5);
      if($sres == "/saay")
      {
      $chco = strlen($chat[3]);
      $goto = $chco - 5;
      $rest = substr($chat[3],5,$goto);
      $tosay = strClean(parsepm($rest, $sid));
        
      echo addchatmsg($chat[0],$tosay,1,"");
      }else if($nosm[0]>1){
                          echo "<i>*Hey! $chnick, You cannot flood this room!*</i></b><br/>";
                          
                                            }
    else{
      if($rinfo[0]==0){$tosay = strClean(getbbcode($chat[3], $sid, 0));}
      else{
                  $tosay = parsepm($chat[3], $sid);
                          
                          if($rinfo[0]==1)
                          {
                             $tosay = str_replace("****","*no swearing!*",$tosay);
                             $tosay = str_replace("****","*no swearing!*",$tosay);
                             $tosay = str_replace("dick","*inappropriate words are allowed in this site!*",$tosay);
                             $tosay = str_replace("pussy","*inappropriate words are allowed in this site!*",$tosay);
                             $tosay = str_replace("cock","*inappropriate words are allowed in this site!*",$tosay);
                             $tosay = str_replace("mod","*word not allowed!*",$tosay);
    						 $tosay = str_replace("can i be admin?","*get yourself a site!*",$tosay);
    						 
    						 $tosay = str_replace("ginger","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("neon","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("kaas","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("slut","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("kahla","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("gago","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("puta","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("putang ina","*inappropriate words are allowed in this site!*",$tosay);
    						 $tosay = str_replace("tangina","*inappropriate words are allowed in this site!*",$tosay);
    						$tosay = str_replace("ulol","*inappropriate words are allowed in this site!*",$tosay);	
    					        $tosay = str_replace("kupal","*inappropriate words are allowed in this site!*",$tosay);					
    					   }
                          
                          if($rinfo[1]==1)
                          {
                              $tosay = htmlspecialchars($chat[3]);
                              $tosay = strrev($tosay);
                            }
                            }
                       echo "<br/><a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$chat[0]&amp;rid=$rid&amp;rpw=$rpw\">$optlink$chat[5]</a>:$tosay";
                      }
                    }
                   
                      $counter++;
                    }
                    }
                }
                echo "</small>";
                echo "</p>";
            
            echo "<p align=\"left\">";
    echo "<a href=\"chat.php?action=say&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Message</a><br/>";
            echo "<a href=\"chat.php?time=";
            echo date('dmHis');
            echo "&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw";
            echo "\">Refresh</a>";
    	if(ismod($uid))
      {
    echo "<a href=\"lists.php?action=kicklist&amp;sid=$sid&amp;rid=$rid\">----Kick List</a>";
    }
            $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\">Other chatrooms</a><br/>";
    boxend();
    
     echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a><br/>";
      
            echo "</body>";
    }
    /////////////////////////////////////////////////////SAY
            else if ($action=="options")                   {
                    
            addonline($uid,"Chatroom Options","");
              
                echo "<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\">";
                echo "<p>Message:<input name=\"message\" type=\"text\" value=\"\" maxlength=\"2550\"/><br/>";
                echo "<input type=\"submit\" value=\"Send\"/>";
                echo "</form><br/>";
                echo "<small><a href=\"lists.php?action=chmood&amp;sid=$sid&amp;page=1\">&#187;Chat mood</a></small><br/>";
                echo "<small><a href=\"chat.php?action=smilies&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">&#187;Smilies</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\">Chatrooms</a><br/>";
            echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>Home</a></p>";
    
            echo "</body>";
                                                   }
                   else if ($action=="say")                   {
           
            
            addonline($uid,"Writing Chat Message","");
             
    
      getalert($sid); 
      boxstart("Write Message");
                echo "<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\">";
                echo "<p>Message:<input name=\"message\" type=\"text\" value=\"\" maxlength=\"2550\"/><br/>";
                echo "<input type=\"submit\" value=\"Say\"/>";
                echo "</form><br/>";
                //echo "<small><a href=\"lists.php?action=chmood&amp;sid=$sid&amp;page=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 "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Back to room</a></p>";
            //end
            
            echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Other chatrooms</a><br/>";
    boxend();
    
     echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a><br/>";
            echo "</body>";
                                                   } 
         ////////////////////////////////////////////
        /////////////////////////////////////////////////////SAY2
            else if ($action=="say2")                   {
            echo "<p align=\"center\">";
            $unick = getnick_uid($who);
        
      getalert($sid);
    boxstart("Private");
            echo "<b>Private to $unick</b>";
            echo "</p>";
            echo "<p align=\"left\">";
            addonline($uid,"Writing chat message","");
             if($rid==1)
            {
     echo "<form action=\"chat.php?action=jnpc&amp;sid=$sid&amp;rid=$rid&amp;time=$time\" method=\"post\">"; 
        echo "JNP Challenge: <select name=\"kamay\">";
      echo "<option value=\"1\">Paper</option>";
      echo "<option value=\"2\">Scissors</option>";
      echo "<option value=\"3\">Rock</option>";
      echo "</select>";
        echo "<br/>BET: <input name=\"bet\" maxlength=\"4\" size=\"3\" format=\"*N\"/> ";
    echo "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
    echo "<input type=\"submit\" value=\"Send\"/>";    
    echo "</form>";
    }
                echo "<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\">";
                echo "Message:<input name=\"message\" type=\"text\" value=\" \" maxlength=\"2550\"/><br/>";
                echo "<input type=\"submit\" value=\"Send PM\"/>";
                echo "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
                echo "</form>";
                echo "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$who\">View $unick's Profile</a><br/>";
                echo "<a href=\"chat.php?action=expose&amp;sid=$sid&amp;who=$who&amp;rid=$rid&amp;rpw=$rpw\">Expose $unick</a><br/>";
    
                        if(iscowner($uid, $rid))
                 {		
         if(!kick($who, $rid))
        {
         
          echo "<a href=\"genproc.php?action=kick&amp;sid=$sid&amp;who=$who&amp;rid=$rid\">Kick</a><br/>";
        }else{
            echo "<a href=\"genproc.php?action=unkick&amp;sid=$sid&amp;who=$who&amp;rid=$rid\">Unkick</a><br/>";
        }
    }
         
                echo "<a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Who's inside</a><br/>";
                echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Back to room</a></p><br/>";
            //end
            
            echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Other chatrooms</a><br/>";
                boxend();
     echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a><br/>";
     echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a><br/>";
            echo "</body>";
                                                   }
            ////////////////////////////////////////////
            //////////////////////////////inside//////////
            else if ($action=="inside")           {
              
              addonline($uid,"Who's inside list","");
             
      getalert($sid);
    boxstart("Who's inside");
            echo "<card id=\"main\" title=\"Inside list\">";
            echo "<p align=\"left\"><br/>";
            $inside=mysql_query("SELECT DISTINCT * FROM ibwf_chonline WHERE rid='".$rid."' and uid IS NOT NULL");
            
            while($ins=mysql_fetch_array($inside))
            {
             $who = $ins[1];
    $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
    $var1 = date("His",$noi[0]);
    $var2 = time();
    $var21 = date("His",$var2);
    $var3 = $var21 - $var1;
    $var4 = date("s",$var3);
    $remain = time() - $noi[0];
    $idle = gettimemsg($remain);
    $idle2 = "- idle:";
    
              $unick = getnick_uid($ins[1]);
              $userl = "<a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$ins[1]&amp;rid=$rid&amp;rpw=$rpw\">$unick</a> $idle2 $idle<br/>";
              echo "$userl";
            }
            echo "<br/><br/>";
            echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Back to room</a><br/>";
            echo "<br/><a href=\"index.php?action=chat&amp;sid=$sid\">Other chatrooms</a><br/>";
    
            boxend();
     echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a><br/>";
            echo "</body>";
                                               }
            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;Back to room</a><br/>";
            echo "<br/><a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
            echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>Home</a></p>";
    
            echo "</body>";
                                               }
            //////////////////////////////////Smilies :)
    
    else if($action=="smilies")
    {
        addonline(getuid_sid($sid),"Viewing The Smilies List","");
            
        echo "<small><a href=\"chat.php?action=options&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Options</a>, ";
        echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Chatroom</a><br/></small>";
        //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_smilies"));
        $num_items = $noi[0]; //changable
        $items_per_page= 5;
        $num_pages = ceil($num_items/$items_per_page);
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
    
        //changable sql
    
            $sql = "SELECT id, scode, imgsrc FROM ibwf_smilies ORDER BY id DESC LIMIT $limit_start, $items_per_page";
    
    
        echo "<p>";
        $items = mysql_query($sql);
    	
        echo mysql_error();
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
       {
    		if(isadmin(getuid_sid($sid)))
    		{
    			$delsl = "<a href=\"admproc.php?action=delsm&amp;sid=$sid&amp;smid=$item[0]\">[x]</a>";
    		}else{
    			$delsl = "";
    		}
            echo "$item[1] &#187; ";
            echo "<img src=\"$item[2]\" alt=\"$item[1]\"/> $delsl<br/>";
        }
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"lists.php?action=smilies&amp;page=$ppage&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"chat.php?action=smilies&amp;page=$npage&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
          $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
            $rets .= "<anchor>[GO]";
            $rets .= "<go href=\"chat.php\" method=\"get\">";
            $rets .= "<postfield name=\"action\" value=\"$action\"/>";
            $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
            $rets .= "<postfield name=\"rid\" value=\"$rid\"/>";
            $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
            $rets .= "</go></anchor>";
    
            echo $rets;
        }
        echo "</p>";
      ////// UNTILL HERE >>
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>Home</a>";
        echo "</p>";
        echo "</body>";
    }
    
        else if ($action=="jnpc")         
      {
     $who = $_POST["who"];
              $bet =$_POST["bet"];
        $kamay =$_POST["kamay"];
    $tnick = getnick_uid($who);
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
    
     if($uid==$who)
    			{
      
      getalert($sid);
    boxstart("Error");
         echo "You cannot challenge yourself!<br/>";
     
     }else{
    if($bet<=19)
    {
     
      getalert($sid);
    boxstart("Error");
       echo "We accept above 20 bet to make a challenge!<br/>";
    
     }else{
    if(chall($uid,$who))
        {
        
      getalert($sid);
    boxstart("Error");
      echo "You have a pending challenge<br/>";
    
     }else{
     $gpsf = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
      $gpst = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
      if($gpsf[0]>=$bet)
    {
     if($gpst[0]>=$bet)
    {
        $res = mysql_query("INSERT INTO ibwf_jnp SET touid='".$who."', byuid='".$uid."', hand='".$kamay."', reply='1', bet='".$bet."', actime='".time()."'");
      if($res)
            {
         
     
      getalert($sid);
    boxstart("Success!");
                echo "Jack en poy challenge with $bet has been sent to $tnick<br/>";
    
            }else{
               
      getalert($sid);
    boxstart("Error");
              echo "Database error<br/>";
    
            }
          }else{
    
              echo "Either you or your opponent has insufficient coins to complete this request!<br/>";
            }
            }else{
              echo "Either you or your opponent has insufficient coins to complete this request!<br/>";
            }    
    
    }
    }
    }
     echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw&amp;type=send&amp;time=$time\">back to room</a><br/>";
     boxend();
    
      echo "</body>";
    }
      else if ($action=="jnp")         
      {
     $who = $_POST["who"];
            
        $kamay =$_POST["kamay"];
    $poy =$_POST["poy"];
    
      
      echo "<p align=\"center\">";
      //$uid = getuid_sid($sid);
    
     if($uid==$who)
    			{
         echo "You cannot challenge yourself!<br/>";
     }else{
     $gpsf = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
      $gpst = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
     $number = mysql_fetch_array(mysql_query("SELECT hand, bet FROM ibwf_jnp WHERE id='".$poy."'"));
    $number2 = $number[0];  
    $bet2 = $number[1]; 
    $plus = $number[1]; 
    if($gpsf[0]>=$bet2)
    {
     if($gpst[0]>=$bet2)
    {
    $unick = getnick_uid($uid);
    
    if ($kamay=="1") 
    {
    $pchoice = "Paper";
    if ($number2 =="1") 
    {
                            $cchoice = "Paper";
                              
                            echo_scores2($uid,$poy,$pchoice,$cchoice,drew);
                            $msg = "Challenge draw with $unick!"."";
    			autopm($msg, $who);
      mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                       
                    
                        }
    else if ($number2 =="2") 
    {
                           
    			$cchoice = "Scissors";
                          echo_scores2($uid,$poy,$pchoice,$cchoice,lost);
                   mysql_query("UPDATE ibwf_users SET plusses=plusses-'$number[1]' WHERE id='".$uid."'");
                    mysql_query("UPDATE ibwf_users SET plusses=plusses+'$plus' WHERE id='".$who."'");
              echo "$number[1] coins have been deducted to your account.";
                    $msg = "You have defeated $unick in your jack en poy challenge and you got $plus coins."."";
    			autopm($msg, $who);
                          mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
     }
    else if ($number2 =="3")  
    {
                         
    			$cchoice = "Rock";
                         echo_scores2($uid,$poy,$pchoice,$cchoice,won);
                       mysql_query("UPDATE ibwf_users SET plusses=plusses-'$number[1]' WHERE id='".$who."'");
                    mysql_query("UPDATE ibwf_users SET plusses=plusses+'$plus' WHERE id='".$uid."'");
              echo "You won! $plus coins added to your account!";
                    $msg = "You have been defeated by $unick. $number[1] coins has been deducted to your account!"."";
    			autopm($msg, $who);
                      mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                      }
    else if ($number2 =="")  
    {
             
              echo "Not in game!";
                
                      }
    }
    if ($kamay=="2") 
    {
    	$pchoice = "Scissors";
    if ($number2 =="1") 
    {
                        
    			$cchoice = "Paper";
                        echo_scores2($uid,$poy,$pchoice,$cchoice,won);
                         
                         mysql_query("UPDATE ibwf_users SET plusses=plusses-'$number[1]' WHERE id='".$who."'");
                    mysql_query("UPDATE ibwf_users SET plusses=plusses+'$plus' WHERE id='".$uid."'");
              echo "You won! $plus coins added to your account!";
                    $msg = "You have been defeated by $unick. $number[1] coins has been deducted to your account!"."";
    			autopm($msg, $who);
                      mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                        }
    else if ($number2 =="2")
     {
                            $cchoice = "Scissors";
                         echo_scores2($uid,$poy,$pchoice,$cchoice,drew);
    	           $msg = "Challenge draw with $unick!"."";
    			autopm($msg, $who);
                        mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                    
                        }
    else if ($number2 =="3") 
    {
                    
    			$cchoice = "Rock";
                          echo_scores2($uid,$poy,$pchoice,$cchoice,lost);
                       mysql_query("UPDATE ibwf_users SET plusses=plusses-'$number[1]' WHERE id='".$uid."'");
                    mysql_query("UPDATE ibwf_users SET plusses=plusses+'$plus' WHERE id='".$who."'");
             
                    $msg = "You have defeated $unick in your jack en poy challenge and you got $plus coins."."";
    			autopm($msg, $who);
                    
                 mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                 }
    else if ($number2 =="")  
    {
             
              echo "Not in game!";
                
                      }
    }
    if ($kamay=="3") 
    {
    	$pchoice = "Rock";
    if ($number2 =="1") 
    {
                    
    			$cchoice = "Paper";
                            echo_scores2($uid,$poy,$pchoice,$cchoice,lost);
    		    mysql_query("UPDATE ibwf_users SET plusses=plusses-'$number[1]' WHERE id='".$uid."'");
                    mysql_query("UPDATE ibwf_users SET plusses=plusses+'$plus' WHERE id='".$who."'");
            
                    $msg = "You have defeated $unick in your jack en poy challenge and you got $plus coins."."";
    			autopm($msg, $who);
                     mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                     }
    else if ($number2 =="2") 
    {
                   
    			$cchoice = "Scissors";
                             echo_scores2($uid,$poy,$pchoice,$cchoice,won);
    		      
                        mysql_query("UPDATE ibwf_users SET plusses=plusses-'$number[1]' WHERE id='".$who."'");
                    mysql_query("UPDATE ibwf_users SET plusses=plusses+'$plus' WHERE id='".$uid."'");
              echo "You won! $plus coins added to your account!";
                    $msg = "You have been defeated by $unick. $number[1] coins has been deducted to your account!"."";
    			autopm($msg, $who);
                         mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                        }
    else if ($number2 =="3") {
                            $cchoice = "Rock";
                            echo_scores2($uid,$poy,$pchoice,$cchoice,drew);
                         mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
                     $msg = "Challenge draw with $unick!"."";
    			autopm($msg, $who);
                              }
    else if ($number2 =="")  
    {
             
              echo "Not in game!";
                
                      }
    }
    if ($kamay == 0) {
      if($kamay==0)
                {
                  $msg = "declined";
                }else{
                    $msg = "";
                }
    echo "Challenge declined!<br/>";
    
                  $msg = "".getnick_uid(getuid_sid($sid))." has $msg to your jack en poy challenge!"."";
    			autopm($msg, $who);
    mysql_query("DELETE FROM ibwf_jnp WHERE touid='".$uid."' AND byuid='".$who."'");
     
        }
          }else{
              echo "Either you or your opponent has insufficient coins to complete this request!<br/>";
           
                  $msg = "Either you or your opponent has insufficient coins to complete this request!"."";
    			autopm($msg, $who);
    mysql_query("DELETE FROM ibwf_jnp WHERE id='".$poy."'");
            }
            }else{
              echo "Either you or your opponent has insufficient coins to complete this request!<br/>";
            }    
       }
    echo "<br/><a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw&amp;type=send&amp;time=$time\">back to room</a><br/>";
      echo "</p>";
      echo "</body>";
    }
       else if ($action=="reset")           
    {
    
              
            
            echo "<p align=\"center\">DATA Reset Successfully";
            mysql_query("DELETE FROM ibwf_jnp WHERE byuid='".$uid."'");
          echo "<br/><a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw&amp;type=send&amp;time=$time\">back to room</a><br/>";
            echo "</p></body>";
                      }    
    if($action=="sendpm")
    {
    $pmtext = $_POST["pmtext"];
      echo "<p align=\"center\">";
      $whonick = getnick_uid($who);
      $byuid = getuid_sid($sid);
       if(($pmtext==""))
            {
         echo "Dont leave them empty!";
           }else{
    $tm = time();
      $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
      $pmfl = $lastpm[0]+getpmaf();
      if($byuid==1)$pmfl=0;
      if($pmfl<$tm)
      {
        if(!isblocked($pmtext,$byuid))
        {
        if((!isignored($byuid, $who))&&(!istrashed($byuid)))
        {
      $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");
      }else{
        $res = true;
      }
      if($res)
      {
    
    mysql_query("UPDATE ibwf_private SET unread='0' WHERE id='".$idn."'");
        echo "PM was sent successfully to $whonick<br/><br/>";
        echo parsepm($pmtext, $sid);
        
      }else{
        echo "Can't Send PM to $whonick<br/><br/>";
      }
      }else{
        $bantime = time() + (7*24*60*60);
    
        echo "Can't Send PM to $whonick<br/><br/>";
        echo "You just sent a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your plusses<br/>3. You are BANNED!";
        mysql_query("INSERT INTO ibwf_penalties SET uid='".$byuid."', penalty='1', exid='1', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
        mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$byuid."'");
        mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='2', timesent='".$tm."'");
      }
      }else{
        $rema = $pmfl - $tm;
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>";
        echo "Flood control: $rema Seconds<br/><br/>";
      }
    }
      echo "<br/><a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw&amp;type=send&amp;time=$time\">back to room</a><br/>";
    ///$plc = mysql_fetch_array(mysql_query("SELECT saan FROM ibwf_users WHERE id='".$uid."'"));
    
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Home</a>";
      echo "</p>";
        echo "</body>";
    }
    ?>
    </html>
    anyone care to help

    #2
    have you looked in the core for chat post and sql first ?
    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

    Working...
    X