quiz room

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

    quiz room

    i cant figure out whats wrong with this quiz room script. pls help.

    chat.php
    PHP Code:
    <?php
    if(!defined('MG3_PAGES_INCLUDE')){
     
    define('HACKERSTOP','YES');
    include_once 
    "incFiles/hackStop.inc.php";
    header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
    exit();
    }

    include_once 
    "incFiles/core.inc.php";
    include_once 
    "incFiles/islogged.inc.php";
    include_once 
    "incFiles/processes.inc.php";
    include_once 
    "classFiles/robot.class.php";

    //Load Variables//
    $FILENAME "mchat.php";
    $docInfo=docInformation(); 
    $docIP=$docInfo['ip'];
    $docAgent=$docInfo['realagent'];
    $uip $docIP;
    $ubr $docAgent;

    $exe=docGet("exe");
    $sid=docSession("mGSID");
    $csrf=new CsrfProtect;
    $csrf->enable();
    $page=docGet("page");
    $who=docGet("who");
    $pid=docGet("pid");
    $rpw=docGet("rpw");
    $rid=docGet("rid");
    $go=docGet("go");
    $view=docGet("view");
    $by=docGet("by");

    $uid = (int) getuid_sid($sid);
    $nick getnick_sid($sid);
    $uexist isuser($uid);

    /////////////Persistent naughty users
    if(isipbanned($uip,$ubr)){
     if(!
    isshield(getuid_sid($sid))){
     
    header('Location: index.php?ref=3');
     exit();
     }
    }


    /////////////Oops, Not Logged-In
    if((islogged($sid)==false||$uid==0)){
    header('Location: index.php?ref=6');
    exit();
    }

    /////////////Aah, Naughty User
    if(isbanned(getuid_sid($sid))){
    mysql_query("DELETE FROM m_token WHERE id='".$sid."'");
    header('Location: index.php?ref=4&who='.$uid.'');
    exit();
    }

    /////////////Does room exist?
    $isroom mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM m_mchatrooms WHERE id='".$rid."'"));
    if(
    $isroom[0]==0){
    header('Location: home.php?exe=chat&ref=1&who='.$uid.'');
    exit();
    }

    /////////////Password room
    $passworded mysql_fetch_array(mysql_query("SELECT pass FROM m_mchatrooms WHERE id='".$rid."'"));
    if(
    $passworded[0]!=""){
     if(
    $rpw!=$passworded[0]){
     
    header('Location: home.php?exe=chat&ref=2&who='.$uid.'');
     exit();
     }
    }

    //////////////Requires validation sorry
    if(!isvalidated(getuid_sid($sid))){
    header('Location: home.php?exe=chat&ref=4&who='.$uid.'');
    exit();
    }

    /////////////Freezed users dont chat lol
    if(isfreezed(getuid_sid($sid))){
    header('Location: home.php?exe=chat&ref=5&who='.$uid.'');
    exit();
    }

    /////////////You need clearance?
    if(!canenter($rid,$sid)){
    header('Location: home.php?exe=chat&ref=3&who='.$uid.'');
    exit();
    }

    mysql_query("UPDATE m_usrs SET browser='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

    ///////////////Oh wait, there any instant messages?
    if(isset($_POST['IMText'])){
    $ntfou "";
    $NotFound '';
    if(!
    isuser($who) && $who!=""){ $who '1'$ntfou $LANG['ntfou']; $NotFound '1'; }
     if(
    $NotFound == '1'){ $u2uto ''; }
     else{ 
    $u2uto $who; }
    $U2UText docPost('IMText');
    DumpReplyIMS($U2UText,$u2uto,$sid);
    }

    if(!isset(
    $_POST['message'])&&!isset($_POST['JnPMove'])&&!isset($_POST)){
    DumpUnreadIMS($sid);
    }

    /////////////////////////////mChat v1.0 start

    $timeto 6*60;
    $timenw time();
    $timeout $timenw-$timeto;
    $deleted mysql_query("DELETE FROM m_mchat WHERE timesent<".$timeout."");
    $rooms mysql_fetch_array(mysql_query("SELECT id, name FROM m_mchatrooms WHERE id='".$rid."'"));
    $rname $rooms[1];
    addonline(getuid_sid($sid),"Chat (".$rname.")","mchat.php?rid=$rid&amp;rpw=$rpw");

    $rrr mys_select("SELECT COUNT(*) FROM m_mchatonline WHERE uid='".$uid."' AND rid='".$rid."'");
    addtochat($uid$rid);

    if(
    $exe==""){

    startChatFile($nick." @ ".$rname,"",$sid);

    if(isset(
    $_GET['do'])&&isadmin(getuid_sid($sid))){
    ProcessClearChat($who,$rid,$sid);
    }

    echo 
    "<a name=\"top\"></a>";

    $who=docPost("who");
    $message=docPost("message");

    $chas mysql_fetch_array(mysql_query("SELECT chatter, who, msgtext FROM m_mchat WHERE rid='".$rid."' ORDER BY timesent DESC, id DESC"));
    if(
    $chas[2]==$message){ $message ""; }

    $rinfo mysql_fetch_array(mysql_query("SELECT censord, freaky, game FROM m_mchatrooms WHERE id='".$rid."'"));

    if(
    have())
        {
    if(
    $rid==11)
            {

    $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(timesent) FROM m_mchat ORDER by id LIMIT 1"));
      
    $pmfl $time[0]+60;
      if(
    $pmfl<$tm)
      {
       
    mysql_query("INSERT INTO m_mchat SET  chatter='1', who='', timesent='".time()."', msgtext='Nobody got the correct answer. Next question.', rid='".$rid."';");
    mysql_query("INSERT INTO m_mchat SET  timesent='".time()."', question='".$winner."', answer='".$winner2."';");
     
     }else{
    $quiz mysql_query("SELECT question, id, answer FROM ibwf_quiz ORDER BY question DESC LIMIT 0,1"); 
     while(
    $rpgds=mysql_fetch_array($quiz))
      {
     
    $question =$rpgds[0];
    $question2 =$rpgds[1];
    $question3 =$rpgds[2];
    }

    echo 
    "<b>QM:</b> <u>$question</u>"
    $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 
    "<br/>Time Left to answer:$rema seconds.REWARD: $kano Vlings.";
    }
    }
    }

    if(
    $rinfo[2]==1&&$rrr[0]==0){
    echo 
    "<div id=\"noti\" align=\"center\">Gaming Room: Jack En Poy.</div>";
    }elseif(
    $rinfo[2]==1){
    echo 
    "<div id=\"noti\" align=\"center\"><b>*<a href=\"home.php?exe=statlist&amp;view=jnp&amp;by=jnp\">Top Players</a>*</b></div>";
    }


    if(isset(
    $_POST['JnPMove'])){
    $sendto=(int) docPost('user');
     if(isset(
    $_POST['bet'])){
     
    $SetBet=(int) docPost('bet');
     
    $JnPMove=(int) docPost('JnPMove');
      if(
    $JnPMove==1||$JnPMove==2||$JnPMove==3){
      
    ProcessNewJnP($sendto,$SetBet,$JnPMove,$sid);
      }
     }elseif(isset(
    $_POST['poy'])){
     
    $PoyId=(int) docPost('poy');
     
    $JnPMove=(int) docPost('JnPMove');
      if(
    $JnPMove==0||$JnPMove==1||$JnPMove==2||$JnPMove==3){
      
    ProcessPendingJnP($sendto,$PoyId,$JnPMove,$sid);
      }
     }
    }

    //////////////////////GAMES
    $jnproom $rinfo[2];
    if(
    $jnproom==1){
    $timeto 20*60;
    $timenw time();
    $timeout $timenw-$timeto;
    mysql_query("DELETE FROM m_mjnp WHERE dtime<".$timeout."");
    $uid getuid_sid($sid);
    $noj mys_select("SELECT COUNT(*) FROM m_mjnp WHERE touid='".$uid."' AND unread='0'");
     if(
    $noj[0]>0){
     
    $deta mys_select("SELECT id, bet, byuid, touid, dtime, hand FROM m_mjnp WHERE touid='".$uid."' ORDER BY id DESC LIMIT 1");
     echo 
    "<div id=\"notism\"><b>New JnP Challenge</b><br/>";
     echo 
    "From: <b>".getnick_uid($deta[2])."</b>, Bet: <b>".$deta[1]."</b>Vs<br/>";
     
    $tmago time() - $deta[4];
     
    $tmexp floor(((20*60) - $tmago) / 60 ); 
     echo 
    "Expires: ".$tmexp." Minutes<br/>";
    if(
    getuid_sid($sid)==2&&isowner(getuid_sid($sid))){
    echo 
    "Wh".$deta[5]."t Now?!<br/>";
    }
     echo 
    "\n<form action=\"".$FILENAME."?exe=$exe&amp;rid=$rid&amp;time=".time()."\" method=\"post\" name=\"JnP\">";
     echo 
    "<select name=\"JnPMove\">\n";
     echo 
    "<option value=\"0\">Decline</option>\n";
     echo 
    "<option value=\"1\">Paper</option>\n";
     echo 
    "<option value=\"2\">Scissors</option>\n";
     echo 
    "<option value=\"3\">Rock</option>\n";
     echo 
    "</select>\n";
     echo 
    "<input type=\"submit\" name=\"submit\" value=\"Move\">\n";
     echo 
    "<input type=\"hidden\" name=\"user\" value=\"".$deta[2]."\">\n";
     echo 
    "<input type=\"hidden\" name=\"poy\" value=\"".$deta[0]."\">\n";
     echo 
    "</form>\n";
     echo 
    "</div>";
     }
    }
    elseif(
    $jnproom==2){ 
    function 
    spinned($uid){
    $not mysql_fetch_array(mysql_query("SELECT spinned FROM m_usrs WHERE id='".$uid."'"));
     if(
    $not[0]=='1'){ return true; }else{ return false;  }
    }
    $tries2 mysql_fetch_array(mysql_query("SELECT cards FROM m_spincard"));
    $mama2$tries2[0];
     if(
    $mama2>0){
    $spiin=docGet('spin');
      if(
    $spiin==1){
      
    $tm time();
      
    $lastpm mysql_fetch_array(mysql_query("SELECT MAX(spintime) FROM m_usrs WHERE id='".getuid_sid($sid)."'"));
      
    $pmfl $lastpm[0]+20;
       if(
    $pmfl>$tm){
       
    $rema $pmfl $tm;
       echo 
    "<div id=\"notif\">Wait $rema seconds for another spin.</div>";
       }
       if(!
    spinned($uid)){
       
    $rpgd mysql_query("SELECT id, no FROM m_spingetcards ORDER by RAND() LIMIT 1");
        while(
    $rpgds=mysql_fetch_array($rpgd)){
        
    $cards $rpgds[1];
        }
        if(
    getVlings(getuid_sid($sid))<10){
        echo 
    "<div id=\"notif\">You need 10vlings in order to spin the wheel.</div>";
        }else{
        
    mysql_query("UPDATE m_usrs SET cards=cards+'$cards' WHERE id='".$uid."'");
        
    mysql_query("UPDATE m_spincard SET cards=cards-'$cards'");
        
    mysql_query("UPDATE m_usrs SET vlings=vlings-'1' WHERE id='".$uid."'");
        
    mysql_query("UPDATE m_usrs SET spintime='".time()."' WHERE id='".$uid."'");
        
    mysql_query("UPDATE m_usrs SET spinned='1' WHERE id='".$uid."'");
        
    $mycards mysql_fetch_array(mysql_query("SELECT cards FROM m_usrs WHERE id='".$uid."'"));
        echo 
    "<div id=\"noti\">You got $cards card(s) for that spin. Total Cards: $mycards[0]</div>";
        }
       }
      }else{
      
    $tm time();
      
    $lastpm mysql_fetch_array(mysql_query("SELECT MAX(spintime) FROM m_usrs WHERE id='".$uid."'"));
      
    $pmfl $lastpm[0]+20;
       if(
    $pmfl<$tm){
       
    mysql_query("UPDATE m_usrs SET spinned='0' WHERE id='".$uid."'");
       
    $cinfo mysql_fetch_array(mysql_query("SELECT cards from m_spincard"));
       echo 
    "<div id=\"notism\">There are $cinfo[0] remaining cards. Click <a href=\"mchat.php?spin=1&amp;rid=$rid\">spin the wheel</a> to get some cards. Each spin will cost 1Vling, highest number of cards after the remaining cards goes to zero, will get the 100Vs.</div>";
       }else{
       
    $rema $pmfl $tm;
       echo 
    "<div id=\"notif\">Wait $rema seconds for another spin.</div>";
       }
      }
     }else{

     
    $rpgd mysql_query("SELECT id, cards FROM m_usrs 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 m_spincard SET cards='500'");
     
    mysql_query("INSERT INTO m_mchat SET  chatter='3', timesent='".time()."', msgtext='$unick2 got $winner2 cards, and the 100 vlings prize', rid='".$rid."';");
     
    mysql_query("UPDATE m_usrs SET vlings=vlings+'100' WHERE id='".$winner."'");
     
    mysql_query("UPDATE m_usrs SET cards='0'");
     
    mysql_query("UPDATE m_usrs SET spintime='0'");
     }
    }


    if (
    trim($message) != ""){
    $nosm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM m_mchat WHERE msgtext='".$message."' AND chatter='".$uid."' AND who='".$who."'"));
     if(
    $nosm[0]<1){
        
    $message dbParse($message);

    if(
    $rid==11)
        {
    $tid correct($message,$question3);
      if(
    $tid==0)
        {
     
    $by getnick_uid($uid);
     
    mysql_query("INSERT INTO m_mchat SET  chatter='1', timesent='".time()."', msgtext='$by sorry your answer is incorrect.Please try again', rid='".$rid."'");
     
    mysql_query("UPDATE m_usrs SET vlings=vlings-'3' WHERE id='".$winner."'");
        }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 m_mchat WHERE id='".$question3."'");
    mysql_query("INSERT INTO m_mchat SET  timesent='".time()."', question='".$winner."', answer='".$winner2."';");

     
    $by getnick_uid($uid);
        
    mysql_query("INSERT INTO m_mchat SET  chatter='1', who='".$who."', timesent='".time()."', msgtext='$by you are correct. [b]$message [/b] you got $kano plusses. Next question', rid='".$rid."'");
     
    mysql_query("UPDATE m_usrs SET vlings=vlings+'$kano' WHERE id='".$winner."'");
     
    mysql_query("DELETE FROM m_mchat WHERE id='".$question3."'");

    }
     }


        
    $chatok mysql_query("INSERT INTO m_mchat SET  chatter='".$uid."', who='".$who."', timesent='".time()."', msgtext='".$message."', rid='".$rid."';");
        
    $lstmsg mysql_query("UPDATE m_mchatrooms SET lastmsg='".time()."' WHERE id='".$rid."'");
        
    $hehe=mysql_fetch_array(mysql_query("SELECT chatmsgs FROM m_usrs WHERE id='".$uid."'"));
        
    $totl $hehe[0]+1;
        
    $msgstmysql_query("UPDATE m_usrs SET chatmsgs='".$totl."' WHERE id='".$uid."'");
        if(
    isearning(getuid_sid($sid))){ addVling($sid,'1'); }
     }
    }

    $nosms mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM m_mchat WHERE chatter='".getuid_sid($sid)."' AND rid='".$rid."' ORDER BY timesent DESC LIMIT 0,1"));

    echo 
    "<div align=\"center\">".notifs($sid);
    $schts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM m_mchat WHERE rid='".$rid."'"));
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM m_mchatonline where rid='".$rid."'"));
    $msgsx mys_select("SELECT COUNT(*) FROM m_mchat WHERE rid='".$rid."'");
    if(
    $msgsx[0]==0){ echo $LANG['nmsgschat']."<br/>"; }else{
    $chk mys_select("SELECT timesent FROM m_mchat WHERE rid='".$rid."' ORDER BY id DESC LIMIT 0,1");
    echo 
    "<b>Idle:</b> ".timemsg3(floor(time()-$chk[0]))."<br/>";
    }
    echo 
    "<a href=\"".$FILENAME."?exe=ins&amp;rpw=$rpw&amp;rid=$rid\">".$LANG['inside']."(".$noi[0].")</a>";
    echo 
    "</div><br/>";
    echo 
    "<div>";
    $chats mysql_query("SELECT chatter, who, timesent, msgtext, exposed FROM m_mchat WHERE rid='".$rid."' ORDER BY timesent DESC");
    $counter=0;
    while(
    $chat mysql_fetch_array($chats)){
    $chnick getnick_uid($chat[0]);
    $optlink $chnick;
    $opt '0';
    $canc true;
     if(
    $counter<40){
      if(
    isfreezed($chat)){
       if(
    $uid!=$chat[0]){ $canc false; }
      }

      if(
    $chat[0]!=$uid){
       if(
    $chat[1]!=0){
        if(
    $chat[1]!=$uid){ $canc false; }
       }
      }

     if(
    $chat[4]=='1' && ismod($uid)){ $canc true; }

     if(
    $canc){
      if((
    $chat[1]!=0)&&($chat[0]==$uid)){
      
    ///out
      
    $iml "»»";
      
    $chnick getnick_uid($chat[1]);
      
    $optlink $iml."<a href=\"".$FILENAME."?exe=prfl&amp;who=$chat[1]&amp;rid=$rid&amp;rpw=$rpw\">".$chnick."</a>« ";
      
    $opt '1';
      }
      if(
    $chat[1]==$uid){
      
    ///in
      
    $iml "««";
      
    $chnick getnick_uid($chat[0]);
      
    $optlink $iml."<a href=\"".$FILENAME."?exe=prfl&amp;who=$chat[0]&amp;rid=$rid&amp;rpw=$rpw\">".$chnick."</a>» ";
      
    $opt '1';
      }

    $dsdate("g:ia"$chat[2]);
    $text _parseforum($chat[3], '1');
    $nos substr_count($text,"<img src=");
     if(
    isspamchat($text)&&$chat[0]!=='1'){
     
    $chnick getnick_uid($chat[0]);
     echo 
    addchatmsg($chat[0],$text,1,$LANG['errchat1']." @ $chnick",$sid,$rid,$rpw);
     }else if(
    $nos>2){
     echo 
    addchatmsg($chat[0],$text,1,$LANG['errchat2']." @ $chnick",$sid,$rid,$rpw);
     }else{
     
    $chat[3] = str_replace("[reader]",getnick_uid($uid),$chat[3]);
     
    $sres substr($chat[3],0,5);
     
    $sres2 substr($message,0,6);
    //  if($tok=='1'){  echo addchatmsg($chat[0],$ressult,1,"",$sid,$rid,$rpw);  }
      
    if($sres == "*say*"){
      
    $chco strlen($chat[3]);
      
    $goto $chco 5;
      
    $rest substr($chat[3],5,$goto);
      
    $tosay _parseoutput($rest$sid);
      echo 
    addchatmsg($chat[0],$tosay,1,"",$sid,$rid,$rpw);
      }
      elseif(
    $sres == "*rev*"){
      
    $chco strlen($chat[3]);
      
    $goto $chco 5;
      
    $rest substr($chat[3],5,$goto);
      
    $tosay _parseoutput(strrev($rest), '1');
      echo 
    getchatlink_uid($chat[0],$sid,$rid,$rpw)."»".$tosay."<br/>";
      }
    /*  elseif($sres2 == "@mchic"){
       if($sres2=="@mchic"){ $whob = '1'; }
      $message = "";
      $chco = strlen($chat[3]);
      $goto = $chco - 6;
      $rest = substr($chat[3],6,$goto);
      $tosay = _parseoutput($rest." $sress", '1');
      $bot = new PandoraBotResponse;
      $say = $bot->RobotInteract(getid_bot($whob),$tosay);
      $tmtm = time()+1;
      $chatok = mysql_query("INSERT INTO m_mchat SET  chatter='".$whob."', who='', timesent='".$tmtm."', msgtext='[b]".getnick_uid($chat[0])."[/b], ".$say."', rid='".$rid."';");
      $message = "";
      }elseif($nosms[0]>10){
      $text = $chat[3];
      echo addchatmsg($chat[0],$text,1,$LANG['errchat3']." @ $chnick",$sid);
      }*/
    else{
       if(
    $rinfo[0]==0){ $tosay _parseforum($chat[3],'1'); }
       else{ 
    $tosay _parseforum($chat[3], '1'); }

       if(
    $opt=='0'){
       echo 
    getchatlink_uid($chat[0],$sid,$rid,$rpw)."» ";
       }else{
       echo 
    "$optlink";
       }
      echo 
    $tosay."<br/>";
      }
     }
    $counter++;
    }
    }
    }

    echo 
    "</div><br/>";
    echo 
    "<div id=\"downMenu\">";
    echo 
    "1<a acesskey=\"1\" href=\"".$FILENAME."?exe=say&amp;rid=$rid&amp;rpw=$rpw\">".$LANG['write']."</a><br/>\n";
    echo 
    "0<a accesskey=\"0\" href=\"#top\">".$LANG['top']."</a> \n";
    echo 
    "2<a accesskey=\"2\" href=\"home.php?exe=chat\">".$LANG['chat']."</a> \n";
    echo 
    "5<a accesskey=\"5\" href=\"home.php?exe=prt\">".$LANG['home']."</a>\n";
    echo 
    "</div>";

    stopFile();
    }


    elseif(
    $exe=="prfl"){
    addtochat($uid$rid);
    addonline(getuid_sid($sid),$LANG['crm'],"?exe=$exe&amp;rid=$rid");
    if(!
    isuser($who)){ $who '1'; }
    startChatFile($nick." @ ".$rname,"",$sid);

    $res mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM m_mchatonline WHERE uid='".$who."' AND rid='".$rid."'"));
    if(
    $res[0]<=0){echo "<div id=\"notif\">".$LANG['errchat5']."</div>\n";}

    echo 
    "<div>";
    if(
    isadmin($uid)){
    echo 
    "» <a href=\"?do=clr&amp;who=$who&amp;rid=$rid&amp;rpw=$rpw\">".$LANG['clrmsg']."</a><br/>\n";
    }

    $rinfo mysql_fetch_array(mysql_query("SELECT censord, freaky, game FROM m_mchatrooms WHERE id='".$rid."'"));

    //////////////////////Jack En Poy
    $jnproom $rinfo[2];
    if(
    $jnproom==1){
     echo 
    "<div id=\"colorBar\"><b>JnP Challenge</b><br/>";
     
    $deta mys_select("SELECT jnpwin, jnploss FROM m_usrs WHERE id='".$who."'");
     echo 
    "\n<form action=\"?mv=set&amp;rid=$rid&amp;time=".time()."\" method=\"post\" name=\"JnP\">";
     echo 
    getnick_uid($who)." has ".getVlings($who)."Vlings.<br/>\n";
     echo 
    "Wins: ".$deta[0].", Loss: ".$deta[1];
     echo 
    "<br/>Move: <select name=\"JnPMove\">\n";
     echo 
    "<option value=\"1\">Paper</option>\n";
     echo 
    "<option value=\"2\">Scissors</option>\n";
     echo 
    "<option value=\"3\">Rock</option>\n";
     echo 
    "</select>\n";
     echo 
    "<br/>Bet:<input type=\"text\" name=\"bet\" value=\"\" style=\"-wap-input-format: '*N'\" size=\"3\" maxlength=\"5\"/>\n";
     echo 
    "<input type=\"submit\" id=\"colored\" name=\"submit\" value=\"Go\">\n";
     echo 
    "<input type=\"hidden\" name=\"user\" value=\"".$who."\">\n";
     echo 
    "</form>\n";
     echo 
    "</div>";
    }

    echo 
    "<form action=\"$FILENAME?rid=$rid&amp;rpw=$rpw\" method=\"post\">";
    echo 
    "<input type=\"Hidden\" name=\"who\" value=\"$who\">";
    echo 
    $LANG['text']."<br/>";
    echo 
    "<input name=\"message\" type=\"text\"  maxlength=\"250\"/><br/>";
    echo 
    "<input type=\"Submit\" id=\"colored\" name=\"private\" Value=\"".$LANG['121']."»\">";
    echo 
    "<br/>".$LANG['rrul']."<br/>";
    echo 
    "</form>";

    $usr mysql_fetch_array(mysql_query("SELECT * FROM m_usrs WHERE id='".$who."'"));
    echo 
    "<b>".getnick_uid($who)."</b>(".getage($usr['birthday'])."/".$usr['sex']."/".$usr['country'].")<br/>";
    echo 
    "» <a href=\"home.php?exe=prfl&amp;who=$who\">".$LANG['fprfl']."</a>.<br/>";
    if(
    budres($uid$who)==0){
    echo 
    "» <a href=\"confirm.php?exe=hme&amp;id=1&amp;who=$who&amp;act=add\">".$LANG['frreq']."</a><br/>";
    }
    $rooms mysql_fetch_array(mysql_query("SELECT id, name FROM m_mchatrooms WHERE id='".$rid."'"));
    $rname $rooms[1];
    echo 
    "« <a accesskey=\"4\" href=\"$FILENAME?rid=$rid&amp;rpw=$rpw\">$rname</a>.";
    echo 
    "</div><br/>";

    echo 
    "<div id=\"downMenu\">";
    echo 
    "0<a accesskey=\"0\" href=\"#top\">".$LANG['top']."</a> \n";
    echo 
    "2<a accesskey=\"2\" href=\"home.php?exe=chat\">".$LANG['chat']."</a> \n";
    echo 
    "5<a accesskey=\"5\" href=\"home.php?exe=prt\">".$LANG['home']."</a>\n";
    echo 
    "</div>";

    stopFile();
    }

    elseif(
    $exe=="say"){
    $rooms mysql_fetch_array(mysql_query("SELECT id, name FROM m_mchatrooms WHERE id='".$rid."'"));
    $rname $rooms[1];
    addtochat($uid$rid);
    addonline(getuid_sid($sid),$LANG['wrcm'],"?exe=$exe&amp;rid=$rid");

    startChatFile($nick." @ ".$rname,"",$sid);

    echo 
    "<div align=\"center\">".notifs($sid).my_ads()."</div>";
    echo 
    "<form action=\"$FILENAME?rid=$rid&amp;rpw=$rpw\" method=\"post\">";
    echo 
    "<div>";
    echo 
    $LANG['text']."<br/><input name=\"message\" type=\"text\" maxlength=\"255\"/>";
    echo 
    "<br/><input type=\"Submit\" id=\"colored\" Name=\"sy2\" value=\"".$LANG['go']."\">";
    echo 
    "</form>";
    echo 
    "<br/>« <a href=\"$FILENAME?rid=$rid&amp;rpw=$rpw\">$rname</a> ";
    echo 
    "</div>";
    echo 
    "<div id=\"downMenu\">\n";
    echo 
    "0<a accesskey=\"0\" href=\"#top\">".$LANG['top']."</a> \n";
    echo 
    "2<a accesskey=\"2\" href=\"home.php?exe=chat\">".$LANG['chat']."</a> \n";
    echo 
    "5<a accesskey=\"5\" href=\"home.php?exe=prt\">".$LANG['home']."</a>\n";
    echo 
    "</div>\n";

    stopFile();
    }

    elseif(
    $exe=="ins"){
    $roomsa mysql_fetch_array(mysql_query("SELECT id, name FROM m_mchatrooms WHERE id='".$rid."'"));
    $rnamea $rooms[1];
    addtochat($uid$rid);
    addonline(getuid_sid($sid),$LANG['crm'],"?exe=$exe&amp;rid=$rid");

    startChatFile($nick." @ ".$rname,"",$sid);

    echo 
    "<div>";
    echo 
    "<b>".$LANG['inside'].$rnamea</b><br/>\n";
    $inside=mysql_query("SELECT DISTINCT * FROM m_mchatonline WHERE rid='".$rid."' and uid IS NOT NULL ORDER BY lton DESC");
    $system_array = array();
    $i 0;
    while(
    $row mysql_fetch_assoc($inside)){
    $system_array[$i] = getseximg_uid($row['uid']).getchatlink_uid($row['uid'],$sid,$rid,$rpw);
    $i++;
    }
    $item_list implode(",",$system_array);
    echo 
    $item_list."<br/>\n";
    echo 
    "<br/>« <a href=\"$FILENAME?rid=$rid&amp;rpw=$rpw\">$rname</a> \n";
    echo 
    "</div>\n";

    echo 
    "<div id=\"downMenu\">\n";
    echo 
    "0<a accesskey=\"0\" href=\"#top\">".$LANG['top']."</a> \n";
    echo 
    "2<a accesskey=\"2\" href=\"home.php?exe=chat\">".$LANG['chat']."</a> \n";
    echo 
    "5<a accesskey=\"5\" href=\"home.php?exe=prt\">".$LANG['home']."</a>\n";
    echo 
    "</div>\n";

    stopFile();
    }
    ?>
    sql
    -- Table structure for table `ibwf_quiz`
    --

    CREATE TABLE `ibwf_quiz` (
    `id` int(100) NOT NULL auto_increment,
    `question` varchar(200) collate latin1_general_ci NOT NULL,
    `answer` varchar(50) collate latin1_general_ci NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=315 ;

    --
    -- Dumping data for table `ibwf_quiz`

    CREATE TABLE `m_mchat` (
    `id` int(99) NOT NULL auto_increment,
    `chatter` int(100) NOT NULL default '0',
    `who` int(100) NOT NULL default '0',
    `timesent` int(50) NOT NULL default '0',
    `msgtext` varchar(255) NOT NULL default '',
    `rid` int(99) NOT NULL default '0',
    `exposed` char(1) NOT NULL default '0',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=330 ;

    --
    -- Dumping data for table `m_mchat`
    --
    -- Table structure for table `m_mchatrooms`
    --

    CREATE TABLE `m_mchatrooms` (
    `id` int(10) NOT NULL auto_increment,
    `name` varchar(30) NOT NULL default '',
    `pass` varchar(100) NOT NULL default '',
    `static` char(1) NOT NULL default '',
    `mage` int(10) NOT NULL default '0',
    `maxage` int(10) NOT NULL default '0',
    `chposts` int(100) NOT NULL default '0',
    `vlings` int(100) NOT NULL default '0',
    `perms` int(10) NOT NULL default '0',
    `censord` char(1) NOT NULL default '1',
    `freaky` char(1) NOT NULL default '0',
    `lastmsg` int(100) NOT NULL default '0',
    `clubid` int(100) NOT NULL default '0',
    `game` int(1) NOT NULL default '0',
    PRIMARY KEY (`id`),
    UNIQUE KEY `name` (`name`),
    FULLTEXT KEY `name_2` (`name`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;

    --
    -- Dumping data for table `m_mchatrooms`
    --

    core.php

    PHP Code:
    function have()
    {
        
    $nopop mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_quiz"));
       return 
    $nopop[0];
    }
    function 
    correct($message,$question3)
    {
      
    $uid mysql_fetch_array(mysql_query("SELECT id FROM m_mchat WHERE msgtext='".$message."' AND id='".$question3."'"));
      return 
    $uid[0];

    this is from mgigs chat scipt and i add quiz room from lava.
    thanks for ur help.
    Last edited by coolboiz1; 08.05.10, 09:24.
Working...
X