Trivia In Chat Room

Started on the old forum in March 2008 · view the original in the archive · old links redirect here

7 replies · 1,735 views · started 18 years ago · 1 min read

5 participants
Guest #1

anyone have the lavalair script for trivia in chat room with a bot that put`s questions and multiple users are allowed in that room and answer his question ? post it here plz External image (may be gone)

rukiya Lead · 569 posts #2

anyone have the lavalair script for trivia in chat room with a bot that put`s questions and multiple users are allowed in that room and answer his question ? post it here plz External image (may be gone)

its not the work of a bot,if you see the chat.php there you will find $rminfo variable,freaky row name,its fixed withe admincp/ownercp.add a new field like

quiz tinyint(1) NOT NULL DEFAULT'0',

in ibwf_room add options in admincp.php and UPDATE sql in adminproc.php for quiz row and the SELECT the quiz row in chat.php within $rminfo variable the find $chatok=mysql_query("INSERT........................) like ravebabe's sql command here the chatmsg field will bear the answer of the quiz.now for trivia you can use trivia used in wapdesire script to get quiz questions and answers.when any chatter will post correct answer use codes like this

if($answer=='$chatmsg')
{
echo .getnick_uid($array value used for useid in chat.php). " is correct";}

then SELECT the correct answer poster and UPDATE his/her quiz points

busterkeaton10 Developer · 68 posts #4

its not the work of a bot,if you see the chat.php there you will find $rminfo variable,freaky row name,its fixed withe admincp/ownercp.add a new field like

quiz tinyint(1) NOT NULL DEFAULT'0',

in ibwf_room add options in admincp.php and UPDATE sql in adminproc.php for quiz row and the SELECT the quiz row in chat.php within $rminfo variable the find $chatok=mysql_query("INSERT........................) like ravebabe's sql command here the chatmsg field will bear the answer of the quiz.now for trivia you can use trivia used in wapdesire script to get quiz questions and answers.when any chatter will post correct answer use codes like this

if($answer=='$chatmsg')
{
echo .getnick_uid($array value used for useid in chat.php). " is correct";}

then SELECT the correct answer poster and UPDATE his/her quiz points

can i have a complete tutorial or your chat sript w/ quiz bro? thanks! External image (may be gone)

shad0w Developer · 119 posts #7

Why not use trivia script ??

<?php

/*
Script wml
Chat/Forum
by Shad0w
*/

include("config.php");
include("core.php");

header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");

echo("<?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\">";

?>

<wml>

<?php

$bcon = connectdb();
if (!$bcon)
{
    echo "<card id=\"main\" title=\"$numesite (ERROR!)\">";
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
    echo "Eroare, nu se poate conecta la baza d date!<br/><br/>";
    echo "Aceasta eroare apare de obicei cand care serverul isi va reveni in cateva secunde!Daca problema persista va rugam sa luati legatura cat mai curand posibil cu Shad0w<br/><br/>";
    echo "<b>Va multumim foarte mult pentru intelegere!</b>";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
}
$brws = explode(" / ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = $REMOTE_ADDR;
$joc = $_GET["joc"];
$actiune = $_GET["actiune"];
$action = $_GET["action"];

$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$pmid = $_GET["pmid"];
$lol = $_GET["lol"];
$uid = getuid_sid($sid);
$r = rand(0,100000);
$start = gettime();

cleardata();

if(($joc != "") && ($joc!="terms"))
{
    $uid = getuid_sid($sid);
     if((islogged($sid)==FALSE)||($uid==0))
    {
      echo "<card id=\"main\" title=\"$numesite\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"X\"/>Nu esti autentificat<br/>";
      echo "Sau sesiunea ta a expirat<br/><br/>";
      echo "»<a href=\"index.php\">Autentificare</a>«";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    }

if(isbanned($uid))
    {
      echo "<card id=\"main\" title=\"$numesite\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
      echo "Esti <b>Banat(a)</b><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM lib3rtymrc_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
	  $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM lib3rtymrc_users WHERE id='".$uid."'"));
	  $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Timp ramas pana la debanare: $rmsg<br/>";
	   $nick = getnick_uid($banto[2]);
	  echo "By: $nick<br/>";
	  echo "Motiv ban: $banres[0]";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }

///////////////////////////////////time
$res = mysql_fetch_array(mysql_query("SELECT lastact FROM lib3rtymrc_users WHERE id='".$uid."'"));
$lastact = $res[0];
$atime = time() - $lastact;

if($atime<1800){
	$res = mysql_fetch_array(mysql_query("SELECT otime, mtime FROM lib3rtymrc_users where id='".$uid."'"));
	$otime = $res[0] + $atime;
	$mtime = $res[1] + $atime;
	$res = mysql_query("UPDATE lib3rtymrc_users SET otime='".$otime."', mtime='".$mtime."' where id='".$uid."'");
}
//////////////////////////////////////

 $timeto = 600;
            $timenw = time();
            $timeout = $timenw-$timeto;
            $deleted = mysql_query("DELETE FROM trivia WHERE timp<".$timeout."");
/////////////////////////////////////inceput camera trivia

 addtotrivia($uid);
 $timeto = 300;
            $timenw = time();
            $timeout = $timenw-$timeto;
            $deleted = mysql_query("DELETE FROM trivia WHERE timp<".$timeout."");
$nick = getnick_sid($sid);

if($joc=="trivia")
{
 $numeutilizator = getnick_sid($sid);      
 echo "<card id=\"main\" title=\"$numeutilizator@trivia\" ontimer=\"trivia.php?joc=trivia&sid=$sid&wap=$r\"><timer value=\"120\"/>";
echo "<p>";
	 $uid = getuid_sid($sid);
	 $whonick = getnick_uid($who);
	$nick = getnick_sid($sid);
	addonline(getuid_sid($sid),"Joaca trivia","trivia.php?joc=$joc&timp=$r");
////////////  de aici incepe
$cerere = @mysql_query("select `mesaj` from trivia where uid='".$uid."' order by id desc;");
$anterior = @mysql_fetch_array($cerere);
$mesaj=htmlspecialchars(stripslashes(trim($mesaj)));
if(!empty($mesaj) && $mesaj!=$anterior['mesaj'])
{
@mysql_query("SELECT uid FROM trivia");
$chnick = getnick_uid($chat[0]);
$whonick = getnick_uid($who);
$chatok = mysql_query("INSERT INTO trivia SET  id=0, uid='".$uid."', mesaj='$mesaj', timp='".time()."', valid=0;");
$mama_matii=mysql_fetch_array(mysql_query("SELECT chmsgs  FROM lib3rtymrc_users WHERE id='".$uid."'"));
$totl = $mama_matii[0]+1;
$msgst= mysql_query("UPDATE lib3rtymrc_users SET chmsgs='".$totl."' WHERE id='".$uid."'");
} 
$chats = mysql_query("SELECT `identificare`,`raspuns`,`timp` FROM trivia WHERE uid='' ORDER BY id DESC;");
$trivie = @mysql_fetch_array($chats);
$chat3 = @mysql_query("select * from lib3rtymrc_intrebari;");
$numar = @mysql_num_rows($chat3);
$wap = $trivie['identificare'];
if(empty($wap)) 
$wap = rand(1,$numar);
$cerere2 = @mysql_query("select * from lib3rtymrc_intrebari where id='$wap';");
$cerere = @mysql_fetch_array($cerere2);
$intrebare2 = $cerere['intrebare'];
$webadv = strtolower($cerere['raspuns']);
$mesaj = strtolower($mesaj);
$dan = $trivie['raspuns'];
$intrebare = $trivie['identificare'];
$time = $trivie['timp'];
$litere = strlen($webadv);
$now = time();
//$xfile = @file("1.txt");
//$random_num = rand (0,count($xfile)-1);
//$udata = explode("::",$xfile[$random_num]);
if($intrebare) 
{
if(($now < $time + 100)&&(empty($dan))) 
{
if(preg_match("/$webadv/i","$mesaj")) 
{

$mama_matii=mysql_fetch_array(mysql_query("SELECT trivia FROM lib3rtymrc_users WHERE id='".$uid."'"));
@mysql_query("update lib3rtymrc_users set trivia=".($mama_matii[0]+ "1")." where id='".$uid."'"); 
$uid = getuid_sid($sid);
$whonick = getnick_uid($who);
$nick = getnick_sid($sid);
echo "<img src=\"images/ok.gif\" alt=\".\"/>";
@mysql_query("INSERT INTO trivia SET  id=0, timp='".time()."',mesaj='Bravo $nick!Raspunsul era: $webadv!Ai castigat 1 punct Total:".($mama_matii[0]+ "1")." puncte!', valid=1;"); 

@mysql_query("update trivia set raspuns='1' where identificare='$wap' and uid=''");
}
}else{
if(empty($dan)&&(!empty($intrebare)))
$chat = mysql_query("INSERT INTO trivia SET  id=0, timp='".time()."', mesaj='Raspunsul era: $webadv!', identificare='0', raspuns='0', valid=1;");
}
}else{
$chat = mysql_query("INSERT INTO trivia SET  id=0, timp='".time()."', mesaj='$intrebare2', identificare='$wap', raspuns='0', valid=1;");
}
/////////////////////////boot trivia inceput
$num_msgs1=2;
$sql = "SELECT id, uid, mesaj, timp FROM trivia WHERE valid='1' ORDER BY id desc limit $num_msgs1;";
$posts = mysql_query($sql);
while($post = mysql_fetch_array($posts))
{
$unick = getnick_uid($post[1]);
$usl = "";
//$pst = parsemsg($post[2], $sid);
$pst = htmlspecialchars($post[2]);
echo "<small>$pst</small><br/>";
  }
echo "<small>------</small><br/>";
////////////////////////////////boot trivia sfarsit //////////
///////////////////////////////////// meniu
  echo "<small><a href=\"#scrie\">scrie</a>|</small>";
  echo "<small><a href=\"trivia.php?joc=trivia&sid=$sid&wap=$r\">reload</a></small><br/>";
   $chatters=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lib3rtymrc_onlinetrivia"));
   echo "<small>conectati:<a href=\"trivia.php?action=conectati&sid=$sid&wap=$r\">[$chatters[0]]</a></small>";
   	 $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lib3rtymrc_private WHERE unread='1' AND touid='".$uid."'"));
   	 
        $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lib3rtymrc_private WHERE touid='".$uid."'"));
        $unrd="[".$unreadinbox[0]."]";
        if ($unreadinbox[0]>0)
        {
    
        	
        echo "<small>Ai: <a href=\"posta.php?action=main&sid=$sid\">$unrd</a> PMs</small>";
        }
			
      //  echo " <br/>";

///////////////blocheaza pc inceput
$browser = mysql_fetch_array(mysql_query("SELECT browserm FROM lib3rtymrc_users WHERE id='".$uid."'"));
if(!isoprit($browser[0],$uid)) 
{
}else{
if(istrashed($uid))
    {
  
    }else{

	}
		}	
////////////////////////////////////////////
 $num_msgs=12;
 $sql = "SELECT id, uid, mesaj, timp FROM trivia WHERE valid='0' ORDER BY id desc limit $num_msgs;";
  $posts = mysql_query($sql);
  while($post = mysql_fetch_array($posts))
  {
  
    $unick = getnick_uid($post[1]);
    $dtot = date("H:i:s",$post[3]);
	$nopl = mysql_fetch_array(mysql_query("SELECT sex FROM lib3rtymrc_users WHERE id='".$post[1]."'"));
    if($nopl[0]=='M')
      {
    $usex = "B";
    }else if($nopl[0]=='F'){
    $usex = "F";
    }else{
    $usex = "<img src=\"images/unknown.gif\" alt=\".\"/>";
       }
	$sim = getsimbol($post[1]);
	$usl = "$usex»<a href=\"index.php?action=viewuser&sid=$sid&who=$post[1]\">$sim$unick</a>-$dtot";
    $pst = htmlspecialchars($post[2]);
    echo "<small><br/>$usl<br/> $pst <br/>-----</small>";
   }
   echo "<br/>";
$lib3rtymrc_intrebari = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lib3rtymrc_intrebari"));
//echo "<br/>";
echo "<small><b>Intrebari:$lib3rtymrc_intrebari[0]</b></small><br/>";
echo "<small><a href=\"trivia.php?actiune=top&sid=$sid&wap=$r\">Top trivia</a>|</small>";
//echo "<small><a href=\"index.php?action=setari&sid=$sid\">setari</a>|</small>";
echo "<small><a href=\"forum.php?action=forum&sid=$sid\">forum</a>|</small>";
echo "<small><a href=\"index.php?action=main&sid=$sid\">prim</a></small>";

echo "</p></card>";
////////////////aici meniul de scriere

echo "<card id=\"scrie\" title=\"Scrie mesaj pe trivia\">";
addonline(getuid_sid($sid),"Scrie mesaj pe trivia","");
echo "<p><input name=\"mesaj$r\"/><br/>";
echo "<small>»<anchor>scrie<go href=\"trivia.php?joc=trivia&sid=$sid&wap=$r\" method=\"post\">";
echo "<postfield name=\"mesaj\" value=\"$(mesaj$r)\"/></go></anchor></small>";
echo "<br/><br/><small>----</small><br/>";
echo "<small>«<a href=\"trivia.php?joc=trivia&sid=$sid&wap=$r\">Inapoi pe trivia</a></small></p></card>";
}
//////////////////////////////conectati
  else if ($action=="conectati")           
	  {
        echo "<card id=\"main\" title=\"Conectati chat\">";
        echo "<p align=\"left\">";
        addonline(getuid_sid($sid),"Conectati trivia","trivia.php?joc=$joc&wap=$r");
        $inside=mysql_query("SELECT DISTINCT * FROM lib3rtymrc_onlinetrivia WHERE uid IS NOT NULL");
        while($ins=mysql_fetch_array($inside))
        {

         $nopl = mysql_fetch_array(mysql_query("SELECT sex FROM lib3rtymrc_users WHERE id='".$ins[1]."'"));
          if($nopl[0]=='M')
          {
          $usex = "<img src=\"images/male2.gif\" alt=\".\"/>";
          }else if($nopl[0]=='F'){
          $usex = "<img src=\"images/female2.gif\" alt=\".\"/>";
          }else{
           $usex = "<img src=\"images/unknown.gif\" alt=\".\"/>";
          }
		  $sim = getsimbol($ins[1]);
          $unick = getnick_uid($ins[1]);
          $userl = "<small>»$usex<a href=\"index.php?action=viewuser&who=$ins[1]&sid=$sid\">$sim$unick</a></small><br/>";
          echo "$userl";
        }
        echo "<br/><small>-----<br/>";
        echo "«<a href=\"trivia.php?joc=trivia&sid=$sid&wap=$r\">inapoi la trivia</a><br/>";
        echo "»<a href=\"trivia.php?actiune=top&sid=$sid&wap=$r\">top trivia</a><br/>";
		echo "«<a href=\"index.php?action=main&sid=$sid\">meniu prim</a><br/>";
		
		echo "</small></p>";
        echo "</card>";
      }
//////////////////////////////////Top trivia

else if($actiune=="top")
{
    addonline(getuid_sid($sid),"Vizualizeaza Top trivia","trivia.php?actiune=$actiune&wap=$r");
    echo "<card id=\"main\" title=\"Top trivia\">";
    echo "<p align=\"center\">";
    echo "<b>Top trivia</b>";
    echo "</p>";
     
 
	//////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $num_items = regmemcount(); //changable
    $items_per_page= 20;
    $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, name, trivia FROM lib3rtymrc_users ORDER BY trivia DESC LIMIT $limit_start, $items_per_page";

    echo "<p>";
    $items = mysql_query($sql);
     //$cou =1;
	$cou = $limit_start;
	echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
      $cou++;
	  $simbol = getsimbol($item[0]);
      $lnk = "<small>$cou) <a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\"> $simbol$item[1]</a>:  $item[2] puncte</small>";
      echo "$lnk<br/>";
  
	}
    }
    echo "</p>";
    echo "<p align=\"left\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<small>«<a href=\"trivia.php?actiune=top&page=$ppage&sid=$sid&view=$view\">pagina anterioara</a></small><br/> ";
   }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<small>»<a href=\"trivia.php?actiune=top&page=$npage&sid=$sid&view=$view\">pagina urmatoare</a></small>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "Dute la pagina:<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[dute]";
        $rets .= "<go href=\"trivia.php\" method=\"get\">";
        $rets .= "<postfield name=\"actiune\" value=\"$actiune\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }
    echo "</p>";
   /////////// pana aici /////////
  echo "<p align=\"center\">";
  echo "<small>«<a href=\"trivia.php?joc=trivia&sid=$sid&wap=$r\">inapoi la trivia</a></small><br/>";
  echo "<small><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Prim</a></small>";
  include("syr.php");
  echo "</p>";
  echo "</card>";
}
///////////////////////////// sfarsit trivia //////
else{
  echo "<card id=\"main\" title=\"$numesite\">";
  echo "<p align=\"center\">";
  echo "<small>Nu stiu cum ai ajuns aici,dar nu ai ce vedea<br/><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Prim</a></small>";
  echo "</p></card>";
}

?>

</wml>

whatmp3.name - search mp3 on mobile

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close