Quiz Html To Wml

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

22 replies · 1,474 views · started 18 years ago · 1 min read

6 participants
learner Lead · 587 posts #1

whats wrong i do here anybody help

<?php
//» »
//« «
include("config.php");
include("core.php");
//session_start();
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
echo("<?xml version=\"1.0\"?>");
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=\" (ERROR!)\">";
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/>
";
    echo "ERROR! cannot connect to database

";
    echo "This error happens usually when backing up the database, please be patient, The site will be up any minute

";
    echo "Soon, we will offer services that doesn't depend on MySQL databse to let you enjoy our site, while the database is not connected
";
    echo "[b]THANK YOU VERY MUCH[/b]";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
}
$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

$uid = getuid_sid($sid);

cleardata();
if(isipbanned($uip,$ubr))
    {
      if(!isshield(getuid_sid($sid)))
      {
        echo "<card id=\"main\" title=\"\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "This IP address is blocked
";
      echo "
";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over

";
      $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      //echo mysql_error();
      $remain =  $banto[0] - time();
      $rmsg = gettimemsg($remain);
      echo "Time to unblock the IP: $rmsg

";
      
      echo "</p>";
      echo "

";
  echo "UserID: <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
";
  echo "Password: <input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/>
";
  echo "<anchor>LOGIN<go href=\"login.php\" method=\"get\">";
  echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
  echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
  echo "</go></anchor>";
  echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
      }
    }
if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
        echo "<card id=\"main\" title=\"\">";
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    
    
    
}
//echo isbanned($uid);
if(isbanned($uid))
    {
        echo "<card id=\"main\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "You are [b]Banned[/b]
";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg

";
      echo "Ban Reason: $banres[0]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
/////////////////////////////QUIZ/////////////////////////////

if($action=="quiz")
{
addonline(getuid_sid($sid),"Quiz","");

echo "[b][i]Quiz[/i][/b]";
echo "<p align=\"center\">
Welcome To $sitename Quiz
</p>
<p align=\"center\">
<a href=\"./quiz.php?action=play&sid=$sid\">Play</a>

<a href=\"./quiz.php?action=about&sid=$sid\">About</a>

<a href=\"./quiz.php?action=winners&sid=$sid\">Top Scorers</a>

<a href=\"./quiz.php?action=losers&sid=$sid\">Top Losers</a>
";
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
$count_score1=$count_score[0];
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
$count_score2=$count_score[0];
$countup=($count_score1+$count_score2);
echo "
$countup people have taken part in Quiz";
if(isowner(getuid_sid($sid))){echo "
<a href=\"./quiz.php?action=options&sid=$sid\">Update</a>";}
echo "</p>";
echo "<center><a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////LOSERS/////////////////////////////

else if($action=="losers")
{
addonline(getuid_sid($sid),"Quiz","");

echo "[b][i]Quiz[/i][/b]";
if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "<center>[b]$num_items[0] have failed miserably[/b]</center>";
echo "<p align=\"center\">\n";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score<'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]
".$item["quiz_score"]."
\n";
}
}
if($page>1){
echo "
<a href=\"./quiz.php?action=losers&page=".($page-1)."&sid=$sid\"><-Prev</a> ";
}
if($page<$num_pages){
if($page==1)echo "
";
echo "<a href=\"./quiz.php?action=losers&page=".($page+1)."&sid=$sid\">Next-></a>\n";
}
echo "
$page/$num_pages</p>\n";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////WINNERS/////////////////////////////

else if($action=="winners")
{
addonline(getuid_sid($sid),"Quiz","");

echo "[b][i]Quiz[/i][/b]";
if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "<center>[b]$num_items[0] players made the leaderboard[/b]</center>";
echo "<p align=\"center\">\n";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score>'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]
".$item["quiz_score"]."
\n";
}
}
if($page>1){
echo "
<a href=\"./quiz.php?action=losers&page=".($page-1)."&sid=$sid\"><-Prev</a> ";
}
if($page<$num_pages){
if($page==1)echo "
";
echo "<a href=\"./quiz.php?action=losers&page=".($page+1)."&sid=$sid\">Next-></a>\n";
}
echo "
$page/$num_pages</p>\n";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////ABOUT/////////////////////////////

else if($action=="about")
{
addonline(getuid_sid($sid),"Quiz","");

echo "[b][i]Quiz[/i][/b]";
echo "<p align=\"center\">
Welcome To $sitename Quiz
</p>
<p align=\"center\">
this is a multiple choice quiz, each question has 4 possible answers.

for each question you get right, you get points, 
the points you get depend on the difficulty level you've selected:

[b]easy = 10 points[/b]

[b]medium = 20 points[/b]

[b]hard = 30 points[/b]

but, each time you get a question wrong, you lose the 10, 
20 or 
30 points depending on the difficulty level you selected, 
and don't think it stops at zero, oh no, if you get your very first question wrong, 
you'll need to get the next one right to return to zero.
</p>";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////PLAY/////////////////////////////

else if($action=="play")
{
addonline(getuid_sid($sid),"Quiz","");

echo "[b][i]Quiz
please select level of difficulty[/i][/b]";
echo "<p align=\"center\">\n";
$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
$score=explode("/",$row_profiles["quiz_score"]);
$score=$score[0]+$score[1]+$score[2];
$quiz_easy=$row_profiles["quiz_easy"];
$quiz_medium=$row_profiles["quiz_medium"];
$quiz_hard=$row_profiles["quiz_hard"];
if($row_quiz["switch"]==on||(isowner(getuid_sid($sid))&&$preview==yes)){
if($quiz_easy=="no")echo "<a style=\"color: blue;\" href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=easy\">easy</a>
\n";
else if($quiz_easy=="yes")echo "[b]** completed **[/b]
\n";
if($quiz_medium=="no")echo "<a style=\"color: green;\" href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=med\">medium</a>
\n";
elseif($quiz_medium=="yes")echo "[b]** completed **[/b]
\n";
if($quiz_hard=="no")echo "<a style=\"color: red;\" href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=hard\">hard</a>
\n";
else if($quiz_hard=="yes")echo "[b]** completed **[/b]
\n";
if(($quiz_hard=="yes")&&($quiz_easy=="yes")&&($quiz_medium=="yes")){
echo "[b]you have answered all the questions for this week, please try again next week![/b]
\n";
}
echo "
[b]your current score is $score[/b]\n";
}else{
echo "Quiz Is Currently Turned Off Please Come Back Later\n";
}
echo "</p>\n";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////QUESTIONS/////////////////////////////

else if($action=="questions")
{
addonline(getuid_sid($sid),"Quiz","");

$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
if($row_quizusers[$dif."_question"]!=0){$q=$row_quizusers[$dif."_next"];}
$row_quiz=mysql_fetch_array(mysql_query("SELECT * FROM ibwf_quiz WHERE difficulty='".$dif."' AND number='".$q."'"));
echo "[b][i]Quiz
Question $q[/i][/b]";
if($start=yes){
mysql_query("insert into ibwf_quizusers set easy_question='".$q."', easy_next='".$q."', med_question='".$q."', med_next='".$q."', hard_question='".$q."', hard_next='".$q."', uid='".getuid_sid($sid)."'");
}
$question = $row_quiz["question"];
$a = $row_quiz["answer1"];
$b = $row_quiz["answer2"];
$c = $row_quiz["answer3"];
$d = $row_quiz["answer4"];
$q = $row_quiz["number"];
$quid = $row_quiz["id"];
$l = $row_quiz["difficulty"];
echo "<p align=\"center\">
[b]$question[/b]
</p>
<p align=\"center\">
[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=a&quid=$quid&l=$l\">$a</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=b&quid=$quid&l=$l\">$b</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=c&quid=$quid&l=$l\">$c</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=d&quid=$quid&l=$l\">$d</a>[/i]";
echo "</p>";
echo "<center><a href=\"./quiz.php?action=play&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////ANSWER/////////////////////////////

else if($action=="answer")
{
addonline(getuid_sid($sid),"Quiz","");

$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$tmax=$row_ses["tmax"];
$totalscore=explode("/",$row_profiles["quiz_score"]);
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz where id='$quid'"));
$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
$correct = $row_quiz["answer"];
$ga = $row_quiz["answer1"];
$gb = $row_quiz["answer2"];
$gc = $row_quiz["answer3"];
$gd = $row_quiz["answer4"];
if($a=="a")$guess="$ga";
else if($a=="b")$guess="$gb";
else if($a=="c")$guess="$gc";
else if($a=="d")$guess="$gd";
if($row_quizusers[$l."_next"]!=$q){
echo "[b]Cheater![/b]
<p align=\"center\">
<img src=\"../images/error.gif\" alt=\"[x]\"/>
[b]Error!!![/b]

You cannot reload this page to gain more points DO NOT CHEAT!
</p>\n";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>
</card>
</wml>\n";
exit;
}
else if($guess=="$correct"){
mysql_query("update ibwf_quizusers set ".$l."_question='".$q."', ".$l."_next='".($q+1)."' where uid='".getuid_sid($sid)."'");
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]+$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]+$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]+$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "[b][i]Correct![/i][/b]";
echo "<p align=\"center\">
[i]you got the right answer, $plus points were added to your score.[/i]
";
if($q<10){
$next=$q+1;
echo "
<a href=\"./quiz.php?action=questions&sid=$sid&q=$next&dif=$l\">go to question $next</a>
";
}
else if($q==10){
if($l=="easy"){
mysql_query("update ibwf_users set quiz_easy='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="med"){
mysql_query("update ibwf_users set quiz_medium='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="hard"){
mysql_query("update ibwf_users set quiz_hard='yes' where id='".getuid_sid($sid)."'");
}
echo "
you've completed this round.

<a href=\"./quiz.php?action=play&sid=$sid\">select difficulty</a>
";
}
echo "</p>";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
else
{
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]-$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]-$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]-$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "[b][i]Wrong![/i][/b]";
echo "<p align=\"center\">
[i]your answer was wrong, $plus points were deducted from your score.[/i]

</p>
<p align=\"center\">
<a href=\"./quiz.php?action=questions&sid=$sid&q=$q&dif=$l\">try question $q again</a>

</p>";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
}
/////////////////////////////OPTIONS/////////////////////////////

else if($action=="options")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");

echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
echo "[b][i]Quiz Options[/i][/b]";
echo "<p align=\"center\">
Please select the set of questions you wish to edit

<a href=\"./quiz.php?action=edit&q=1&diff=easy&sid=$sid\" style=\"color:blue;\">easy</a>

<a href=\"./quiz.php?action=edit&q=1&diff=med&sid=$sid\" style=\"color:green;\">medium</a>

<a href=\"./quiz.php?action=edit&q=1&diff=hard&sid=$sid\" style=\"color:red;\">hard</a>

<a href=\"./quiz.php?action=play&preview=yes&sid=$sid\">preview</a>

[i]lastly, you'll want to make sure ALL users can play,

when a user completes a section, it appears as *complete*, you need to click below, 
after each update, 
before turning the quiz back on.[/i]

<a href=\"./quiz.php?action=reset&sid=$sid\">Reset Scores</a>
\n";
if($row_quiz["switch"]=="on"){
echo "
[b]Quiz is active
<a href=\"./quiz.php?action=off&sid=$sid\">turn it off?</a>[/b]\n";
}else{
echo "
[b]Quiz is not active
<a href=\"./quiz.php?action=on&sid=$sid\">turn it on?</a>[/b]\n";
}
echo "</p>\n";
echo "<center><a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////RESET/////////////////////////////

else if($action=="reset") 
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");

echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "[b][i]Quiz Options[/i][/b]";
$query="UPDATE ibwf_users SET quiz_easy='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_medium='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_hard='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_score='0/0/0', total_score='0'";
mysql_query($query);
$query="delete from ibwf_quizusers where uid!=0";
mysql_query($query);
echo "<p align=\"center\">
[b]done![/b]

all sections will now appear as unplayed for all users.
</p>\n";
echo "<center> <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////QUIZ ON/////////////////////////////

else if($action=="on")
{
if(!isowner(getuid_sid($sid)))
{

addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "[b][i]Quiz Options[/i][/b]";
$query="UPDATE ibwf_quiz SET switch='on'";
mysql_query($query);
echo "<p align=\"center\">
[b]done![/b]

the quiz was activated, 
now all other users can participate.
</p>\n";
echo "<center><a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////QUIZ OFF/////////////////////////////

else if($action=="off")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");

echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "[b][i]Quiz Options[/i][/b]";
$query="UPDATE ibwf_quiz SET switch='off'";
mysql_query($query);
echo "<p align=\"center\">
[b]done![/b]

the quiz was deactivated, 
the link has disappeared from the main menu.
</p>\n";
echo "<center><a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////EDIT/////////////////////////////

else if($action=="edit")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");

echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "[b][i]Quiz Options[/i][/b]";
echo "<p align=\"center\">\n";
$query="select * FROM ibwf_quiz WHERE difficulty='$diff' AND number='$q'";
$result=mysql_query($query);
$num_rows=mysql_num_rows($result);
$row=mysql_fetch_array($result);
$question=$row["question"];
$correct=$row["answer"];
$a=$row["answer1"];
$b=$row["answer2"];
$c=$row["answer3"];
$d=$row["answer4"];
$id=$row["id"];
echo "[b]edit question $q
[difficulty: $diff][/b]
</p>
<center><anchor>UPDATE
<go href=\"./quiz.php?action=save&q=$q&diff=$diff&sid=$sid\" method=\"post\">

question:

<input type=\"text\" name=\"nquestion\" value=\"$question\" maxlength=\"100\"/>

correct answer:

<input type=\"text\" name=\"nright\" value=\"$correct\" maxlength=\"100\"/>

one of the answers below must be the same case and spelling as the correct answer

answer 1:

<input type=\"text\" name=\"na\" value=\"$a\" maxlength=\"100\"/>

answer 2:

<input type=\"text\" name=\"nb\" value=\"$b\" maxlength=\"100\"/>

answer 3:

<input type=\"text\" name=\"nc\" value=\"$c\" maxlength=\"100\"/>

answer 4:

<input type=\"text\" name=\"nd\" value=\"$d\" maxlength=\"100\"/>

</go>
</anchor>
</center>\n";
echo "<center><a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////SAVE/////////////////////////////

else if($action=="save")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");

echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "[b][i]Quiz Options[/i][/b]";
echo "<p align=\"center\">\n";
$query="UPDATE ibwf_quiz SET question='$nquestion' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer='$nright' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer1='$na' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer2='$nb' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer3='$nc' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer4='$nd' where number=$q AND difficulty='$diff'";
mysql_query($query);
$next=($q+1);
if($next<=10){
echo "[b]done![/b]

question $q was updated

[b]question:[/b]
$nquestion

[b]right answer:[/b]
$nright

[b]answer 1:[/b]
$na

[b]answer 2:[/b]
$nb

[b]answer 3:[/b]
$nc

[b]answer 4:[/b]
$nd

<a href=\"./quiz.php?action=edit&q=$next&diff=$diff&sid=$sid\">Question $next</a>\n";
}else{
echo "[b]done![/b]

that was the last $diff question, 
taking you back to quiz admin..

[b]question:[/b]
$nquestion

[b]right answer:[/b]
$nright

[b]answer 1:[/b]
$na

[b]answer 2:[/b]
$nb

[b]answer 3:[/b]
$nc

[b]answer 4:[/b]
$nd\n";
}
echo "<center><a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";

echo "</card>";
}
/////////////////////////////Error/////////////////////////////

else
{

echo "<p align=\"center\">";
echo "You are not logged in
";
echo "Or Your session has been expired

";
echo "<a href=\"../web/index.php\">Login</a>";
echo "</p>";

echo "</card>";

}
?>

</wml>

error i get

Warning: Cannot modify header information - headers already sent by (output started at /home/www/domains/domain.com/public_html/wap/quiz.php:1) in /home/www/domains/domain.com/public_html/wap/quiz.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at /home/www/domains/domain.com/public_html/wap/quiz.php:1) in /home/www/domains/domain.com/public_html/wap/quiz.php on line 13

Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

BEST MOBILE ADVERTISER

External image (may be gone)

crazybrumi Super moderator Principal · 1,064 posts #2
<?php
//» »
//« «
include("config.php");
include("core.php");
//session_start();
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
echo("<?xml version=\"1.0\"?>");
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=\" (ERROR!)\">";
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/>
";
    echo "ERROR! cannot connect to database

";
    echo "This error happens usually when backing up the database, please be patient, The site will be up any minute

";
    echo "Soon, we will offer services that doesn't depend on MySQL databse to let you enjoy our site, while the database is not connected
";
    echo "[b]THANK YOU VERY MUCH[/b]";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
}
$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

$uid = getuid_sid($sid);

cleardata();
if(isipbanned($uip,$ubr))
    {
      if(!isshield(getuid_sid($sid)))
      {
        echo "<card id=\"main\" title=\"\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "This IP address is blocked
";
      echo "
";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over

";
      $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      //echo mysql_error();
      $remain =  $banto[0] - time();
      $rmsg = gettimemsg($remain);
      echo "Time to unblock the IP: $rmsg

";
      
      echo "</p>";
      echo "

";
  echo "UserID: <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
";
  echo "Password: <input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/>
";
  echo "<anchor>LOGIN<go href=\"login.php\" method=\"get\">";
  echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
  echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
  echo "</go></anchor>";
  echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
      }
    }
if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
        echo "<card id=\"main\" title=\"\">";
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    
    
    
}
//echo isbanned($uid);
if(isbanned($uid))
    {
        echo "<card id=\"main\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "You are [b]Banned[/b]
";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg

";
      echo "Ban Reason: $banres[0]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
/////////////////////////////QUIZ/////////////////////////////

if($action=="quiz")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"quiz\">";

echo "<p align=\"center\">";
echo "Welcome To $sitename Quiz
";

echo "<a href=\"./quiz.php?action=play&sid=$sid\">Play</a>
";
echo "<a href=\"./quiz.php?action=about&sid=$sid\">About</a>
";
echo "<a href=\"./quiz.php?action=winners&sid=$sid\">Top Scorers</a>
";
echo "<a href=\"./quiz.php?action=losers&sid=$sid\">Top Losers</a>
";
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
$count_score1=$count_score[0];
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
$count_score2=$count_score[0];
$countup=($count_score1+$count_score2);
echo "
$countup people have taken part in Quiz";
if(isowner(getuid_sid($sid))){echo "
<a href=\"./quiz.php?action=options&sid=$sid\">Update</a>";}

echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>";
echo "</card>";
}
/////////////////////////////LOSERS/////////////////////////////

else if($action=="losers")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"Losers\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz [/i][/b]";
if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "[b]$num_items[0] have failed miserably[/b]";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score<'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]
".$item["quiz_score"]."
\n";
}
}
if($page>1){
echo "
<a href=\"./quiz.php?action=losers&page=".($page-1)."&sid=$sid\"><-Prev</a> ";
}
if($page<$num_pages){
if($page==1)echo "
";
echo "<a href=\"./quiz.php?action=losers&page=".($page+1)."&sid=$sid\">Next-></a>\n";
}
echo "
$page/$num_pages\n";
echo "
<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>";
echo "</card>";
}
/////////////////////////////WINNERS/////////////////////////////

else if($action=="winners")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"winners\">";
echo "<p align=\"center\">\n";
echo "[b][i]Quiz [/i][/b]";
if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "[b]$num_items[0] players made the leaderboard[/b]";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score>'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]
".$item["quiz_score"]."
\n";
}
}
if($page>1){
echo "
<a href=\"./quiz.php?action=losers&page=".($page-1)."&sid=$sid\"><-Prev</a> ";
}
if($page<$num_pages){
if($page==1)echo "
";
echo "<a href=\"./quiz.php?action=losers&page=".($page+1)."&sid=$sid\">Next-></a>\n";
}
echo "
$page/$num_pages\n";
echo "
<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>";

echo "</card>";
}
/////////////////////////////ABOUT/////////////////////////////

else if($action=="about")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"about\">";
echo "<p align=\"center\">";
echo "Welcome To $sitename Quiz";

echo "this is a multiple choice quiz, each question has 4 possible answers.

for each question you get right, you get points, 
the points you get depend on the difficulty level you've selected:
";
echo "[b]easy = 10 points[/b]
";
echo "[b]medium = 20 points[/b]
";
echo "[b]hard = 30 points[/b]
";
echo "but, each time you get a question wrong, you lose the 10, 
20 or 
30 points depending on the difficulty level you selected, 
and don't think it stops at zero, oh no, if you get your very first question wrong, 
you'll need to get the next one right to return to zero.
";
echo "
<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";

echo "</p>";
echo "</card>";
}
/////////////////////////////PLAY/////////////////////////////

else if($action=="play")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"quiz\">";
echo "<p align=\"center\">\n";
echo "[b][i]Quiz
please select level of difficulty[/i][/b]
";
$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
$score=explode("/",$row_profiles["quiz_score"]);
$score=$score[0]+$score[1]+$score[2];
$quiz_easy=$row_profiles["quiz_easy"];
$quiz_medium=$row_profiles["quiz_medium"];
$quiz_hard=$row_profiles["quiz_hard"];
if($row_quiz["switch"]==on||(isowner(getuid_sid($sid))&&$preview==yes)){
if($quiz_easy=="no")echo "<a href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=easy\">easy</a>
\n";
else if($quiz_easy=="yes")echo "[b]** completed **[/b]
\n";
if($quiz_medium=="no")echo "<a href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=med\">medium</a>
\n";
elseif($quiz_medium=="yes")echo "[b]** completed **[/b]
\n";
if($quiz_hard=="no")echo "<a href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=hard\">hard</a>
\n";
else if($quiz_hard=="yes")echo "[b]** completed **[/b]
\n";
if(($quiz_hard=="yes")&&($quiz_easy=="yes")&&($quiz_medium=="yes")){
echo "[b]you have answered all the questions for this week, please try again next week![/b]
\n";
}
echo "
[b]your current score is $score[/b]\n";
}else{
echo "Quiz Is Currently Turned Off Please Come Back Later\n";
}

echo "
<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>\n";

echo "</card>";
}
/////////////////////////////QUESTIONS/////////////////////////////

else if($action=="questions")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"questions\">";
$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
if($row_quizusers[$dif."_question"]!=0){$q=$row_quizusers[$dif."_next"];}
$row_quiz=mysql_fetch_array(mysql_query("SELECT * FROM ibwf_quiz WHERE difficulty='".$dif."' AND number='".$q."'"));
echo "<p align=\"center\">\n";
echo "[b][i]Quiz
Question $q[/i][/b]";
echo "</p>";
if($start=yes){
mysql_query("insert into ibwf_quizusers set easy_question='".$q."', easy_next='".$q."', med_question='".$q."', med_next='".$q."', hard_question='".$q."', hard_next='".$q."', uid='".getuid_sid($sid)."'");
}
$question = $row_quiz["question"];
$a = $row_quiz["answer1"];
$b = $row_quiz["answer2"];
$c = $row_quiz["answer3"];
$d = $row_quiz["answer4"];
$q = $row_quiz["number"];
$quid = $row_quiz["id"];
$l = $row_quiz["difficulty"];
echo "<p align=\"center\">
[b]$question[/b]
</p>
<p align=\"center\">
[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=a&quid=$quid&l=$l\">$a</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=b&quid=$quid&l=$l\">$b</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=c&quid=$quid&l=$l\">$c</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=d&quid=$quid&l=$l\">$d</a>[/i]";
echo "<a href=\"./quiz.php?action=play&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>";

echo "</card>";
}
/////////////////////////////ANSWER/////////////////////////////

else if($action=="answer")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<card id=\"main\" title=\"answer\">";
$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$tmax=$row_ses["tmax"];
$totalscore=explode("/",$row_profiles["quiz_score"]);
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz where id='$quid'"));
$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
$correct = $row_quiz["answer"];
$ga = $row_quiz["answer1"];
$gb = $row_quiz["answer2"];
$gc = $row_quiz["answer3"];
$gd = $row_quiz["answer4"];
if($a=="a")$guess="$ga";
else if($a=="b")$guess="$gb";
else if($a=="c")$guess="$gc";
else if($a=="d")$guess="$gd";
if($row_quizusers[$l."_next"]!=$q){
echo "<p align=\"center\">";
echo "[b]Cheater![/b]";
echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>
[b]Error!!![/b]
";
echo "You cannot reload this page to gain more points DO NOT CHEAT!";
echo "</p>\n";
echo "<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>
</card>
</wml>\n";
exit;
}
else if($guess=="$correct"){
mysql_query("update ibwf_quizusers set ".$l."_question='".$q."', ".$l."_next='".($q+1)."' where uid='".getuid_sid($sid)."'");
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]+$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]+$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]+$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "<p align=\"center\">";
echo "[b][i]Correct![/i][/b]";
echo "[i]you got the right answer, $plus points were added to your score.[/i]
";
if($q<10){
$next=$q+1;
echo "
<a href=\"./quiz.php?action=questions&sid=$sid&q=$next&dif=$l\">go to question $next</a>
";
}
else if($q==10){
if($l=="easy"){
mysql_query("update ibwf_users set quiz_easy='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="med"){
mysql_query("update ibwf_users set quiz_medium='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="hard"){
mysql_query("update ibwf_users set quiz_hard='yes' where id='".getuid_sid($sid)."'");
}
echo "
you've completed this round.

<a href=\"./quiz.php?action=play&sid=$sid\">select difficulty</a>
";
}

echo "
<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>";
echo "</card>";
}
else
{
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]-$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]-$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]-$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "[b][i]Wrong![/i][/b]";
echo "<p align=\"center\">
[i]your answer was wrong, $plus points were deducted from your score.[/i]

</p>
<p align=\"center\">
<a href=\"./quiz.php?action=questions&sid=$sid&q=$q&dif=$l\">try question $q again</a>

</p>";
echo "<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";

echo "</card>";
}
}
/////////////////////////////OPTIONS/////////////////////////////

else if($action=="options")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"option\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
echo "<card id=\"main\" title=\"answer\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz Options[/i][/b]
";

echo "Please select the set of questions you wish to edit

<a href=\"./quiz.php?action=edit&q=1&diff=easy&sid=$sid\">easy</a>

<a href=\"./quiz.php?action=edit&q=1&diff=med&sid=$sid\">medium</a>

<a href=\"./quiz.php?action=edit&q=1&diff=hard&sid=$sid\">hard</a>

<a href=\"./quiz.php?action=play&preview=yes&sid=$sid\">preview</a>

[i]lastly, you'll want to make sure ALL users can play,

when a user completes a section, it appears as *complete*, you need to click below, 
after each update, 
before turning the quiz back on.[/i]

<a href=\"./quiz.php?action=reset&sid=$sid\">Reset Scores</a>
\n";
if($row_quiz["switch"]=="on"){
echo "
[b]Quiz is active
<a href=\"./quiz.php?action=off&sid=$sid\">turn it off?</a>[/b]\n";
}else{
echo "
[b]Quiz is not active
<a href=\"./quiz.php?action=on&sid=$sid\">turn it on?</a>[/b]\n";
}

echo "

<a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>\n";
echo "</card>";
}
/////////////////////////////RESET/////////////////////////////

else if($action=="reset") 
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"reset\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz Options[/i][/b]
";
$query="UPDATE ibwf_users SET quiz_easy='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_medium='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_hard='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_score='0/0/0', total_score='0'";
mysql_query($query);
$query="delete from ibwf_quizusers where uid!=0";
mysql_query($query);
echo "[b]done![/b]
";
echo "
all sections will now appear as unplayed for all users.";
echo "

";
echo " <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>\n";
echo "</card>";
}
/////////////////////////////QUIZ ON/////////////////////////////

else if($action=="on")
{
if(!isowner(getuid_sid($sid)))
{
echo "<card id=\"main\" title=\"on\">";
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
echo "<card id=\"main\" title=\"Quiz Options\">";
addonline(getuid_sid($sid),"Quiz Options","");
echo "<p align=\"center\">";
echo "[b][i]Quiz Options[/i][/b]";
$query="UPDATE ibwf_quiz SET switch='on'";
mysql_query($query);

echo "[b]done![/b]

the quiz was activated, 
now all other users can participate.";

echo "

<a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>\n";
echo "</card>";
}
/////////////////////////////QUIZ OFF/////////////////////////////

else if($action=="off")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz Options [/i][/b]";
$query="UPDATE ibwf_quiz SET switch='off'";
mysql_query($query);

echo "[b]done![/b]

the quiz was deactivated, 
the link has disappeared from the main menu.";

echo "

<a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>\n";
echo "</card>";
}
/////////////////////////////EDIT/////////////////////////////

else if($action=="edit")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz Options[/i][/b]
";
$query="select * FROM ibwf_quiz WHERE difficulty='$diff' AND number='$q'";
$result=mysql_query($query);
$num_rows=mysql_num_rows($result);
$row=mysql_fetch_array($result);
$question=$row["question"];
$correct=$row["answer"];
$a=$row["answer1"];
$b=$row["answer2"];
$c=$row["answer3"];
$d=$row["answer4"];
$id=$row["id"];
echo "[b]edit question $q
[difficulty: $diff][/b]
";
echo "one of the answers below must be the same case and spelling as the correct answer
";
echo "<anchor>UPDATE";
echo "<go href=\"./quiz.php?action=save&q=$q&diff=$diff&sid=$sid\" method=\"post\">";
echo "
question:
";
echo "<input type=\"text\" name=\"nquestion\" value=\"$question\" maxlength=\"100\"/>";
echo "
correct answer:
";
echo "<input type=\"text\" name=\"nright\" value=\"$correct\" maxlength=\"100\"/>";
echo "
answer 1:
";
echo "<input type=\"text\" name=\"na\" value=\"$a\" maxlength=\"100\"/>";
echo "
answer 2:
";
echo "<input type=\"text\" name=\"nb\" value=\"$b\" maxlength=\"100\"/>";
echo "
answer 3:
";
echo "<input type=\"text\" name=\"nc\" value=\"$c\" maxlength=\"100\"/>";
echo "
answer 4:
";
echo "<input type=\"text\" name=\"nd\" value=\"$d\" maxlength=\"100\"/>";
echo "</go>
</anchor>
";
echo "
<a href=\"./quiz.php?action=options&sid=$sid\">Back</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>\n";
echo "</card>";
}
/////////////////////////////SAVE/////////////////////////////

else if($action=="save")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</card>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<card id=\"main\" title=\"Quiz Options\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz Options[/i][/b]";
$query="UPDATE ibwf_quiz SET question='$nquestion' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer='$nright' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer1='$na' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer2='$nb' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer3='$nc' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer4='$nd' where number=$q AND difficulty='$diff'";
mysql_query($query);
$next=($q+1);
if($next<=10){
echo "[b]done![/b]

question $q was updated

[b]question:[/b]
$nquestion

[b]right answer:[/b]
$nright

[b]answer 1:[/b]
$na

[b]answer 2:[/b]
$nb

[b]answer 3:[/b]
$nc

[b]answer 4:[/b]
$nd

<a href=\"./quiz.php?action=edit&q=$next&diff=$diff&sid=$sid\">Question $next</a>\n";
}else{
echo "[b]done![/b]

that was the last $diff question, 
taking you back to quiz admin..

[b]question:[/b]
$nquestion

[b]right answer:[/b]
$nright

[b]answer 1:[/b]
$na

[b]answer 2:[/b]
$nb

[b]answer 3:[/b]
$nc

[b]answer 4:[/b]
$nd\n";
}
echo "
<a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo "</p>";
echo "</card>";
}
/////////////////////////////Error/////////////////////////////

else
{
echo "<card id=\"main\" title=\"error\">";
echo "<p align=\"center\">";
echo "You are not logged in
";
echo "Or Your session has been expired

";
echo "<a href=\"../web/index.php\">Login</a>";
echo "</p>";

echo "</card>";

}
?>

</wml>

I DID EVERYFIN APART FROM ACTION=EDIT DIDNT HAVE TIME TO DO THAT, T WORKS BUT THE PAGE IS FREE OF VALIDATION ERRORS AL TRY GET THAT DUN FOR YA LATER ON IN THE DAY IF I CAN

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

busterkeaton10 Developer · 68 posts #7

no probs m8

how about its html and sql... can you also put it here?

modfiles Developer · 200 posts #8

how about its html and sql... can you also put it here?

its in wapdesire

crazybrumi Super moderator Principal · 1,064 posts #10

how about its html and sql... can you also put it here?

<?php

include("../web/config.php");
include("../web/core.php");
connectdb();
$brw = $HTTP_USER_AGENT;
$brws = explode("/",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$preview = $_GET["preview"];
$start = $_GET["start"];
$uid = getuid_sid($sid);
$nick = getnick_uid($uid);
$upload = $_GET["upload"];
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
$bcon = connectdb();
$script = $_GET["script"];

header("Content-type: text/html; charset=ISO-8859-1");
header("Cache-Control: no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
echo '<?xml version="1.0"?' . '>'; 
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";

/////////////////////////////Database Error/////////////////////////////

if (!$bcon)
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<img src=\"images/exit.gif\" alt=\"!\"/>
";
echo "[b]Error! Cannot Connect To Database...[/b]

";
echo "This error happens usually when backing up the database, please be patient...";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}

cleardata();
/////////////////////////////Ip Banned/////////////////////////////

if(isipbanned($uip,$ubr))
{
if(!isshield(getuid_sid($sid)))
{
echo "<head>";
echo "<title>Ip Block!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
echo "[b]This IP address is blocked!!![/b]
";
echo "
";
echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over

";
$banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
$remain =  $banto[0] - time();
$rmsg = gettimemsg($remain);
echo " IP: $rmsg

";
echo "</p>";
echo "

";
echo "<form action=\"../web/login.php\" method=\"get\">";
echo "[b]UserID:[/b]
<input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
";
echo "[b]Password:[/b]
<input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/>
";
echo "
<input name=\"Login\" type=\"submit\" value=\"Submit\"></form>";
echo "

Not registered yet? 
<a href=\"../web/register.php\">SignUp</a>
";
echo "<a href=\"../web/index.php?action=terms&sid=$sid\">Site Rules</a>
";
echo "</p>";
echo "<p align=\"center\">";
$onu = getnumonline();
echo "Members Inside: $onu</p>";
echo "<a href=\"../wap/index.php\">Wap 1.0(wml) Version</a></p>";
echo mobads();
echo "<div>[b]©2006-2007
$sitename[/b]</div>";
echo "</body>";
echo "</html>";
exit();
}
}
/////////////////////////////Session Expired/////////////////////////////

if(($action != "") && ($action!="terms"))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "You are not logged in
";
echo "Or Your session has been expired

";
echo "<a href=\"../web/index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
}
/////////////////////////////Banned/////////////////////////////

if(isbanned($uid))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
echo "[b]You are Banned[/b]

";
$banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
$remain = $banto[0]- time();
$rmsg = gettimemsg($remain);
echo "[b]Time Left: [/b]$rmsg
";
$nick = getnick_uid($banto[2]);
echo "[b]By: [/b]$nick
";
echo "[b]Reason: [/b]$banto[1]";
//echo "<a href=\"../web/index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
/////////////////////////////QUIZ/////////////////////////////

if($action=="quiz")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz[/i][/b]</div>";
echo "<p align=\"center\">
Welcome To $sitename Quiz
</p>
<p align=\"center\">
<a href=\"./quiz.php?action=play&sid=$sid\">Play</a>

<a href=\"./quiz.php?action=about&sid=$sid\">About</a>

<a href=\"./quiz.php?action=winners&sid=$sid\">Top Scorers</a>

<a href=\"./quiz.php?action=losers&sid=$sid\">Top Losers</a>
";
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
$count_score1=$count_score[0];
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
$count_score2=$count_score[0];
$countup=($count_score1+$count_score2);
echo "
$countup people have taken part in Quiz";
if(isowner(getuid_sid($sid))){echo "
<a href=\"./quiz.php?action=options&sid=$sid\">Update</a>";}
echo "</p>";
echo "<center><- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////LOSERS/////////////////////////////

else if($action=="losers")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz[/i][/b]</div>";
if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "<center>[b]$num_items[0] have failed miserably[/b]</center>";
echo "<p align=\"center\">\n";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score<'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]
".$item["quiz_score"]."
\n";
}
}
if($page>1){
echo "
<a href=\"./quiz.php?action=losers&page=".($page-1)."&sid=$sid\"><-Prev</a> ";
}
if($page<$num_pages){
if($page==1)echo "
";
echo "<a href=\"./quiz.php?action=losers&page=".($page+1)."&sid=$sid\">Next-></a>\n";
}
echo "
$page/$num_pages</p>\n";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>
";
echo "<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////WINNERS/////////////////////////////

else if($action=="winners")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz[/i][/b]</div>";
if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "<center>[b]$num_items[0] players made the leaderboard[/b]</center>";
echo "<p align=\"center\">\n";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score>'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]
".$item["quiz_score"]."
\n";
}
}
if($page>1){
echo "
<a href=\"./quiz.php?action=losers&page=".($page-1)."&sid=$sid\"><-Prev</a> ";
}
if($page<$num_pages){
if($page==1)echo "
";
echo "<a href=\"./quiz.php?action=losers&page=".($page+1)."&sid=$sid\">Next-></a>\n";
}
echo "
$page/$num_pages</p>\n";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>
";
echo "<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////ABOUT/////////////////////////////

else if($action=="about")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz[/i][/b]</div>";
echo "<p align=\"center\">
Welcome To $sitename Quiz
</p>
<p align=\"center\">
this is a multiple choice quiz, each question has 4 possible answers.

for each question you get right, you get points, 
the points you get depend on the difficulty level you've selected:

[b]easy = 10 points[/b]

[b]medium = 20 points[/b]

[b]hard = 30 points[/b]

but, each time you get a question wrong, you lose the 10, 
20 or 
30 points depending on the difficulty level you selected, 
and don't think it stops at zero, oh no, if you get your very first question wrong, 
you'll need to get the next one right to return to zero.
</p>";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////PLAY/////////////////////////////

else if($action=="play")
{
addonline(getuid_sid($sid),"Quiz","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz
please select level of difficulty[/i][/b]</div>";
echo "<p align=\"center\">\n";
$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
$score=explode("/",$row_profiles["quiz_score"]);
$score=$score[0]+$score[1]+$score[2];
$quiz_easy=$row_profiles["quiz_easy"];
$quiz_medium=$row_profiles["quiz_medium"];
$quiz_hard=$row_profiles["quiz_hard"];
if($row_quiz["switch"]==on||(isowner(getuid_sid($sid))&&$preview==yes)){
if($quiz_easy=="no")echo "<a style=\"color: blue;\" href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=easy\">easy</a>
\n";
else if($quiz_easy=="yes")echo "[b]** completed **[/b]
\n";
if($quiz_medium=="no")echo "<a style=\"color: green;\" href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=med\">medium</a>
\n";
elseif($quiz_medium=="yes")echo "[b]** completed **[/b]
\n";
if($quiz_hard=="no")echo "<a style=\"color: red;\" href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=hard\">hard</a>
\n";
else if($quiz_hard=="yes")echo "[b]** completed **[/b]
\n";
if(($quiz_hard=="yes")&&($quiz_easy=="yes")&&($quiz_medium=="yes")){
echo "[b]you have answered all the questions for this week, please try again next week![/b]
\n";
}
echo "
[b]your current score is $score[/b]\n";
}else{
echo "Quiz Is Currently Turned Off Please Come Back Later\n";
}
echo "</p>\n";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////QUESTIONS/////////////////////////////

else if($action=="questions")
{
addonline(getuid_sid($sid),"Quiz","");
$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
if($row_quizusers[$dif."_question"]!=0){$q=$row_quizusers[$dif."_next"];}
$row_quiz=mysql_fetch_array(mysql_query("SELECT * FROM ibwf_quiz WHERE difficulty='".$dif."' AND number='".$q."'"));
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz
Question $q[/i][/b]</div>";
if($start=yes){
mysql_query("insert into ibwf_quizusers set easy_question='".$q."', easy_next='".$q."', med_question='".$q."', med_next='".$q."', hard_question='".$q."', hard_next='".$q."', uid='".getuid_sid($sid)."'");
}
$question = $row_quiz["question"];
$a = $row_quiz["answer1"];
$b = $row_quiz["answer2"];
$c = $row_quiz["answer3"];
$d = $row_quiz["answer4"];
$q = $row_quiz["number"];
$quid = $row_quiz["id"];
$l = $row_quiz["difficulty"];
echo "<p align=\"center\">
[b]$question[/b]
</p>
<p align=\"center\">
[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=a&quid=$quid&l=$l\">$a</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=b&quid=$quid&l=$l\">$b</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=c&quid=$quid&l=$l\">$c</a>[/i]

[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=d&quid=$quid&l=$l\">$d</a>[/i]";
echo "</p>";
echo "<center><- <a href=\"./quiz.php?action=play&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////ANSWER/////////////////////////////

else if($action=="answer")
{
addonline(getuid_sid($sid),"Quiz","");
$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$tmax=$row_ses["tmax"];
$totalscore=explode("/",$row_profiles["quiz_score"]);
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz where id='$quid'"));
$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
$correct = $row_quiz["answer"];
$ga = $row_quiz["answer1"];
$gb = $row_quiz["answer2"];
$gc = $row_quiz["answer3"];
$gd = $row_quiz["answer4"];
if($a=="a")$guess="$ga";
else if($a=="b")$guess="$gb";
else if($a=="c")$guess="$gc";
else if($a=="d")$guess="$gd";
if($row_quizusers[$l."_next"]!=$q){
echo "<head>
<title>".getnick_sid($sid)."@Quiz</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">
</head>
<body>
<div>[b]Cheater![/b]</div>
<p align=\"center\">
<img src=\"../images/error.gif\" alt=\"[x]\"/>
[b]Error!!![/b]

You cannot reload this page to gain more points DO NOT CHEAT!
</p>\n";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>
</body>
</html>\n";
exit;
}
else if($guess=="$correct"){
mysql_query("update ibwf_quizusers set ".$l."_question='".$q."', ".$l."_next='".($q+1)."' where uid='".getuid_sid($sid)."'");
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]+$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]+$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]+$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Correct![/i][/b]</div>";
echo "<p align=\"center\">
[i]you got the right answer, $plus points were added to your score.[/i]
";
if($q<10){
$next=$q+1;
echo "
<a href=\"./quiz.php?action=questions&sid=$sid&q=$next&dif=$l\">go to question $next</a>
";
}
else if($q==10){
if($l=="easy"){
mysql_query("update ibwf_users set quiz_easy='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="med"){
mysql_query("update ibwf_users set quiz_medium='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="hard"){
mysql_query("update ibwf_users set quiz_hard='yes' where id='".getuid_sid($sid)."'");
}
echo "
you've completed this round.

<a href=\"./quiz.php?action=play&sid=$sid\">select difficulty</a>
";
}
echo "</p>";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
else
{
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]-$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]-$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]-$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Wrong![/i][/b]</div>";
echo "<p align=\"center\">
[i]your answer was wrong, $plus points were deducted from your score.[/i]

</p>
<p align=\"center\">
-> <a href=\"./quiz.php?action=questions&sid=$sid&q=$q&dif=$l\">try question $q again</a>

</p>";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
}
/////////////////////////////OPTIONS/////////////////////////////

else if($action=="options")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz Options</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz Options[/i][/b]</div>";
echo "<p align=\"center\">
Please select the set of questions you wish to edit

<a href=\"./quiz.php?action=edit&q=1&diff=easy&sid=$sid\" style=\"color:blue;\">easy</a>

<a href=\"./quiz.php?action=edit&q=1&diff=med&sid=$sid\" style=\"color:green;\">medium</a>

<a href=\"./quiz.php?action=edit&q=1&diff=hard&sid=$sid\" style=\"color:red;\">hard</a>

<a href=\"./quiz.php?action=play&preview=yes&sid=$sid\">preview</a>

[i]lastly, you'll want to make sure ALL users can play,

when a user completes a section, it appears as *complete*, you need to click below, 
after each update, 
before turning the quiz back on.[/i]

<a href=\"./quiz.php?action=reset&sid=$sid\">Reset Scores</a>
\n";
if($row_quiz["switch"]=="on"){
echo "
[b]Quiz is active
<a href=\"./quiz.php?action=off&sid=$sid\">turn it off?</a>[/b]\n";
}else{
echo "
[b]Quiz is not active
<a href=\"./quiz.php?action=on&sid=$sid\">turn it on?</a>[/b]\n";
}
echo "</p>\n";
echo "<center><- <a href=\"./quiz.php?action=quiz&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////RESET/////////////////////////////

else if($action=="reset") 
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz Options</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz Options[/i][/b]</div>";
$query="UPDATE ibwf_users SET quiz_easy='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_medium='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_hard='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_score='0/0/0', total_score='0'";
mysql_query($query);
$query="delete from ibwf_quizusers where uid!=0";
mysql_query($query);
echo "<p align=\"center\">
[b]done![/b]

all sections will now appear as unplayed for all users.
</p>\n";
echo "<center><- <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////QUIZ ON/////////////////////////////

else if($action=="on")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz Options</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz Options[/i][/b]</div>";
$query="UPDATE ibwf_quiz SET switch='on'";
mysql_query($query);
echo "<p align=\"center\">
[b]done![/b]

the quiz was activated, 
now all other users can participate.
</p>\n";
echo "<center><- <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////QUIZ OFF/////////////////////////////

else if($action=="off")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz Options</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz Options[/i][/b]</div>";
$query="UPDATE ibwf_quiz SET switch='off'";
mysql_query($query);
echo "<p align=\"center\">
[b]done![/b]

the quiz was deactivated, 
the link has disappeared from the main menu.
</p>\n";
echo "<center><- <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////EDIT/////////////////////////////

else if($action=="edit")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz Options</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz Options[/i][/b]</div>";
echo "<p align=\"center\">\n";
$query="select * FROM ibwf_quiz WHERE difficulty='$diff' AND number='$q'";
$result=mysql_query($query);
$num_rows=mysql_num_rows($result);
$row=mysql_fetch_array($result);
$question=$row["question"];
$correct=$row["answer"];
$a=$row["answer1"];
$b=$row["answer2"];
$c=$row["answer3"];
$d=$row["answer4"];
$id=$row["id"];
echo "[b]edit question $q
[difficulty: $diff][/b]
</p>
<center>
<form action=\"./quiz.php?action=save&q=$q&diff=$diff&sid=$sid\" method=\"post\">

question:

<input type=\"text\" name=\"nquestion\" value=\"$question\" maxlength=\"100\"/>

correct answer:

<input type=\"text\" name=\"nright\" value=\"$correct\" maxlength=\"100\"/>

one of the answers below must be the same case and spelling as the correct answer

answer 1:

<input type=\"text\" name=\"na\" value=\"$a\" maxlength=\"100\"/>

answer 2:

<input type=\"text\" name=\"nb\" value=\"$b\" maxlength=\"100\"/>

answer 3:

<input type=\"text\" name=\"nc\" value=\"$c\" maxlength=\"100\"/>

answer 4:

<input type=\"text\" name=\"nd\" value=\"$d\" maxlength=\"100\"/>

<input type=\"submit\" value=\"update\"/>
</form>
</center>\n";
echo "<center><- <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////SAVE/////////////////////////////

else if($action=="save")
{
if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit;
}
addonline(getuid_sid($sid),"Quiz Options","");
echo "<head>";
echo "<title>".getnick_sid($sid)."@Quiz Options</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>[b][i]Quiz Options[/i][/b]</div>";
echo "<p align=\"center\">\n";
$query="UPDATE ibwf_quiz SET question='$nquestion' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer='$nright' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer1='$na' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer2='$nb' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer3='$nc' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer4='$nd' where number=$q AND difficulty='$diff'";
mysql_query($query);
$next=($q+1);
if($next<=10){
echo "[b]done![/b]

question $q was updated

[b]question:[/b]
$nquestion

[b]right answer:[/b]
$nright

[b]answer 1:[/b]
$na

[b]answer 2:[/b]
$nb

[b]answer 3:[/b]
$nc

[b]answer 4:[/b]
$nd

<a href=\"./quiz.php?action=edit&q=$next&diff=$diff&sid=$sid\">Question $next</a>\n";
}else{
echo "[b]done![/b]

that was the last $diff question, 
taking you back to quiz admin..

[b]question:[/b]
$nquestion

[b]right answer:[/b]
$nright

[b]answer 1:[/b]
$na

[b]answer 2:[/b]
$nb

[b]answer 3:[/b]
$nc

[b]answer 4:[/b]
$nd\n";
}
echo "<center><- <a href=\"./quiz.php?action=options&sid=$sid\">Back</a>

<- <a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a></center>";
echo "</body>";
echo "</html>";
}
/////////////////////////////Error/////////////////////////////

else
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "You are not logged in
";
echo "Or Your session has been expired

";
echo "<a href=\"../web/index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
}
?>

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

crazybrumi Super moderator Principal · 1,064 posts #11

heres the sql

-- --------------------------------------------------------

--
-- Table structure for table `ibwf_quiz`
--

CREATE TABLE `ibwf_quiz` (
  `id` int(11) NOT NULL auto_increment,
  `question` varchar(200) NOT NULL default '',
  `answer` varchar(30) NOT NULL default '',
  `difficulty` varchar(12) NOT NULL default '',
  `number` int(11) NOT NULL default '0',
  `answer1` varchar(50) NOT NULL default '',
  `answer2` varchar(50) NOT NULL default '',
  `answer3` varchar(50) NOT NULL default '',
  `answer4` varchar(50) NOT NULL default '',
  `switch` char(3) NOT NULL default 'on',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=31;

--
-- Dumping data for table `ibwf_quiz`
--

INSERT INTO `ibwf_quiz` VALUES(1, 'Who preceded Margaret Thatcher as Prime Minister of Great Britain*wank*', 'james callaghan', 'easy', 1, ' shaun texas', 'john newton', 'james callaghan', 'greg peterson', 'on');
INSERT INTO `ibwf_quiz` VALUES(2, 'Who was the second man to step foot on the surface of the moon?', 'buzz aldrin', 'easy', 2, 'no man', 'buzz aldrin', 'james newman', 'paul newton', 'on');
INSERT INTO `ibwf_quiz` VALUES(3, 'Where were the 1970 football World Cup finals held*wank*', 'mexico', 'easy', 3, 'russia', 'mexico', 'spain', 'georgia', 'on');
INSERT INTO `ibwf_quiz` VALUES(4, 'In books by JRR Tolkien, what kind of creatures are Bilbo and Frodo Baggins*wank*', 'hobbits', 'easy', 4, 'trees', 'kings', 'hobbits', 'elfs', 'on');
INSERT INTO `ibwf_quiz` VALUES(5, 'Which Italian city is home of the car manufacturer Fiat?*wank*', 'turin', 'easy', 5, 'rome', 'grease', 'turin', 'italy', 'on');
INSERT INTO `ibwf_quiz` VALUES(6, 'What do the French call the English Channel*wank*', 'le manche', 'easy', 6, 'le moon', 'le manche', 'le river', 'le lake', 'on');
INSERT INTO `ibwf_quiz` VALUES(7, 'In which year of the 1940''s did the D-Day landings take place on the coast of Normandy*wank*', '1944', 'easy', 7, '1950', '1949', '1945', '1944', 'on');
INSERT INTO `ibwf_quiz` VALUES(8, 'Who starred in the films Some Like It Hot Bus Stop The Seven Year Itch*wank*', 'marilyn monroe', 'easy', 8, 'betty moore', 'patrica newman', 'marilyn monroe', 'sue white', 'on');
INSERT INTO `ibwf_quiz` VALUES(9, 'What is the largest mammal on Earth*wank*', 'blue whale', 'easy', 9, 'white shark', 'man eating whale', 'blue whale', 'red whale', 'on');
INSERT INTO `ibwf_quiz` VALUES(10, 'What is North Americas highest mountain?*wank*', 'mount mckinley', 'easy', 10, 'mount hilton', 'mount america', 'mount mckinley', 'mount nothing', 'on');
INSERT INTO `ibwf_quiz` VALUES(11, 'What is the chemical symbol for tin?*wank*', 'sn', 'med', 1, 'ca', 'pn', 'sn', 'vp', 'on');
INSERT INTO `ibwf_quiz` VALUES(12, 'What are Corvettes, Sloops and Brigantines*wank*', 'sailing ships', 'med', 2, 'ships', 'raceing ships', 'sailing ships', 'small ships', 'on');
INSERT INTO `ibwf_quiz` VALUES(13, 'Until the introduction of the Euro, what is the unit of currency in Austria*wank*', 'schilling', 'med', 3, 'penny', 'dollar', 'cents', 'schilling', 'on');
INSERT INTO `ibwf_quiz` VALUES(14, 'Which African country s capital city is Luanda', 'angola', 'med', 4, 'angola', 'pangoa', 'africa', 'zambia', 'on');
INSERT INTO `ibwf_quiz` VALUES(15, 'what is the Meaning before noon what does the abbreviation am stand for *wank*', 'ante meridiem', 'med', 5, 'ante sun rize', 'ante meridiem', 'ante morning', 'ante night', 'on');
INSERT INTO `ibwf_quiz` VALUES(16, 'hat is the fifth book book of the Old Testament?', 'deuteronomy', 'med', 6, 'mark', 'luke', 'matthew', 'deuteronomy', 'on');
INSERT INTO `ibwf_quiz` VALUES(17, 'Other than the Sun what is the nearest star to the Earth*wank*', 'proxima centauri', 'med', 7, 'sun centauri', 'Proxima sun', 'proxima centauri', 'centauri sun', 'on');
INSERT INTO `ibwf_quiz` VALUES(18, 'Which band topped the UK album charts in 1991 with their debut LP Nevermind', 'nirvana', 'med', 8, 'pearl jam', 'nirvana', 'ozzy', 'acdc', 'on');
INSERT INTO `ibwf_quiz` VALUES(19, 'In which city was the first series of Auf Wiedersehen Pet primarily set', 'dusseldorf', 'med', 9, 'the pet primarily', 'dusseldorf', 'the auf', 'pet house', 'on');
INSERT INTO `ibwf_quiz` VALUES(20, 'What precious gemstone is associated with the 45th wedding anniversary*wank*', 'sapphire', 'med', 10, 'ruby', 'pink ruby', 'sapphire', 'topaz', 'on');
INSERT INTO `ibwf_quiz` VALUES(21, ' What is the square root of 121*wank*', '11', 'hard', 1, '54', '17', '11', '23', 'on');
INSERT INTO `ibwf_quiz` VALUES(22, 'How many dimes are in a US dollar?', '10', 'hard', 2, '30', '24', '15', '10', 'on');
INSERT INTO `ibwf_quiz` VALUES(23, 'What is the chemical symbol for Gold*wank*', 'au', 'hard', 3, 'pn', 'ga', 'au', 'cn', 'on');
INSERT INTO `ibwf_quiz` VALUES(24, 'Which television character has the car registration plate FAB1*wank*', 'lady penelope', 'hard', 4, 'fed', 'smufs', 'lady penelope', 'tom and jerry', 'on');
INSERT INTO `ibwf_quiz` VALUES(25, 'Who composed the ballets The Nutcracker and Swan Lake *wank*', 'peter tchaikovsky', 'hard', 5, 'rob tilton', 'james corbet', 'peter tchaikovsky', 'tom hanks', 'on');
INSERT INTO `ibwf_quiz` VALUES(26, 'If you suffered from arachnophobia what would you have an irrational fear of', 'spiders', 'hard', 6, 'brids', 'dogs', 'spiders', 'ants', 'on');
INSERT INTO `ibwf_quiz` VALUES(27, 'Which company produces the computer operating system Windows', 'microsoft', 'hard', 7, 'windows xp', 'vesta', 'windows nt', 'microsoft', 'on');
INSERT INTO `ibwf_quiz` VALUES(28, 'What is the deepest lake in the world, with depths over 1,600 metres', 'lake baykal', 'hard', 8, 'lake baykal', 'lake tinaroo', 'lake paroo', 'the glass lake', 'on');
INSERT INTO `ibwf_quiz` VALUES(29, 'What city does Sugar Loaf mountain overlook?', 'rio de janeiro', 'hard', 9, 'vegas', 'reno', 'rio de janeiro', 'green land', 'on');
INSERT INTO `ibwf_quiz` VALUES(30, 'What were the names of the 3 ships Christopher Columbus led in his discovery of da Americas in 1492', 'santa maria nina', 'hard', 10, 'santa maria nina', 'maria pinta nina', 'pinta santa nove', 'nina pinta santa', 'on');

-- --------------------------------------------------------

--
-- Table structure for table `ibwf_quizusers`
--

CREATE TABLE `ibwf_quizusers` (
  `uid` int(100) NOT NULL default '0',
  `easy_question` char(2) NOT NULL default '0',
  `easy_next` char(2) NOT NULL default '0',
  `med_question` char(2) NOT NULL default '0',
  `med_next` char(2) NOT NULL default '0',
  `hard_question` char(2) NOT NULL default '0',
  `hard_next` char(2) NOT NULL default '0',
  PRIMARY KEY  (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ibwf_quizusers`
--

-- --------------------------------------------------------

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

busterkeaton10 Developer · 68 posts #15

av just put it on my site and it works perfectly, whats ur site url ?

you just upload the stuff? OK let me do it again... sorry if i cant put my Crap site here... cause Amy always hack lava sites... External image (may be gone)

ori Lead · 512 posts #16

lol i made that feature off the quiz from phoenixbytes and some hosts do hav that error so must be the server in general all i can say is i did it under php 5.2.5 so duno if thats an issue on older version cos worked fine 4 me and also fixed a few glitches that im sure most ppl hav but its on my new script so its coded differently so posting it would be waste time as u only hav 2 recode it anyway

SiLeNce Developer · 138 posts #20
<?php
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<?php
include("config.php");
include("core.php");
connectdb();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$lastloc=$_GET["lstloc"];
if($lastloc=="cht"){
    $rid= $_GET["rid"];
    $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
    $rname = $rooms[1];
}
if(islogged($sid)==false)
{
    echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
}
$uid = getuid_sid($sid);
if(isbanned($uid))
    {
      echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/>
";
      echo "[b]You are Banned[/b]

";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
    $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "[b]Time Left: [/b]$rmsg
";
      $nick = getnick_uid($banto[2]);
    echo "[b]By: [/b]$nick
";
    echo "[b]Reason: [/b]$banto[1]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }

if($action=="main")
{
addonline(getuid_sid($sid),"Main Quiz","quiz.php?action=main");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "Welcome To $sitename Quiz";
echo "
";

echo "<a href=\"./quiz.php?action=play&sid=$sid\">Play</a>
";
echo "<a href=\"./quiz.php?action=about&sid=$sid\">About</a>
";
echo "<a href=\"./quiz.php?action=winners&sid=$sid\">Top Scorers</a>
";
echo "<a href=\"./quiz.php?action=losers&sid=$sid\">Top Losers</a>
";
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
$count_score1=$count_score[0];
$count_score=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
$count_score2=$count_score[0];
$countup=($count_score1+$count_score2);
echo "
";
echo "$countup people have taken part in Quiz";
if(isowner(getuid_sid($sid)))
{
echo "
";
echo "<a href=\"./quiz.php?action=options&sid=$sid\">Update</a>";
}

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="play")
{
addonline(getuid_sid($sid),"Play Quiz","quiz.php?action=main");
echo "<card id=\"main\" title=\"Play Quiz\">";
echo "<p align=\"center\">";
echo "[b]Play Quiz[/b]";
echo "
";
echo "</p>";
echo "<p align=\"center\">";

$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
$score=explode("/",$row_profiles["quiz_score"]);
$score=$score[0]+$score[1]+$score[2];
$quiz_easy=$row_profiles["quiz_easy"];
$quiz_medium=$row_profiles["quiz_medium"];
$quiz_hard=$row_profiles["quiz_hard"];

if($row_quiz["switch"]==on||(isowner(getuid_sid($sid))&&$preview==yes)){
if($quiz_easy=="no")
echo "<a href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=easy\">easy</a>
";
else if($quiz_easy=="yes")
echo "[b]** completed **[/b]
";

if($quiz_medium=="no")
echo "<a href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=med\">medium</a>
";
elseif($quiz_medium=="yes")
echo "[b]** completed **[/b]
";

if($quiz_hard=="no")
echo "<a href=\"./quiz.php?action=questions&start=yes&sid=$sid&q=1&dif=hard\">hard</a>
";
else if($quiz_hard=="yes")
echo "[b]** completed **[/b]
";

if(($quiz_hard=="yes")&&($quiz_easy=="yes")&&($quiz_medium=="yes")){
echo "[b]you have answered all the questions for this week, please try again next week![/b]
";
}
echo "
";
echo "[b]your current score is $score[/b]";
}else{
echo "Quiz Is Currently Turned Off Please Come Back Later";
}

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="questions")
{
addonline(getuid_sid($sid),"Quiz Questions","quiz.php?action=main");

$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
if($row_quizusers[$dif."_question"]!=0){$q=$row_quizusers[$dif."_next"];}
$row_quiz=mysql_fetch_array(mysql_query("SELECT * FROM ibwf_quiz WHERE difficulty='".$dif."' AND number='".$q."'"));

echo "<card id=\"main\" title=\"Questions\">";
echo "<p align=\"center\">";
echo "[b][i]Quiz
Question $q[/i][/b]";
echo "

";

if($start=yes){
mysql_query("insert into ibwf_quizusers set easy_question='".$q."', easy_next='".$q."', med_question='".$q."', med_next='".$q."', hard_question='".$q."', hard_next='".$q."', uid='".getuid_sid($sid)."'");
}
$question = $row_quiz["question"];
$a = $row_quiz["answer1"];
$b = $row_quiz["answer2"];
$c = $row_quiz["answer3"];
$d = $row_quiz["answer4"];
$q = $row_quiz["number"];
$quid = $row_quiz["id"];
$l = $row_quiz["difficulty"];

echo "[b]$question[/b]";
echo "
";

echo "[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=a&quid=$quid&l=$l\">$a</a>[/i]
";
echo "[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=b&quid=$quid&l=$l\">$b</a>[/i]
";
echo "[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=c&quid=$quid&l=$l\">$c</a>[/i]
";
echo "[i]<a href=\"./quiz.php?action=answer&sid=$sid&q=$q&a=d&quid=$quid&l=$l\">$d</a>[/i]";

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="answer")
{
addonline(getuid_sid($sid),"Answer Questions","quiz.php?action=main");

$row_profiles=mysql_fetch_array(mysql_query("select * from ibwf_users where id='".getuid_sid($sid)."'"));
$tmax=$row_ses["tmax"];
$totalscore=explode("/",$row_profiles["quiz_score"]);
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz where id='$quid'"));
$row_quizusers=mysql_fetch_array(mysql_query("select * from ibwf_quizusers where uid='".getuid_sid($sid)."'"));
$correct = $row_quiz["answer"];
$ga = $row_quiz["answer1"];
$gb = $row_quiz["answer2"];
$gc = $row_quiz["answer3"];
$gd = $row_quiz["answer4"];
if($a=="a")$guess="$ga";
else if($a=="b")$guess="$gb";
else if($a=="c")$guess="$gc";
else if($a=="d")$guess="$gd";
if($row_quizusers[$l."_next"]!=$q)
{
echo "<card id=\"main\" title=\"$sitename\">";
echo "<p align=\"center\">";
echo "[b]CHEATER !![/b]";
echo "
";
echo "You cannot reload this page to gain more points DO NOT CHEAT!";
echo "

";
echo "<anchor>Back to Qustions<prev/></anchor>";
echo "
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
echo "</wml>";
exit();
}
else if($guess=="$correct"){
mysql_query("update ibwf_quizusers set ".$l."_question='".$q."', ".$l."_next='".($q+1)."' where uid='".getuid_sid($sid)."'");
if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]+$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]+$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]+$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");

echo "<card id=\"main\" title=\"Answering Questions\">";
echo "<p align=\"center\">";

echo "[i]you got the right answer, $plus points were added to your score.[/i]
";
if($q<10){
$next=$q+1;
echo "
<a href=\"./quiz.php?action=questions&sid=$sid&q=$next&dif=$l\">go to question $next</a>
";
}
else if($q==10){
if($l=="easy"){
mysql_query("update ibwf_users set quiz_easy='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="med"){
mysql_query("update ibwf_users set quiz_medium='yes' where id='".getuid_sid($sid)."'");
}
else if($l=="hard"){
mysql_query("update ibwf_users set quiz_hard='yes' where id='".getuid_sid($sid)."'");
}
echo "
you've completed this round.
";
echo "<a href=\"./quiz.php?action=play&sid=$sid\">select difficulty</a>
";
}
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"./index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";

}else{

if($l=="easy")$plus="10";
else if($l=="med")$plus="20";
else if($l=="hard")$plus="30";
if($l==easy)$totalscore=($totalscore[0]-$plus)."/".$totalscore[1]."/".$totalscore[2];
else if($l==med)$totalscore=$totalscore[0]."/".($totalscore[1]-$plus)."/".$totalscore[2];
else if($l==hard)$totalscore=$totalscore[0]."/".$totalscore[1]."/".($totalscore[2]-$plus);
$total_score=explode("/",$totalscore);
mysql_query("update ibwf_users set quiz_score='".$totalscore."', total_score='".($total_score[0]+$total_score[1]+$total_score[2])."' where id='".getuid_sid($sid)."'");
echo "<card id=\"main\" title=\"Main Quiz\">";

echo "<p align=\"center\">";
echo "[b][i]Wrong![/i][/b]";
echo "[i]your answer was wrong, $plus points were deducted from your score.[/i]
";
echo "</p>";
echo "<p align=\"center\">";
echo "<anchor>Back to Qustions<prev/></anchor>";
echo "
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";
}
}

else if($action=="losers")
{
addonline(getuid_sid($sid),"Top Losers","quiz.php?action=main");

echo "<card id=\"main\" title=\"Top Losers\">";

if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score<'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "<p align=\"center\">";
echo "[b]$num_items[0] players made the leaderboard[/b]";
echo "
";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score<'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]: ";
echo "".$item["quiz_score"]."
";
}
}
echo "</p>";

echo "<p align=\"center\">";

if($page>1)
{
$ppage = $page-1;
echo "<a href=\"quiz.php?action=$action&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page

<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"gallery.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";

echo $rets;
}
echo "
";
echo "</p>";

echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";
}

else if($action=="winners")
{
addonline(getuid_sid($sid),"Top Winners","quiz.php?action=main");

echo "<card id=\"main\" title=\"Top Winners\">";

if($page==""||$page<=0)$page=1;
$num_items=mysql_fetch_array(mysql_query("SELECT count(*) from ibwf_users where total_score>'0'"));
if(!$num_items[0])$num_items[0]=0;
echo "<p align=\"center\">";
echo "[b]$num_items[0] players made the leaderboard[/b]";
echo "
";
$items_per_page=10;
$num_pages=ceil($num_items[0]/$items_per_page);
if($page>$num_pages)$page=$num_pages;
$limit_start=($page-1)*$items_per_page;
if($num_items[0]==0)$limit_start=0;
$sql="SELECT * FROM ibwf_users WHERE total_score>'0' ORDER BY total_score DESC LIMIT $limit_start, $items_per_page";
$items=mysql_query($sql);
echo mysql_error();
if($num_items[0]!=0){
while($item=mysql_fetch_array($items)){
echo "[i][b]".getnick_uid($item["id"])."[/b][/i]: ";
echo "".$item["quiz_score"]."
";
}
}
echo "</p>";

echo "<p align=\"center\">";

if($page>1)
{
$ppage = $page-1;
echo "<a href=\"quiz.php?action=$action&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page

<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"gallery.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";

echo $rets;
}
echo "
";
echo "</p>";

echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="about")
{
addonline(getuid_sid($sid),"Abouts Quiz","quiz.php?action=main");

echo "<card id=\"main\" title=\"Quiz About\">";

echo "<p align=\"center\">";

echo "this is a multiple choice quiz, each question has 4 possible answers.

";
echo "for each question you get right, you get points, the points you get depend on the difficulty level you've selected:";
echo "
";
echo "[b]easy = 10 points[/b]
";
echo "[b]medium = 20 points[/b]
";
echo "[b]hard = 30 points[/b]
";
echo "But, each time you get a question wrong, you lose the [b]10[/b], ";
echo "[b]20[/b] or [b]30[/b] points depending on the difficulty level you selected, and don't think it stops at zero, oh no, if you get your very first question wrong, you'll need to get the next one right to return to zero.";

echo "</p>";

echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="options")
{

if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
exit;
}

addonline(getuid_sid($sid),"Quiz Options","quiz.php?action=main");
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
echo "<card id=\"main\" title=\"Quiz Options\">";

echo "<p align=\"center\">";

echo "Please select the set of questions you wish to edit
";
echo "<a href=\"./quiz.php?action=edit&q=1&diff=easy&sid=$sid\">easy</a>
";
echo "<a href=\"./quiz.php?action=edit&q=1&diff=med&sid=$sid\">medium</a>
";
echo "<a href=\"./quiz.php?action=edit&q=1&diff=hard&sid=$sid\">hard</a>
";
echo "
";
echo "<a href=\"./quiz.php?action=play&preview=yes&sid=$sid\">preview</a>
";
echo "[i]lastly, you'll want to make sure ALL users can play,
";
echo "when a user completes a section, it appears as *complete*, you need to click below, after each update, before turning the quiz back on.[/i]";
echo "
";
echo "
";
echo "<a href=\"./quiz.php?action=reset&sid=$sid\">Reset Scores</a>
";
if($row_quiz["switch"]=="on"){
echo "
[b]Quiz is active
<a href=\"./quiz.php?action=off&sid=$sid\">turn it off?</a>[/b]";
}else{
echo "
[b]Quiz is not active
<a href=\"./quiz.php?action=on&sid=$sid\">turn it on?</a>[/b]";
}

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="reset")
{

if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
exit;
}

addonline(getuid_sid($sid),"Quiz Options","quiz.php?action=main");
$row_quiz=mysql_fetch_array(mysql_query("select * from ibwf_quiz"));
echo "<card id=\"main\" title=\"Quiz Options\">";

echo "<p align=\"center\">";

$query="UPDATE ibwf_users SET quiz_easy='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_medium='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_hard='no'";
mysql_query($query);
$query="UPDATE ibwf_users SET quiz_score='0/0/0', total_score='0'";
mysql_query($query);
$query="delete from ibwf_quizusers where uid!=0";
mysql_query($query);

echo "[b]Reseting Done![/b]
";
echo "
";
echo "all sections will now appear as unplayed for all users.";

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="on")
{

if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
exit;
}

addonline(getuid_sid($sid),"Quiz Options","quiz.php?action=main");

echo "<card id=\"main\" title=\"Quiz Options\">";

echo "<p align=\"center\">";

$query="UPDATE ibwf_quiz SET switch='on'";
mysql_query($query);

echo "[b]Quiz Turning On![/b]
";
echo "
";
echo "now all other users can participate.";

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="off")
{

if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
exit;
}

addonline(getuid_sid($sid),"Quiz Options","quiz.php?action=main");
echo "<card id=\"main\" title=\"Quiz Options\">";

echo "<p align=\"center\">";

$query="UPDATE ibwf_quiz SET switch='off'";
mysql_query($query);

echo "[b]Quiz Turning OFF![/b]
";
echo "
";
echo "the link has disappeared from the main menu.";

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="edit")
{

if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
exit;
}

addonline(getuid_sid($sid),"Quiz Options","quiz.php?action=main");

echo "<card id=\"main\" title=\"Quiz Options\">";

echo "<p align=\"center\">";

$query="select * FROM ibwf_quiz WHERE difficulty='$diff' AND number='$q'";
$result=mysql_query($query);
$num_rows=mysql_num_rows($result);
$row=mysql_fetch_array($result);
$question=$row["question"];
$correct=$row["answer"];
$a=$row["answer1"];
$b=$row["answer2"];
$c=$row["answer3"];
$d=$row["answer4"];
$id=$row["id"];
echo "[b]edit question $q
[difficulty: $diff][/b]";
echo "
";

echo "Answer<input type=\"text\" name=\"nquestion\" value=\"$question\" maxlength=\"100\"/>";
echo "
correct answer: <input type=\"text\" name=\"nright\" value=\"$correct\" maxlength=\"100\"/>";
echo "
";
echo "
one of the answers below must be the same case and spelling as the correct answer";
echo "
";
echo "answer 1:<input type=\"text\" name=\"na\" value=\"$a\" maxlength=\"100\"/>";
echo "
";
echo "answer 2:<input type=\"text\" name=\"nb\" value=\"$b\" maxlength=\"100\"/>";
echo "
";
echo "answer 3:<input type=\"text\" name=\"nc\" value=\"$c\" maxlength=\"100\"/>";
echo "
";
echo "answer 4: <input type=\"text\" name=\"nd\" value=\"$d\" maxlength=\"100\"/>";
echo "
";
          echo "<anchor>Edit";
          echo "<go href=\"./quiz.php?action=save&q=$q&diff=$diff&sid=$sid\" method=\"post\">";
          echo "<postfield name=\"nquestion\" value=\"$(nquestion)\"/>";
          echo "<postfield name=\"nright\" value=\"$(nright)\"/>";
          echo "<postfield name=\"na\" value=\"$(na)\"/>";
          echo "<postfield name=\"nb\" value=\"$(nb)\"/>";
          echo "<postfield name=\"nc\" value=\"$(nc)\"/>";
          echo "<postfield name=\"nd\" value=\"$(nd)\"/>";
          echo "</go></anchor>";

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else if($action=="save")
{

if(!isowner(getuid_sid($sid)))
{
addonline(getuid_sid($sid),"In The Forbidden Zone","");
echo "<card id=\"main\" title=\"Main Quiz\">";
echo "<p align=\"center\">";
echo "[b]Permission Denied![/b]
";
echo "
You cannot use this page...
";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</card>";
exit;
}

addonline(getuid_sid($sid),"Quiz Options","quiz.php?action=main");

echo "<card id=\"main\" title=\"Quiz Options\">";

echo "<p align=\"center\">";

$query="UPDATE ibwf_quiz SET question='$nquestion' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer='$nright' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer1='$na' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer2='$nb' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer3='$nc' where number=$q AND difficulty='$diff'";
mysql_query($query);
$query="UPDATE ibwf_quiz SET answer4='$nd' where number=$q AND difficulty='$diff'";
mysql_query($query);
$next=($q+1);
if($next<=10){
echo "[b]done![/b]";
echo "

";
echo "Question $q was updated
";
echo "
";
echo "[b]question:[/b]$nquestion
";
echo "[b]right answer:[/b]$nright
";
echo "---";

echo "
";
echo "[b]answer 1:[/b]$na
";
echo "[b]answer 2:[/b]$nb
";
echo "[b]answer 3:[/b]$nc
";
echo "[b]answer 4:[/b]$nd
";
echo "
<a href=\"./quiz.php?action=edit&q=$next&diff=$diff&sid=$sid\">Question $next</a>";
}else{
echo "[b]done![/b]
";
echo "
that was the last $diff question, ";
echo "taking you back to quiz admin..
";
echo "
[b]question:[/b]
$nquestion
";
echo "[b]right answer:[/b]
$nright
";
echo "
[b]answer 1:[/b]
$na
";
echo "[b]answer 2:[/b]
$nb
";
echo "[b]answer 3:[/b]
$nc
";
echo "[b]answer 4:[/b]
$nd";
}

echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"./quiz.php?action=main&sid=$sid\">Quiz Menu</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</card>";

}

else{
  addonline(getuid_sid($sid),"Lost in quiz","");
  echo "<card id=\"main\" title=\"Quiz Error!\">";
  echo "<p align=\"center\">";
  echo "I don't know how did you get into here, but there's nothing to show
";
echo "<a href=\"quiz.php?action=main&sid=$sid\">Quiz Menu</a>";
echo "
";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></card>";
}

?>

</wml>

here 1 wml .. i converted ago ..

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