"; echo mysql_errno().": "; echo mysql_error(); exit; } return $result; } $key = "sEcReT keY"; function keyED($txt,$encrypt_key) { $encrypt_key = md5($encrypt_key); $ctr=0; $tmp = ""; for ($i=0;$i

SMARTER UPGRADES IN PROGRESS -- PLEASE COME BACK IN 2 HOURS.

Thanks!

"; exit; } $conn = mysql_pconnect("nbc3", "betaweb", "betaweb"); if(!$conn) {print "Error: Could not connect to database.
\n"; exit; } if(!mysql_select_db("membership")) {echo "Wrong DB name?"; exit; } //test parameters //*************** // $tWEEK=65; //needs to be set for each week/month $tTHISYEAR=35; //competitions this period/year -- increment each test //***dont't forget to RESET pgames (update players set pgames=0) each month! //**************** $TEST=FALSE; //is this a test? $gQUESTIONS = 25; //total questions $gTOTPTS = 100; //total possible points +- $gGAMESTART = time(); $DF=""; $DF1=""; $DF0=""; $secret = "keyKEY1544"; $D2 = date("Y-m-d", time()); $ALLOWEDPGAMES = 4; //how many practice games are allowed per month for BB /* COMPETITION MAKEUP - 58 questions each section per test Area Desc (SR) (JR) (5-6) 0 Trivia (Sports/Movie) 14 14 14 1 Art/Music/Drama 8 6 8 2 Math 8 8 8 3 Biology 4 4 Chemistry 2 5 Physics 2 6 Earth Science 6 6 7 History 4 6 6 8 English 10 10 10 9 Literature 2 10 Social Studies 4 4 11 Economics 2 12 Current events 2 2 2 */ //senior areas $gsAREA = 11; //senior - how many total areas $gsAREA1 = '0'; //trivia $gsAREA2 = '1'; //art $gsAREA3 = '2'; //math $gsAREA4 = '3'; //biology $gsAREA5 = '4'; //chemistry $gsAREA6 = '5'; //physics $gsAREA7 = '7'; //history $gsAREA8 = '8'; //english $gsAREA9 = '9'; //literature $gsAREA10 = '11'; //economics $gsAREA11 = '12'; //current events //number of questions per area $gsNQ1 = 7; $gsNQ2 = 2; $gsNQ3 = 4; $gsNQ4 = 1; $gsNQ5 = 1; $gsNQ6 = 1; $gsNQ7 = 2; $gsNQ8 = 4; $gsNQ9 = 1; $gsNQ10 = 1; $gsNQ11 = 1; //junior areas + 5/6 $gjAREA = 7; //junior + 5/6 - how many total areas $gjAREA1 = '0'; //trivia $gjAREA2 = '2'; //math $gjAREA3 = '6'; //earth science $gjAREA4 = '7'; //history $gjAREA5 = '8'; //english $gjAREA6 = '10'; //social science $gjAREA7 = '11'; //current events //number of questions per area $gjNQ1 = 7; $gjNQ2 = 4; $gjNQ3 = 3; $gjNQ4 = 3; $gjNQ5 = 5; $gjNQ6 = 2; $gjNQ7 = 1; //*** preamble to test if ($ACTION=="3") { echo "
$DF
"; if (strlen($tNAME)>0) { echo "Is $tNAME"; } else { echo "Are You"; } echo "R U SmartEnough?
Read these Directions: "; if (strlen($gCOMP)>0 ) { $tGAME=1; //so points are not counted if ($gCOMP=="2") {$t1="Math";} elseif ($gCOMP=="3") {$t1="Biology";} elseif ($gCOMP=="4") {$t1="Chemistry";} elseif ($gCOMP=="5") {$t1="Physics";} elseif ($gCOMP=="6") {$t1="Earth Sciences";} elseif ($gCOMP=="7") {$t1="History";} elseif ($gCOMP=="8") {$t1="English";} elseif ($gCOMP=="9") {$t1="Literature";} elseif ($gCOMP=="0") {$t1="Trivia";} elseif ($gCOMP=="10") {$t1="Social Studies";} elseif ($gCOMP=="11") {$t1="Economics";} elseif ($gCOMP=="K") {$t1="S.A.T./A.C.T/P.S.A.T.";} elseif ($gCOMP=="N") {$t1="G.E.D.";} else {$t1="Open";} echo ""; /* echo "
This is a Special Area: $tCL $t1 practice.   It does NOT count.
You are NOT earning BetaBuck$, and you are NOT earning national standing points."; */ echo "
This is a Special Area: $tCL $t1 practice.   It does NOT count.
You are NOT earning national standing points."; } elseif ($tGAME!=0) { echo "
This is a $tCL Practice competition.   It does NOT count, and you are NOT earning Standing points.
You've played $tPgames Practice games this month.
"; } else { echo "
This is a the real thing."; } echo "
"; include('smartintro.inc'); echo "
"; exit; } //*** build test here if ($ACTION=="1") { //build test Header("REFRESH: 1000; URL=http://betaclub.org/smart/endgame.html"); //create first time player $result = m_q("SELECT * FROM players WHERE id = '$PHP_AUTH_USER' "); if (!mysql_num_rows($result)) { $t1 = time() + 5346800; //61 days $tREQ = date("Y/m/d", $t1 ); $result = mysql_query("INSERT INTO players (id, name, nextrqdgame, grade, st, school, startgame, totalgames, pos, ex, pgames ) VALUES ('$PHP_AUTH_USER', '$tNAME', '$tREQ', '$tGRADE', '$tSTATE', '$tSCHOOL', 0, 0, 0, '$tEX', 0 ) "); } //check for refresh, etc. $result1 = m_q("SELECT startgame,nextgame FROM players WHERE id='$PHP_AUTH_USER' ", $conn); $t1 = mysql_result($result1, 0, "startgame"); $t6 = mysql_result($result1, 0, "nextgame"); $t3 = time(); $t2 = $t1 + 1000; //checks for refresh echo ""; if ($tGAME==0 && ($t1 > 1) && ($t6 > $t2) ) { $t5 = date('M d h:m a', $t6); echo "
"; echo "You cannot take your next Competition early,
(-or- you have refreshed your screen while taking this competition.)

You need to wait until $t6 before competing again."; echo "

If you feel this message is in error, e-mail or call the National Office (864-583-4553 ext 117)"; echo "

"; exit; } else { $result1 = mysql_query("UPDATE players SET startgame = $gGAMESTART WHERE id='$PHP_AUTH_USER' ", $conn); } if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } //no artificats here $result = mysql_query("DELETE FROM tempq WHERE user='$PHP_AUTH_USER' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } echo " "; echo " "; //
FAST HELP"; echo "
//
// //   //
//
BETA PARTNER //
"; echo "


Webster's Dictionary
"; echo "


A&E's Biographies
"; echo "
"; //    From www.HomeworkHelp.com echo "
$DF Serious On-line Help!     From Hoxie H.S., Kansas
"; echo "
"; if ($tGAME=="3" && $gCOMP=="K") { echo "
    
"; } else { echo "
R U SmartEnough?"; } //special testing set-up -- refer back to smart3.014 for details on how this works... if (strlen($gCOMP)>0 ) { $tGAME=1; $gTOTPTS=800; $gAREA=1; $t3 = 'gAREA'.$gCOMP; $t11 = $$t3; //area } //track games played $t1=$t2=0; $result = m_q("SELECT * FROM players WHERE id = '$PHP_AUTH_USER' ", $conn); $row = mysql_fetch_array($result); $tlg = $row["nextrqdgame"]; $tng = $row["nextgame"]; $tTOTGAMES = $row["totalgames"]; $tlast = $row["lastgame"]; $tGRADELEVEL = $row["grade"]; if ($tGRADELEVEL<5) { $tGRADELEVEL=12; } $tTOTPGAMES = $row["totalpgames"]; if ($tGAME==0) { $tTOTGAMES++; $tT3=" totalgames=$tTOTGAMES"; } else { $tTOTPGAMES++; $tT4=" totalpgames=$tTOTPGAMES"; } echo " "; if ($tGAME==0) { echo "
This Competition Counts!
this is being scored. don't go back.    don't refresh.
"; $t1 = time() + (3600 * 24 * 61); //61 days $tNG = date("Y-m-d", $t1); $t1 = time() + (3600 * 24 * 31); //31 days $tPG = date("Y-m-d", $t1); if (!$TEST) { //check to see if they can legally play /* lets allow everyone for a while... maybe forever? if ($tGAME==0 && $D2 > $tlg ) { echo "

Sorry! Over a month has gone by since you have played. br>You are too late to play in this competition.

"; exit; } */ if ($D2 < $tng && $tGAME==0 ) { echo "

SORRY! You are too early to compete.  
You can next compete on $tng.
Why not try a Practice Competition?

"; exit; } else { $result = mysql_query("UPDATE players SET lastgame='$D2', nextgame='$tPG', nextrqdgame='$tNG' WHERE id='$PHP_AUTH_USER' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } } } else { $result = mysql_query("UPDATE players SET lastgame='$D2', nextgame='$tPG', nextrqdgame='$tNG' WHERE id='$PHP_AUTH_USER' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } } } else { //always can play practice echo "

This is a Practice Competition


"; } echo "
$DFYou have exactly 15 minutes to finish.   Click on the best answer.
When you've finished with this Competition, press the SUBMIT button at the bottom of the page.
"; //determine grade if ($tGRADELEVEL <= '6') { $tGAMELEVEL = '5'; $tGAMECH="j"; } elseif ($tGRADELEVEL <= '8') { $tGAMELEVEL = '6'; $tGAMECH="j"; } else { $tGAMELEVEL = '12'; $tGAMECH="s"; } //build game echo ""; $tC=$gTOTPTS; $tN=0; if ($tGAME != 0) { $gsAREA=1; //added 3-12-01 } if ( $tGAMECH == "j" ) { $game_AREAS = $gjAREA; } else { $game_AREAS = $gsAREA; } for ($j=1; $j<=$game_AREAS; $j++) { //loop through areas, selecting the % req'd $t3 = "g".$tGAMECH."AREA".$j; $t11 = $$t3; //area $t5 = "g".$tGAMECH."NQ".$j; $t13 = $$t5; //number of questions for this area //now pick questions if ($tGAME==0) { //from this week only - actual competition srand((double)microtime() * 1000000); $result = m_q("SELECT * from quest WHERE week= '$tWEEK' AND type= '$t11' AND level <= '$tGAMELEVEL' ORDER BY RAND() LIMIT $t13 "); $tTYPE1=$t11; } elseif (strlen($gCOMP)>0 ) { srand((double)microtime() * 1000000); $t12=$tC= 500; $t13 = $gQUESTIONS; if ($gCOMP>"A") { //achievement $result = m_q("SELECT * from quest WHERE week < '$tWEEK' AND achievement= '$gCOMP' ORDER BY RAND() LIMIT $gQUESTIONS "); $tTYPE1=$gCOMP; } else { //type $result = m_q("SELECT * from quest WHERE week < '$tWEEK' AND type= '$gCOMP' ORDER BY RAND() LIMIT $gQUESTIONS "); $tTYPE1=$gCOMP; } } else { //all before this week - PRACTICE srand((double)microtime() * 1000000); $result = m_q("SELECT * from quest WHERE week < '$tWEEK' AND type= '$t11' AND level <= '$tGAMELEVEL' ORDER BY RAND() LIMIT $t13 "); $tTYPE1=$t11; } $num = mysql_num_rows($result); $c1=$t12; $i=0; if ($num>0) { //rare indeed do { srand((double)microtime() * 1000000); $t1 = rand() % 100; $tid = mysql_result($result, $i, "id"); $tc = mysql_result($result, $i, "correct"); $tdiff = mysql_result($result, $i, "difficulty"); $result2 = mysql_query("INSERT INTO tempq (user,qid,answer,random,type,difficulty) VALUES ('$PHP_AUTH_USER','$tid', '$tc', $t1, '$tTYPE1','$tdiff') "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } $num--; $tN++; $i++; } while ($num>0 ) ; } } //for //if insufficient questions fill with trivia - exclude this month $result7 = m_q("SELECT user from tempq WHERE user='$PHP_AUTH_USER' " ); $t1 = mysql_num_rows($result7); if ($PHP_AUTH_USER == "1521423"){ echo "T1 = $t1 : gQUESTIONS = $gQUESTIONS : NUM = $num
"; } if ($t1 < $gQUESTIONS) { $result4 = m_q("SELECT * from quest WHERE week != '$tWEEK' AND type = '0' AND level <= '$tGAMELEVEL' ORDER BY RAND() LIMIT 60 "); $num4= mysql_num_rows($result4); $t13 = $gQUESTIONS - $t1; if ($num4 < $tQUEST) { $t13=$num4; echo "ADD QUESTIONS"; } $k=$m=0; do { $t1 = rand() % 100; $tid = mysql_result($result4, $k, "id"); $tc = mysql_result($result4, $k, "correct"); $tdiff = mysql_result($result4, $k, "difficulty"); $m++; //check for duplicates ... possible here... $result5 = m_q("SELECT * from tempq WHERE user='$PHP_AUTH_USER' AND qid='$PHP_AUTH_USER' "); $num5= mysql_num_rows($result5); if ($num5==0) { $result6 = mysql_query("INSERT INTO tempq (user, qid, answer, random, type, difficulty) VALUES ('$PHP_AUTH_USER','$tid', '$tc', $t1, 'x', '$tdiff') "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } $k++; } } while ( $k < $t13 ); } echo ""; //sort to put easiest first $result = m_q("SELECT * from tempq WHERE user='$PHP_AUTH_USER' ORDER BY difficulty "); //build history $result9 = mysql_query("INSERT INTO SE_history (id, cdate, typegame, finished) VALUES ('$PHP_AUTH_USER', '$D2', '$tGAME', '') "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } //create test $c1=1; $iA=$gQUESTIONS-1; $totPTS=0; for ($i=0; $i<=$iA; $i++) { $tID1 = mysql_result($result, $i, "qid"); $result1 = m_q("SELECT * from quest WHERE id='$tID1' " ); $tID = mysql_result($result1, 0, "id"); $tQ = mysql_result($result1, 0, "question"); $tA1 = mysql_result($result1, 0, "answer1"); $tA2 = mysql_result($result1, 0, "answer2"); $tA3 = mysql_result($result1, 0, "answer3"); $tA4 = mysql_result($result1, 0, "answer4"); $tA5 = mysql_result($result1, 0, "answer5"); $tCORRECT = mysql_result($result1, 0, "correct"); $tDIFF = mysql_result($result1, 0, "difficulty"); $tTYPE1 = mysql_result($result1, 0, "type"); $tHINT = mysql_result($result1, 0, "hint"); $tGQ = mysql_result($result1, 0, "graphicQ"); $tG1 = mysql_result($result1, 0, "graphic1"); $tG2 = mysql_result($result1, 0, "graphic2"); $tG3 = mysql_result($result1, 0, "graphic3"); $tG4 = mysql_result($result1, 0, "graphic4"); $tG5 = mysql_result($result1, 0, "graphic5"); $twk1 = mysql_result($result1, 0, "week"); $tEXPLAIN = mysql_result($result1, 0, "explain1"); echo ""; //difficulty value if ($tDIFF > 8) { $tDIFF1=20; } elseif ($tDIFF > 5) { $tDIFF1=15; } elseif ($tDIFF > 2) { $tDIFF1=10; } else { $tDIFF1=5; } $totPTS=$totPTS+$tDIFF1; $t1 = 'tANSWER'.$i; $t2 = 'tCORRECT'.$i; $t3 = 'tHINT'.$i; if (strlen($tA5)>0) { $t4=5; } elseif (strlen($tA4)>0) { $t4=4; } elseif (strlen($tA3)>0) { $t4=3; } else { $t4=2; } if (strlen($tG5)>0) { $t4=5; } elseif (strlen($tG4)>0) { $t4=4; } elseif (strlen($tG3)>0) { $t4=3; } else { $tG=2; } if ($tDIFF>8) { $t3="Tough!"; } elseif ($tDIFF>5) { $t3="Hard"; } elseif ($tDIFF>3) { $t3="Average"; } else { $t3="Easy"; } echo "
($c1.)"; if ($TEST) { echo "  [# $tID : $twk1]"; } echo "  $tQ "; if (strlen($tGQ)>0) { if (strlen($tQ)>0) { echo "
"; } echo ""; } echo "
  1. $tA1"; if (strlen($tG1)>0) { if (strlen($tA1)>0) { echo "
    "; } echo ""; } echo "
  2. $tA2"; if (strlen($tG2)>0) { if (strlen($tA2)>0) { echo "
    "; } echo ""; } if ($t4>2 ) { echo "
  3. $tA3"; if (strlen($tG3)>0) { if (strlen($tA3)>0) { echo "
    "; } echo ""; } } if ($t4>3 ) { echo "
  4. $tA4"; if (strlen($tG4)>0) { if (strlen($tA4)>0) { echo "
    "; } echo ""; } } if ($t4>4 ) { echo "
  5. $tA5"; if (strlen($tG5)>0) { if (strlen($tA5)>0) { echo "
    "; } echo ""; } } echo "
  
 
"; $c1++; } echo "
"; if ($tGAME==0) { echo " By submitting this competition, I affirm that I have completed this competition alone, that I have not used previously obtained answers, that I am a member in good standing of the National Beta Club, and I conform to the rules."; } echo "

"; echo "
Problems or suggestions? contact us"; //   (you win 100 BetaBucks for any suggestion we use)."; echo ""; exit; } if ($ACTION=="2") { //pre-completion check echo "

 

 
R U SmartEnough? $DF Are you ready to submit your Competition?

If so, then press this SCORE button, otherwise use your Browser's Back key to return and continue.

$DF1 (If you submit your test for scoring more than once you will INVALIDATE this competition.)

"; $iA=$gQUESTIONS-1; for ($i=0; $i<=$iA; $i++) { $tmpQ = "tQUEST".$i; $tmpA = "tANSWER".$i; $QUEST = ${$tmpQ}; $ANSWER = ${$tmpA}; echo "".chr(13); echo "".chr(13); } echo "

"; exit; } if ($ACTION=="2A") { //scoring algorithm //check for refresh, etc. echo ""; flush(); $result1 = m_q("SELECT finished FROM SE_history WHERE id='$PHP_AUTH_USER' AND cdate='$D2' "); $submitted = mysql_result($result1, 0, "finished"); if ($tGAME == 0 && $submitted == "X" && $PHP_AUTH_USER<>'jmoore') { echo "

 

 
You can not Submit this test for scoring more than once.
Your previous SmartEnough standing has not been affected.

If you feel this message is in error, e-mail or call the National Office (864-583-4553 ext 117)

"; exit; } $result1 = m_q("SELECT startgame,nextrqdgame FROM players WHERE id='$PHP_AUTH_USER' "); $t1 = mysql_result($result1, 0, "startgame"); $tSTARTdGAME = $t1; //check time to play -- allows 15 minutes + 10% $t2 = $t1 + 1050; $t4 = time(); if ($tGAME==0 && ($t2 < $t4)) { $t5 = $t4 + 2678400; //allows for waiting 31 days (was set to 60480) $t6 = date('M d h:m a', $t5); echo "

 

 
You have used MORE THAN the allocated 15 MINUTES.
(your previous SmartEnough standing has not been affected)

You will need to wait until $t6 before competing again.

If you feel this message is in error, e-mail or call the National Office (864-583-4553 ext 117)

"; exit; } if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } $tBB=$tPOINTS=$tR=$tW=0; echo "
"; $tUC=strtoupper($PHP_AUTH_USER); echo "
R U SmartEnough?
$DF Competition Results for $tUC

Go to the end of this page for your results!


"; flush(); //Put answers in the database $query = "UPDATE SE_history SET "; $cnt = $gQUESTIONS - 1; for ($i=0; $i<=$cnt; $i++) { $tmpQ = "tQUEST".$i; $tmpA = "tANSWER".$i; $QUEST = ${$tmpQ}; $ANSWER = ${$tmpA}; $num = $i+1; $QA="qa".$num; $Q="q".$num; if ($i == "0") { $query = $query." $QA = '$ANSWER', $Q = '$QUEST'"; } else { $query = $query.", $QA = '$ANSWER', $Q = '$QUEST'"; } } $query = $query." WHERE id = '$PHP_AUTH_USER' AND cdate = '$D2' "; $result9 = mysql_query($query); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } //build game //check grade level & ... WHERE level='06' $result = m_q("SELECT * from tempq WHERE user='$PHP_AUTH_USER' ORDER BY difficulty "); //pull from historical db $result9 = m_q("SELECT * FROM SE_history WHERE id='$PHP_AUTH_USER' AND cdate='$D2' AND finished<>'X' "); //now close $result10 = m_q("UPDATE SE_history SET finished='X' WHERE id='$PHP_AUTH_USER' AND cdate='$D2' "); $tCO=$tWR=$tUN=$totPTS=0; $c1=1; $iA=$gQUESTIONS-1; for ($i=0; $i<=$iA; $i++) { $tID1 = mysql_result($result, $i, "qid"); $result1 = m_q("SELECT * from quest WHERE id='$tID1' "); $tQ = mysql_result($result1, 0, "question"); $tA1 = mysql_result($result1, 0, "answer1"); $tA2 = mysql_result($result1, 0, "answer2"); $tA3 = mysql_result($result1, 0, "answer3"); $tA4 = mysql_result($result1, 0, "answer4"); $tA5 = mysql_result($result1, 0, "answer5"); $tGQ = mysql_result($result1, 0, "graphicQ"); $tG1 = mysql_result($result1, 0, "graphic1"); $tG2 = mysql_result($result1, 0, "graphic2"); $tG3 = mysql_result($result1, 0, "graphic3"); $tG4 = mysql_result($result1, 0, "graphic4"); $tG5 = mysql_result($result1, 0, "graphic5"); $tCORRECT = mysql_result($result1, 0, "correct"); $tLEVEL = mysql_result($result1, 0, "level"); $tDIFF = mysql_result($result1, 0, "difficulty"); $tTYPE1 = mysql_result($result1, 0, "type"); $tSTID = mysql_result($result1, 0, "stid"); $tRA = mysql_result($result1, 0, "rightanswer"); $tKW = mysql_result($result1, 0, "keywords"); $tpt = mysql_result($result1, 0, "ptaken"); $tpp = mysql_result($result1, 0, "ppassed"); //use history $qnum=$i+1; $gA="qa".$qnum; $gC="qc".$qnum; $t11 = mysql_result($result9, 0, "$gA"); $t22 = $tCORRECT; $tmp_result = mysql_query("UPDATE SE_history SET $gC = '$t22' WHERE id='$PHP_AUTH_USER' AND cdate='$D2' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } //difficulty value if ($tDIFF > 8) { $tDIFF1=20; } elseif ($tDIFF > 5) { $tDIFF1=15; } elseif ($tDIFF > 2) { $tDIFF1=10; } else { $tDIFF1=5; } $totPTS=$totPTS+$tDIFF1; //Determine how many choices there are for this question if ($tA5 != "") { $t4=5; } elseif ($tA4 != "") { $t4=4; } elseif ($tA3 != "") { $t4=3; } else { $t4=2; } //allow for no-answer if (strlen($t11)<1) { $t11=""; } if (strlen($t22)<1) { $t22=""; } if (strlen($t11) == 0) { //no answer echo "NOT ANSWERED"; $tUN++; } elseif ($t11 == $t22) { //Correct Answer //calculate winnings //winnings based on level of difficulty $tBB=$tBB+$tDIFF1; echo "CORRECT!
"; //    (you've earned BB$ $tDIFF1)
"; $tR=$tR + $tDIFF1; $tCO++; $tpp=$tpp+1; //update p-value } else { //Wrong Answer $tW=$tW + 1.0; //small penalty for wrong answers $tWR++; //set up learning module $tLEARN=""; echo "WRONG"; if (strlen($tLEARN)>0) { echo "     "; } } //update p-values // $tpt=$tpt+1; // $result8 = m_q("UPDATE quest SET ptaken=$tpt, ppassed=$tpp WHERE id='$tID1' "); echo ""; } else { echo "
 "; } echo "
"; echo "
($c1.)  $tQ "; if (strlen($tGQ)>0) { if (strlen($tQ)>0) { echo "
"; } echo ""; } echo "
  1. "; if ($t22==1) { echo ""; } echo " $tA1"; if (strlen($tG1)>0) { if (strlen($tA1)>0) { echo "
    "; } echo ""; } if ($t22==1) { echo "
     "; } if ($t11==1) { echo "   "; } echo "
  2. "; if ($t22==2) { echo " "; } echo " $tA2"; if (strlen($tG2)>0) { if (strlen($tA2)>0) { echo "
    "; } echo ""; } if ($t22==2) { echo "
     "; } if ($t11==2) { echo "    "; } if ($t4>2 ) { if ($t22==3) { echo " "; } echo "
  3. $tA3"; if (strlen($tG3)>0) { if (strlen($tA3)>0) { echo "
    "; } echo ""; } } if ($t22==3) { echo "
     "; } if ($t11==3) { echo "    "; } if ($t4>3 ) { echo "
  4. "; if ($t22==4) { echo " "; } echo " $tA4"; if (strlen($tG4)>0) { if (strlen($tA4)>0) { echo "
    "; } echo ""; } } if ($t22==4) { echo "
     "; } if ($t11==4) { echo "    "; } if ($t4>4 ) { echo "
  5. "; if ($t22==5) { echo " "; } echo " $tA5"; if (strlen($tG5)>0) { if (strlen($tA5)>0) { echo "
    "; } echo ""; } } if ($t22==5) { echo "
     "; } if ($t11==5) { echo "    "; } echo "
"; echo "(value=$tDIFF1 points)"; if (strlen($tRA)>0) { $enc_id=md5($tID1.$secret); echo "
Correct Answer"; } elseif (strlen($tKW)>0) { $enc_id=md5($tID1.$secret); echo "
Additional Learning Links

"; $c1++; } //calculate points //determine multiplier $tM = 500 / $totPTS; //create offset for correct answers $tR1 = $tR * $tM; //no offset for unanswered or incorrect $t3 = ($tR1 - $tW); if ($t3<20) { $t3=20; } //no lower score than 20 $tSCORE0 = $t3; if ($tTOTGAMES<0) { $tTOTGAMES=0; } $tSCORE = number_format($tSCORE0, 4); $tC=""; if ($tSCORE>450) { $tC="WORLD CLASS!"; } elseif ($tSCORE>420) { $tC="INCREDIBLE!!"; } elseif ($tSCORE>375) { $tC="SUPER!!"; } elseif ($tSCORE>250) { $tC="Great Job!"; } elseif ($tSCORE>150) { $tC="Keep it up!"; } elseif ($tSCORE<50) { $tC=" Not so good..."; } //begin color echo " "; $t1 = number_format($tBBs); echo "
$DF RESULTS
"; //get stats $c1=""; if ($tGAME==0) { $result = m_q("SELECT * FROM players WHERE id = '$PHP_AUTH_USER' "); $tTOTGAMES = mysql_result($result, 0, "totalgames"); $tTOTGAMES++; $tTOTSTAND = mysql_result($result, 0, "totstanding"); $tTOTSTAND1 = $tTOTSTAND + $tSCORE0; $tBBs = mysql_result($result, 0, "bbucks"); $tBBs = $tBBs + $tBB; $tSTs = mysql_result($result, 0, "standing"); $tSCORE1 = $tTOTSTAND1 / ($tTOTGAMES); //update historical info $t99 = (time() - $tSTARTdGAME); $result9 = mysql_query("UPDATE SE_history SET score = $tSCORE0, games = $tTOTGAMES, bbucks = $tBB, etime = $t99, crntscore = $tTOTSTAND1 WHERE id='$PHP_AUTH_USER' AND cdate='$D2' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } $t1 = time() + (3600 * 24 * 61); //was 61 -- 31 before that $tNRG = date("Y-m-d", $t1); //post $result = mysql_query("UPDATE players SET totalgames=$tTOTGAMES, bbucks=$tBBs, totstanding=$tTOTSTAND1, startgame=0, nextrqdgame='$tNRG', standing=$tSCORE1 WHERE id = '$PHP_AUTH_USER' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } if ($tTYPE=="M") { //update school, grade & state include('smartpt1.inc'); } } elseif ($tGAME==2 && $tPgames < $ALLOWEDPGAMES) { $result = m_q("SELECT bbucks,pgames,totalpgames FROM players WHERE id = '$PHP_AUTH_USER' "); $tBBs = mysql_result($result, 0, "bbucks"); $tTPG = mysql_result($result, 0, "totalpgames"); $tPgames = mysql_result($result, 0, "pgames"); $t1 = 1.0 / $ALLOWEDPGAMES; $tBBb = ($tBB*$t1); $tBBs = $tBBs + $tBBb; $tPgm=$tPgames+1; $tTPG=$tTPG+1; $result = m_q("UPDATE players SET totalpgames=$tTPG, pgames=$tPgm, bbucks=$tBBs WHERE id = '$PHP_AUTH_USER' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } } //updated stats $t1 = number_format($tR1,4); $t2 = number_format($tW); echo "
$DF Total Correct $tCO    ($t1 pts gained)
Total Missed $tWR    ($t2 pts lost)
Total Unanswered $tUN    (no effect)
"; if ($tGAME==0) { echo " "; $t1 = number_format($tSCORE1,1); echo " "; $t1 = number_format($tBB); //The following two lines replace the next two BB entries echo"
Your Score
$DF0 Your score for this competition.
$tSCORE    $tC
Your Point Standing
$DF0 This is your average score based on your competitions this year.
$t1    $tC
 
 
"; /* echo "
You won BB$ $t1 this Game
Your current BetaBuck$ account BB$ $t1
"; */ } else { echo " "; $t1 = number_format($tBBb); echo ""; $t1 = number_format($tBBs); echo "
$DF PRACTICE COMPETITION:
Your Score would have been: $tSCORE
$tC "; if ($tGAME==2 && $tPgames < $ALLOWEDPGAMES) { $tPg1 = $ALLOWEDPGAMES - $tPgm; if ($tPg1 < 2) { $t1="Practice Game remaining this month"; } else { $t1="Practice Games remaining this month"; } echo "
You have $tPg1 $t1
  
   "; /* echo "
You won $t1 BB$ this Practice Game
(25% of the amount you would have won in a real Competition
your current BetaBuck$ account BB$ $t1 "; */ } echo "
"; //delete questions from practice session $result9 = mysql_query("DELETE FROM SE_history WHERE id='$PHP_AUTH_USER' AND cdate='$D2' AND (typegame<>'0' OR typegame IS NULL OR typegame='') "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } } //give next possible competion & next required competition if ($tTOTPGAMES<1) { $tTOTPGAMES=0; } $t1 = time() + (3600 * 24 * 33); //was 31 instead of 33 $tNG = date("Y-m-d", $t1); $t1 = time() + (3600 * 24 * 31); //was 14 instead of 31 $tPG = date("Y-m-d", $t1); $temp_result = m_q("SELECT bbucks,pgames,totalpgames FROM players WHERE id = '$PHP_AUTH_USER' "); $temp_pgames = mysql_result($temp_result, 0, "pgames"); echo "
$DF
  • To remain in active competition, you must compete again before
    $tNG
  • You've played ".($tTOTGAMES<=0?0:$tTOTGAMES)." Competitions (out of a possible $tTHISYEAR) so far this competition period.
  • You've played $temp_pgames Practice Games so far this month.
"; if ($tGAME==0) { echo "
Rate this test:   easy    so-so    hard    perfect
$DF0 Problems with this test? contact us.
"; } // echo "

BACK to:     SmartEnough     BetaWeb.org     BetaClub.org    
"; echo "


$DF0copyright © SmartEnough are trademark (tm) National Beta Club. Test engine is Patent-Pending and some questions are licensed for use.
"; echo "
"; //color echo "
"; $result = mysql_query("DELETE FROM tempq WHERE user='$PHP_AUTH_USER' "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } exit; } //****** START HERE *** //make certain there are no artifacts $result = m_q("DELETE FROM tempq WHERE user = '$PHP_AUTH_USER' "); $t1 = number_format($tBB); $gCOMP=""; //default to tGAME //# questions $result = m_q("SELECT count(*) AS a1 FROM quest "); $t1 = mysql_result($result, "a1"); $cQUEST=number_format($t1+2000,0); //who's playing $result = m_q("SELECT * FROM players WHERE id = '$PHP_AUTH_USER' "); $num = mysql_num_rows($result); //$tGRADE="18"; $tfn = "National Staff"; $tOK = TRUE; $tPgames=0; if (!mysql_num_rows($result)) { //new player $tfn = $tNAME; $t1 = time() + 2678400; //31 days hence $tREQ = date("Y/m/d", $t1 ); $tNAME = eregi_replace("'", "\'", $tNAME); //remove L'Kindra //2001-12-27 - lml Added code to get correct player info switch($tTYPE) { case "M": $result_memb=m_q("SELECT new_id, grade FROM members WHERE membid = '$PHP_AUTH_USER' UNION SELECT new_id, grade FROM members WHERE membid = '$PHP_AUTH_USER'"); $tSTATE = substr(mysql_result($result_memb,0,"new_id"),1,2); $tGRADE = mysql_result($result_memb,0,"grade"); break; case "S": $result_sp=m_q("SELECT new_id, sp_fname FROM sponsors WHERE spid = '$PHP_AUTH_USER'"); $tSTATE = substr(mysql_result($result_sp,0,"new_id"),1,2); $tNAME = mysql_result($result_sp,0,"sp_fname"); $tGRADE = 18; break; case "G": case "O": case "A": $tNAME = $PHP_AUTH_USER; $tSTATE = "HQ"; $tGRADE = 18; break; } $result = mysql_query("INSERT INTO players (id, name, nextrqdgame, grade, st, school, startgame, pos, pgames) VALUES ('$PHP_AUTH_USER', '$tNAME', '$tREQ', '$tGRADE', '$tSTATE', '$tSCHOOL', $gGAMESTART, 0, 0 ) "); if(mysql_errno()) {echo mysql_errno().": ".mysql_error()."\n"; exit; } $tNS=$tBB=0.0; } else { //check for correct grade for members if ($tTYPE=='M') { $result_memb=m_q("SELECT new_id, grade FROM members WHERE membid = '$PHP_AUTH_USER' UNION SELECT new_id, grade FROM fmembers WHERE membid = '$PHP_AUTH_USER'"); //echo "SELECT new_id, grade FROM members WHERE membid = '$PHP_AUTH_USER' UNION SELECT new_id, grade FROM fmembers WHERE membid = '$PHP_AUTH_USER'"; $mSTATE = substr(mysql_result($result_memb,0,"new_id"),1,2); $mGRADE = mysql_result($result_memb,0,"grade"); } $tSTATE = mysql_result($result, 0, "st"); $tNS = mysql_result($result, 0, "nation"); $tBB = mysql_result($result, 0, "bbucks"); $tfn = mysql_result($result, 0, "name"); $tGRADE = mysql_result($result, 0, "grade"); //fix grade if it has increased if ($tTYPE=='M' && $tGRADE < $mGRADE) { $tGRADE = $mGRADE; m_q("UPDATE players set grade = '$tGRADE' WHERE id='$PHP_AUTH_USER'"); } $tEMAIL = mysql_result($result, 0, "email"); $tSTANDING = mysql_result($result, 0, "standing"); $tREQ = mysql_result($result, 0, "nextrqdgame"); if ($tNS<0.01) { $tNS=0; } if ($tBB<1) { $tBB=0.0; } $tSCHOOL = mysql_result($result, 0, "school"); $tEX = substr($tSCHOOL,0,1); $tPgames = mysql_result($result, 0, "pgames"); } if (strlen($tGRADE)<1) { $tGRADE='18'; } //standing if ($tSTANDING>400) { $tS="You're in the $99th+ Percentile !"; } elseif ($tSTANDING>350) { $tS="You're in the 95th+ Percentile !"; } elseif ($tSTANDING>300) { $tS="You're in the 92nd+ Percentile !"; } elseif ($tSTANDING>250) { $tS="You're in the 85th+ Percentile !"; } elseif ($tSTANDING>185) { $tS="You're in the 80th+ Percentile !"; } elseif ($tSTANDING>1) { $tS="Try the Practice Competitions"; } else { $tS="Come on ... PLAY!"; } echo " SmartEnough * Beta Club's National Academic Competition
"; //*** column 1 echo "
$DF SmartEnough is (c) Central Data Corp & (tm) National Beta Club, 2000"; echo "
Personal Standings
$DF0 national   state   school
$DF0 grade   just me

"; //Place status stars here soon -jneal /* Club Standings
$DF0national   $DF0state
State Standings
"; Spend Em
$DF0what are BetaBucks?"; echo "

2000-01 Winners"; */ //*** column 2 echo "
"; //*** column 3 echo " $DF
SmartEnough logo (tm) SmartEnough(tm)
National Academic Competition
2006-2007 School Year
"; //note- useful for getting missing info if (strlen($tEMAIL)<1 ) { echo "
$DF ** We're missing some important information on you!
Please Click here NOW...
"; } $tfn = " ".$tfn; echo " Hi$tfn.   Feel smart ?
Beta Club on-line Academic Competition for fun and standings."; // and prizes."; //standing & BBs $t1=number_format($tBB); /* echo "
  $tS     earned $t1 BetaBuck$.  
"; */ if ($D2 > $tREQ) { echo "
$DF ** You must compete today to remain in the competition
"; } if ($tGRADE<=6) { $tCL="5th-6th"; } elseif ($tGRADE>8) { $tCL="Senior"; } else { $tCL="Junior"; } //echo "NEW * Earn BetaBucks by playing up to 4 Practice Games a month! echo "
$DF Choose your Game:
   $tCL Competition - Game #$tWEEK  (For Standings)"; // and BetaBucks)"; if ($tPgames <= $ALLOWEDPGAMES) { echo "
   $tCL Practice Game   (NOT for Standings)"; } else { echo "
   Full $tCL Practice Game   (NOT for Standings)"; } echo "
"; //rules removed until they can be reviewed/reworded for CDC echo "
$DF0  "; // the rules echo "
"; //practice games echo "
$DF Special Area Practice Games:$DF0
These work just like any other Practice Game, except the questions come only from the area you select.   (currently $cQUEST questions in the question test bank)
$DF0"; echo "    None
    just Math
    just Biology
    just Chemistry
    just Physics
    just Earth Science "; echo "
$DF0"; echo "    just History
    just English
    just Art/Music
    just Trivia
    just S.A.T.
    just A.C.T. "; echo "
$DF0"; echo "    just P.S.A.T.
    just G.E.D.
    just History
    just Literature
    just Social Studies
    just Economics "; echo "
"; echo "
"; echo "Copyright © National Beta Club.
Testing engine is Patent-Pending.
"; //admin only if ($PHP_AUTH_USER=="jmoore" ||$PHP_AUTH_USER=="jjb" ) { echo "

$DF Administrative Functions
"; } echo "
"; ?>