View file indiFun/indifun/games.php

File size: 26.39Kb
<?php
include("config.php");
include("core.php");
echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML Mobile 1.0//EN\"". " \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";

$PHP_SELF="games.php";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $sitename; ?></title>
<meta forua="true" http-equiv="Cache-Control" content="no-cache"/>
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
<?php
connectdb();
$sid = $_GET["sid"];
echo gettheme($sid);
?>
</head>
<body>

<?php
echo "<font size=\"".getfontsize($sid)."\">";

gettimebar();
echo getshouts($sid);

boxstart("Games");
echo "";
$action = $_GET["action"];

$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</div></div></font></body></html>";


exit();
}

if(isbanned($uid))
{

echo "<p align=\"center\">";
echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
echo "<b>You are Banned</b><br/><br/>";
$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<br/>";
$nick = getnick_uid($banto[2]);
echo "<b>By: </b>$nick<br/>";
echo "<b>Reason: </b>$banto[1]";
//echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</div></div></font></body></html>";

exit();
}
/////////////////////////////MAIN////////////////////////
if($action=="main")
{
addonline(getuid_sid($sid),"Games Menu","index.php?action=$action");
echo "<p align=\"center\"><b><big>Games Menu</big></b></p>";
$umsg = getunreadpm(getuid_sid($sid));
echo "<p align=\"center\">".getalert($sid)."</p>";
if($umsg>0){
echo "<p align=\"center\"><a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg new msg)</a></p>";
}


echo "<p>Choose any game from the list of available games below!<br/>Games help you to Earn Points! But beware you may Lose them too... ;)</p>";
echo "&#187;<a href=\"games.php?action=guessgm&amp;sid=$sid\">Guess The Number</a><br/>";
echo "&#187;<a href=\"games.php?action=scramble&amp;sid=$sid\">Word Scramble</a><br/>";
echo "&#187;<a href=\"games.php?action=hangman&amp;sid=$sid\">Hangman</a><br/>";
echo "&#187;<a href=\"ttt.php?sid=$sid\">Tic Tac Toe(With Computer)</a><br/>";
echo "&#187;<a href=\"tictactoe.php?sid=$sid&amp;action=new\">Tic Tac Toe(With Human)</a>[<a href=\"tictactoe.php?sid=$sid&amp;action=tutorial\"><small>Tutorial</small></a>]<br/>";
echo "&#187;<a href=\"tictactoe.php?sid=$sid&amp;action=running\">Watch a running TTT game</a><br/>";
echo "&#187;<a href=\"games.php?action=casinoi&amp;sid=$sid\">Casino</a><br/>";
echo "&#187;<a href=\"games.php?action=lottoi&amp;sid=$sid\">Lotto</a><br/>";
echo "&#187;<a href=\"games.php?action=fci&amp;sid=$sid\">Fortune Cookie</a><br/>";
echo "&#187;<a href=\"games.php?action=8ball&amp;sid=$sid\">Speaking Ball</a>";
}

else if($action == "8ball")
{
     addonline(getuid_sid($sid), "Talking to magic ball", "");
    
    
     echo "<p align=\"center\"><b><big>The Magic Ball</big></b></p>";
     echo "<p align=\"center\">";
     $gid = $_POST["gid"];
     $un = $_POST["un"];
    
     if($gid == "")
    {
        
        echo "<img src=\"images/8ball.jpg\" alt=\"8Ball\"/><br/>";
        echo "<b><u>Magic Ball</u></b><br/>You can ask a question to magic ball and you'll get a reply, so start asking!<br/>";
        echo "<b><i>Question:</i></b><br/>
        <input type=\"hidden\" name=\"text\" value=\"\"/>";
        echo "<br/>
        <form action=\"games.php?action=8ball&amp;sid=$sid\" method=\"post\">";
        echo "<input name=\"text\" id=\"inputText\"/>";
        echo "<br/>";
        echo "<input id=\"inputButton\" type=\"submit\" value=\"Ask\"/>";
        echo "</form>";
        }
        
         $xfile = @file("text.txt");
        $random_num = rand (0, count($xfile)-1);
        $udata = explode("::", $xfile[$random_num]);
       
        echo "<b><u>The ball says</u></b><br/>";
        echo "<b><i>$udata[1]</i></b><br/>";
        
        echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
        echo "</p>";
    
    }
    
    ///////////////////////////////////////////casino
  else  if($action=="casinoi")
{   
    addonline(getuid_sid($sid),"Playing Casino","");
    $view = $_GET["view"];
    if($view=="")$view="date";
    
      echo "<p align=\"center\"><big><b>Playing Casino</b></big></p>";
    echo "<p align=\"center\">";
    echo "<img src=\"images/casino.gif\" alt=\"*\"/><br/>";
    echo "Play our slots game to win some great prizes! Very fun game!";
    echo "</p>";
    //////ALL LISTS SCRIPT <<

        echo "<p align=\"center\">";
    echo "<a href=\"games.php?action=casino&amp;sid=$sid\">&#187;Start spinning Slots</a><br/>";
    echo "</p>";
      ////// UNTILL HERE >>
    echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";
  
}
/////////////////////////////////////////////////END OF CASINO/////////////////////////////////////////
else if($action=="casino")
{
    addonline(getuid_sid($sid),"Playing Casino","");
    $view = $_GET["view"];
    if($view=="")$view="date";
  
      echo "<p align=\"center\"><big><b>Playing Casino</b></big></p>";
 
    echo "<p align=\"center\">";
        
    //////ALL LISTS SCRIPT <<
 
$num1 = rand(1, 9);
$num2 = rand(1, 9);
$num3 = rand(1, 9);
echo "<img src=\"images/casino.gif\" alt=\"*\"/><br/>";
echo "<b>To win you need one among 777, 111, 3*3, *55, where * stands for any digit.</b><br/>";
echo "<b><u>These Are Your Cards:</u></b><br/>";
echo "<b>[$num1][$num2][$num3]</b><br/>";
$messege = "<b>Sorry, you lose!</b>";
if ($num1 == 7 and $num2 == 7 and $num3 == 7) {
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $gpl = rand(10, 30);
  $ugpl = $gpl + $ugpl[0];
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
  $messege = "*You Have Just Won $gpl points";
}
if ($num1 == 1 and $num2 == 1 and $num3 == 1) {
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $gpl = rand(10, 30);
  $ugpl = $gpl + $ugpl[0];
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
  $messege = "*You Have Just Won $gpl Credits";
}
if ($num1 == 3 and $num3 == 3) {
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $gpl = rand(1, 10);
  $ugpl = $gpl + $ugpl[0];
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
  $messege = "*You Have Just Won $gpl Credits";
}
if ($num2 == 5 and $num1 == 5) {
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $gpl = rand(1, 10);
  $ugpl = $gpl + $ugpl[0];
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
  $messege = "*You Have Just Won $gpl Credits";
}
if ($num1 == 6 and $num3 == 5) {
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $gpl = rand(1, 5);
  $ugpl = $ugpl[0] - $gpl;
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
  $messege = "*You Have Just Lost $gpl Credits";
}
if ($num2 == 9 and $num1 == 5) {
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $gpl = rand(1, 5);
  $ugpl = $ugpl[0] - $gpl;
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
  $messege = "*You Have Just Lost $gpl Credits";
}

echo $messege;

echo "<br/><b><a href=\"games.php?action=casino&amp;sid=$sid\">Spin The Wheel!</a></b></p>";
    echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";
  
}
////////////////////////////////////
else if($action=="lottoi")
{
    addonline(getuid_sid($sid),"Playing lotto","");
 
       echo "<p align=\"center\"><big><b>Lotto</b></big></p>";

    echo "<p align=\"center\">";
    echo "<b>IndiFun Lotto Draw</b><br/>Wanna become a millionaire? Really? Really,really? Then this game should keep you busy and entertained for HOURS! Win the lotto and be known as a millionaire here!<br/>";
   
    echo "</p>";
    //////ALL LISTS SCRIPT <<
 echo "<p align=\"center\">";

 echo "<br/><a href=\"games.php?action=lotto&amp;sid=$sid\">";
 echo "QuickPick</a><br/>";
 echo "Quickpick Price: 2 Credits<br/><br/>";
  echo "<a href=\"games.php?action=lottop&amp;sid=$sid\">";
 echo "Millionaires rewards</a><br/>";
   echo "</p>";

   
  ////// UNTILL HERE >>
     echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";

  
}

//////////////////////////////////LOTTO///////////

else if($action=="lotto")
{
    addonline(getuid_sid($sid),"Playing lotto","");
    
       echo "<p align=\"center\"><big><b>Playing Lotto</b></big></p>";
    
    
    echo "<p align=\"center\">";
  
    echo "<b>IndiFun Lotto Draw</b><br/>Heres the lucky draw =D<br/>";
   
    echo "</p>";
    //////ALL LISTS SCRIPT <<
echo "<p align=\"center\">";
 if(getplusses(getuid_sid($sid))<10)
    {
        echo "You should have at least 10 points to play this game!";
    }else{
echo "<u>These are the winning lotto numbers</u><br/>";
 echo "<b>(2)(9)(18)(30)(38)(42)</b><br/>";
   echo "<u>These are your numbers</u><br/>";
$xfile = @file("lotto.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);
echo $udata[1];
}
  $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
  $ugpl = $ugpl[0] - 2;
  mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'");
echo "<br/><a href=\"games.php?action=lotto&amp;sid=$sid\">";
echo "another quickpick</a><br/>";
   echo "</p>";

  ////// UNTILL HERE >>
      echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";

  
  
}

//////////////////////////////////LOTTO////////////

else if($action=="lottow")
{
    addonline(getuid_sid($sid),"Playing lotto","");
  
      echo "<p align=\"center\"><big><b>Playing Lotto</b></big></p>";
     
  
    echo "<p align=\"center\">";
    echo "<b>Lotto Draw</b><br/>This is the secret code that you must inbox IndiFun in order to become a IndiFun millionaire!<br/>";
   
    echo "</p>";
    //////ALL LISTS SCRIPT <<
echo "<p align=\"center\">";
 if(getplusses(getuid_sid($sid))<10)
    {
        echo "You should have at least 10 credits to play this game!";
    }else{
  $xfile = @file("lottowin.txt");
  echo $udata[1];
   }
   
  ////// UNTILL HERE >>
      echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";
  
  
}

//////////////////////////////////LOTTO////////////

else if($action=="lottop")
{
    addonline(getuid_sid($sid),"Playing lotto","");
  
       echo "<p align=\"center\"><big><b>Lotto Prizes</b></big></p>";
     
    echo "<p align=\"center\">";
      echo "<b>Lotto Draw</b> Millionaires get:<br/>";
   
    echo "</p>";
    //////ALL LISTS SCRIPT <<


   echo "*1000 points<br/>";
   echo "*their profile status changes to IndiFun millionaire<br/>";
    echo "*your name will be up in site stats as one of the lotto winners<br/>";
    echo "*you will also be added to our V.I.P list<br/>";
    

   
  ////// UNTILL HERE >>
      echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";
 
 
}
else
//////////////////////////////////
/////////////////////////////////////////////////FC/////////////////////////////////////////
if($action=="fci")
{
    addonline(getuid_sid($sid),"Playing Fortune Cookie","");
    $view = $_GET["view"];
    if($view=="")$view="date";
   
       echo "<p align=\"center\"><big><b>Playing Fortune Cookie</b></big></p>";
   
   
    echo "<p align=\"center\">";
    echo "<img src=\"images/roll.gif\" alt=\"*\"/><br/>";
    echo "Hmmm... So  you have come to let the cookie tell you your fortune?! Well good luck young (or old,lol) IndiFun wapper!!!!";
    echo "</p>";
    //////ALL LISTS SCRIPT <<

        echo "<p align=\"center\">";
    echo "<a href=\"games.php?action=fc&amp;sid=$sid\">&#187;Read Fortune Cookie</a><br/>";
    echo "</p>";
      ////// UNTILL HERE >>
      echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";

}
else
/////////////////////////////////////////////////FC/////////////////////////////////////////
if($action=="fc")
{
    addonline(getuid_sid($sid),"Playing Fortune Cookie","");
    $view = $_GET["view"];
    if($view=="")$view="date";
  
      echo "<p align=\"center\"><big><b>Playing Fortune Cookie</b></big></p>";
     
  
    echo "<p align=\"center\">";
    echo "<b>The fortune cookie tells you:</b>";
    echo "</p>";
 //////ALL LISTS SCRIPT <<
echo "<p align=\"center\">";
$xfile = @file("fortune.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);
echo $udata[1];
 echo "<br/><a href=\"games.php?action=fc&amp;sid=$sid\">Another Cookie</a>";
   echo "</p>";

   
  ////// UNTILL HERE >>
     echo "<p align=\"center\">";
       echo "<br/><br/><a href=\"games.php?action=main&amp;sid=$sid\">&#171;Back to Games</a><br/>";
       echo "</p>";

  
}



////////////////GUESS THE NUMBER/////////////////////////
else if($action=="guessgm")
{
addonline(getuid_sid($sid),"Playing Guess The Number","");
echo "<p align=\"center\">";
$gid = $_POST["gid"];
$un = $_POST["un"];

if($gid=="")
{
mysql_query("DELETE FROM ibwf_games WHERE uid='".$uid."'");
mt_srand((double)microtime()*1000000);
$rn = mt_rand(1,100);
mysql_query("INSERT INTO ibwf_games SET uid='".$uid."', gvar1='8', gvar2='".$rn."'");
$tries = 8;
$gameid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_games WHERE uid='".$uid."'"));
$gid=$gameid[0];
}else{
$ginfo = mysql_fetch_array(mysql_query("SELECT gvar1,gvar2 FROM ibwf_games WHERE id='".$gid."' AND uid='".$uid."'"));
$tries = $ginfo[0]-1;
mysql_query("UPDATE ibwf_games SET gvar1='".$tries."' WHERE id='".$gid."'");
$rn = $ginfo[1];
}
if ($tries>0)
{
$gmsg = "Just try to guess the number before you have no more tries, the number is between 1-100<br/><br/>";
echo $gmsg;
$tries = $tries-1;
$gpl = $tries*3;
echo "Tries Remaining:$tries<br/>Points To Be Won:$gpl<br/><br/>";
if ($un==$rn){
$gpl = $gpl+3;
$ugpl = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"));
$ugpl = $gpl + $ugpl[0];
mysql_query("UPDATE ibwf_users SET gplus='".$ugpl."' WHERE id='".$uid."'");
echo "Congrats! the number was $rn, $gpl Game Points has been added to your Account!<br/><br/><a href=\"games.php?action=guessgm&amp;sid=$sid\">New Game</a><br/><br/>";
}else{
if($un <$rn)
{
echo "Try bigger number than $un !<br/><br/>";
}else{
echo "Try smaller number than $un !<br/><br/>";
}
echo "<center><form action=\"games.php?action=guessgm&amp;sid=$sid\" method=\"post\">";
echo "Your Guess: <input id=\"inputText\" type=\"text\" name=\"un\" style=\"-wap-input-format: '*N'\" size=\"3\" value=\"$un\"/>";
echo "<input type=\"hidden\" name=\"gid\" value=\"$gid\"/>";
echo "<input id=\"inputButton\" type=\"Submit\" name=\"try\" value=\"TRY\"/></form></center><br/>";
}


}else{
$gmsg = "GAME OVER<br/><br/>The Number Was <b>$rn</b><br/><br/><a href=\"games.php?action=guessgm&amp;sid=$sid\">New Game</a><br/><br/>";
echo $gmsg;
}
echo "</p>";

}
/////////////////////////////////SCRAMBLE///////////////////

else if($action == "scramble")
{
addonline(getuid_sid($sid),"Playing Word Scramble","");
$answer = $_POST["answer"];

$correct=$_POST["correct"];
if (empty($_POST["answer"])) {

srand((float) microtime() * 10000000);
$input = array(
"dictionary",
"recognize",
"example",
"entertainment",
"experiment",
"appreciation",
"information",
"pronunciation",
"language",
"government",
"psychic",
"blueberry",
"selection",
"wrestling",
"firefox",
"automatic",
"strawberry",
"bakery",
"shopping",
"eggplant",
"chicken",
"organic ",
"angel",
"season",
"market",
"information",
"complete",
"sunset",
"unique",
"customer"
);
$rand_keys = array_rand($input, 2);
$word = $input[$rand_keys[0]];
$Sword = str_shuffle($word);
echo "<p align=\"center\">$Sword</p>
<p align=\"center\">In the
text box below type the correct word that is scrambled above...<br/>
<center><form method=\"POST\" action=\"games.php?action=scramble&amp;sid=$sid\">
<input id=\"inputText\" type=\"text\" name=\"answer\" size=\"20\" />
<input type=\"hidden\" name=\"correct\" value=\"$word\" />
<br/><input id=\"inputButton\" type=\"submit\" value=\"GO!\" name=\"B1\" />
</form></center></p>";

}
else {
$answer = strtolower($answer);
if($answer == $correct){
$result = "Correct! <b>$answer</b>";
$answer="";
$uid = getuid_sid($sid);
$ugpl = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"));
$ugpl = "25" + $ugpl[0];
mysql_query("UPDATE ibwf_users SET gplus='".$ugpl."' WHERE id='".$uid."'");

echo "<p align=\"center\">$result<br/>You Have Won 25 Points!!</p>";
echo "<p align=\"center\"><a href=\"games.php?action=scramble&amp;sid=$sid\">Try Another Word?</a></p><br/>";

}


else { $result = "Sorry! The Correct Answer Was <b>$correct</b>.";
$uid = getuid_sid($sid);
$ugpl = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"));
$ugpl = $ugpl[0] - "10";
mysql_query("UPDATE ibwf_users SET gplus='".$ugpl."' WHERE id='".$uid."'");

echo "<p align=\"center\">$result<br/>You Have Lost 10 Points!!</p>";
echo "<p align=\"center\"><a href=\"games.php?action=scramble&amp;sid=$sid\">Try Another Word?</a></p><br/>";

}
}
}
////////////////////////////////////////HANGMAN////////////////////

else if($action == "hangman")
{
addonline(getuid_sid($sid),"Playing Hangman","");

$cat=$_GET["cat"];
if ($cat==""){
	      echo "<p align=\"center\"><big><b>Playing Hangman</b></big></p>";

echo "<p align=\"center\">
Select a category:<br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=anmls&amp;sid=$sid\">Animals</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=clrs&amp;sid=$sid\">Colours</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=comp&amp;sid=$sid\">Computers</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=frt&amp;sid=$sid\">Fruit</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=big&amp;sid=$sid\">Big Words</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=lotr&amp;sid=$sid\">Lord Of The Rings</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=mths&amp;sid=$sid\">Months</a><br/>";
echo "<a href=\"$PHP_SELF?action=hangman&amp;cat=web&amp;sid=$sid\">Web / Wap coding</a><br/>";

echo "</p></div></div></font></body></html>";

exit();
}
if ($cat=="anmls"){
$category="ANIMALS";
$list = "ANIMALS
BABOON
BEAR
BULL
CAMEL
CAT
COW
CROW
DOG
DONKEY
DUCKBILL PLATYPUS
EAGLE
ELEPHANT
FISH
FOX
GIRAFFE
GOAT
GOLDFISH
HAWK
HEDGEHOG
HORSE
KANGAROO
KITTEN
MOLE
MONKEY
MOUSE
MULE
OWL
PARROT
PIG
PINK ELEPHANT
POLAR BEAR
PORCUPINE
POSSUM
PUPPY
RABBIT
RACCOON
RAT
ROBIN
SEAL
SHARK
SKUNK
SQUIRREL
STOAT
WALRUS
WEASEL
WHALE
ZEBRA";}



if ($cat=="clrs"){
$category="COLOURS";
$list = "BLACK
BLUE
BROWN
BUBBLEGUM PINK
COLORS
CYAN
FUCHSIA
GOLD
GREEN
GREY
INDIGO
LAVENDER
LIME GREEN
MAROON
OLIVE
ORANGE
PERIWINKLE
PINK
PURPLE
RED
ROYAL BLUE
SCARLET
TEAL
TURQUOISE
VIOLET
WHITE
YELLOW"; }


if ($cat=="comp"){
$category="COMPUTERS";
$list = "ACCESS
ANTI-VIRUS SOFTWARE
BASIC
CD-ROM DRIVE
CHAT
COMPUTER
CPU
DATABASE
DOS
EMAIL
EXCEL
FIREWALL
FLOPPY DRIVE
FORUMS
FRONTPAGE
GAMES
HACKER
HARD DRIVE
HTML
ICQ
INTERNET
JUNK MAIL
KEYBOARD
LINUX
LOTUS
MICROSOFT
MONITOR
MOTHER BOARD
MOUSEPAD
OPERATING SYSTEM
PARALLEL PORT
PHP
PRINTER
PUBLISHING
RAM
SERIAL PORT
SOLITARE
SPEAKERS
TECHNOLOGY
UNIX
URL
VIRUS
VISUAL BASIC
WINDOWS
WORD
WORD PROCESSING
WORLD WIDE WEB
ZIP"; }


if ($cat=="frt"){
$category="FRUIT";
$list = "APPLE
BANANA
BLACKBERRY
BLUEBERRY
FRUIT
GRAPE
GUAVA
GRAPEFRUIT
KIWI
MANGO
ORANGE
PEACH
PEAR
RASBERRY
STRAWBERRY
TANGERINE
TOMATO
UGLY FRUIT"; }



if ($cat=="big"){
$category="BIG WORDS";
$list = "AUSTRALOPITHECINE
DEOXYRIBONUCLEIC ACID
LARGE WORDS
MITOCHONDRIA"; }

if ($cat=="lotr"){
$category="LORD OF THE RINGS";
$list = "AGORNATH
ARAGORN
ARWEN
BAG END
BALIN
BALROG
BARROW DOWNS
BARROW WRIGHT
BEREN
BILBO BAGGINS
BLACK RIDERS
BOROMIR
BREE
BUCKLAND
CELEBORN
DEAD MARSHES
DWARVES
EDORAS
ELENDIL
ELFSTONE
ELROND
ELVES
ENTS
EOWYN
FANGORN FOREST
FARAMIR
FRODO BAGGINS
GALADRIEL
GANDALF
GILGALAD
GLAMDRING
GLORFINDEL
GOLDBERRY
GOLLUM
GONDOR
HALDIR
HELMS DEEP
HOBBITON
HOBBITS
ISENGARD
ISILDUR
LEGOLAS
LEMBAS BREAD
LONELY MOUNTAIN
LONELY MOUNTIAN
LORD OF THE RINGS
LOTHLORIEN
LUTHIEN
MELKOR
MEN
MERRY
MIDDLE EARTH
MINAS MORGUL
MINAS TIRITH
MIRKWOOD
MITHRANDIR
MITHRIL
MORDOR
MORIA
MT. DOOM
MY PRECIOUSSS
NAZGUL
NUMENOR
OLD FOREST
OLD MAN WILLOW
ORCS
ORTHANC
PIPE WEED
PIPPIN
PLAINTIR
RANGERS
RINGWRAITHS
RIVENDELL
ROHAN
SAMWISE GAMGEE
SARUMAN
SAURON
SHADOWFAX
SHAGRAT
SHELOB
SHIRE
SILMARILLIAN
SMAUG
SMEAGOL
STEWARD OF GONDOR
STING
STRIDER
THE FELLOWSHIP OF THE RING
THE RETURN OF THE KING
THE RING
THE TWO TOWERS
THEODIN
TOM BOMBADIL
TREEBEARD
TROLLS
UNDYING LANDS
URUK-HAI
VALINOR
WARG RIDERS
WEATHERTOP
WIZARDS
WORMTONGUE";}


if ($cat=="mths"){
$category="MONTHS";
$list = "APRIL
AUGUST
DECEMBER
FEBRUARY
JANUARY
JULY
JUNE
MARCH
MAY
MONTHS
NOVEMBER
OCTOBER
SEPTEMBER"; }

if ($cat=="web"){
$category="WEB / WAP CODING";
$list = "JAVA BEANS
PHP SCRIPTS
SOURCE CODE
JAVASCRIPT GAMES
SSI IS SERVER SIDE INCLUDES
BILL GATES
COOKIES
HTTP AUTHENTICATION
ERROR HANDLING
MANIPULATING IMAGES
FILE UPLOADS
DATABASE / CONNECTION
APACHE SERVER
ZIP FILE
TAR COMPRESSION
FUNCTIONS
ENCRYPTION
MYSQL DATABASE
INITIALIZATION
FAQ - FREQUENTLY ASKED QUESTIONS
DEBUGGING
VERIFICATION
HTML VALIDATION
CASCADING STYLE SHEETS";}

# below ($alpha) is the alphabet letters to guess from.
# you can add international (non-English) letters, in any order, such as in:
# $alpha = "????????????????????????????ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

# below ($additional_letters) are extra characters given in words; '?' does not work
# these characters are automatically filled in if in the word/phrase to guess
$additional_letters = " -.,;!?%& 0123456789/";

#========= do not edit below here ======================================================
$uid = getuid_sid($sid);
$len_alpha = strlen($alpha);

if(isset($_GET["n"])) $n=$_GET["n"];
if(isset($_GET["letters"])) $letters=$_GET["letters"];
if(!isset($letters)) $letters="";

if(isset($PHP_SELF)) $self=$PHP_SELF;
else $self="games.php";

$links="";
$max=6;
# error_reporting(0);
$list = strtoupper($list);
$words = explode("\n",$list);
srand ((double)microtime()*1000000);
$all_letters=$letters.$additional_letters;
$wrong = 0;
	      echo "<p align=\"center\"><big><b>Playing Hangman</b></big></p>";

echo "<p align=\"center\">";
if (!isset($n)) { $n = rand(1,count($words)) - 1; }
$word_line="";
$word = trim($words[$n]);
$done = 1;
for ($x=0; $x < strlen($word); $x++)
{
if (strstr($all_letters, $word[$x]))
{
if ($word[$x]==" ") $word_line.=" / "; else $word_line.=$word[$x];
}
else { $word_line.="_ "; $done = 0; }
}

if (!$done)
{

for ($c=0; $c<$len_alpha; $c++)
{
if (strstr($letters, $alpha[$c]))
{
if (strstr($words[$n], $alpha[$c])) {$links .= "<b>$alpha[$c]</b> "; }
else { $links .= " $alpha[$c] "; $wrong++; }
}
else
{ $links .= " <a href=\"$self?action=hangman&amp;cat=$cat&amp;letters=$alpha[$c]$letters&amp;n=$n&amp;sid=$sid\">$alpha[$c]</a> "; }
}
$nwrong=$wrong; if ($nwrong>6) $nwrong=6;
echo "<br/>Wrong: $wrong out of $max!<br/>";

if ($wrong >= $max)
{
$n++;
if ($n>(count($words)-1)) $n=0;
echo "<br/><br/>$word_line";
echo "<br/><br/><big>SORRY, YOU ARE HANGED!!!</big><br/><br/>";
if (strstr($word, " ")) $term="answer"; else $term="word";
echo "The $term was \"<b>$word</b>\"<br/><br/>";
$sqlfetch=mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'");
$sqlfet=mysql_fetch_array($sqlfetch);
$gplusnew=$sqlfet[0] - "10";
$sql="UPDATE ibwf_users SET gplus='".$gplusnew."' WHERE id='".$uid."'";
$res=mysql_query($sql);
echo "You Have Lost 10 Points!!<br/>";
echo "<a href=\"$self?action=hangman&amp;cat=$cat&amp;n=$n&amp;sid=$sid\">Play again</a><br/>";
echo "<a href=\"$self?action=hangman&amp;sid=$sid\">Change category</a>";
}
else{
echo " Wrong Guesses Left: <b>".($max-$wrong)."</b><br/><br/>";
echo "$word_line";
echo "<br/><br/>Choose a letter:<br/>";
echo "$links";
}
}else{
$n++; # get next word
if ($n>(count($words)-1)) $n=0;
echo "<br/><br/>\n$word_line";
echo "<br/><br/><b>Congratulations!!! You win!!!</b><br/><br/><br/>";
$sqlfetch=mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'");
$sqlfet=mysql_fetch_array($sqlfetch);
$gplusnew=$sqlfet[0] + "25";
$sql="UPDATE ibwf_users SET gplus='".$gplusnew."' WHERE id='".$uid."'";
$res=mysql_query($sql);
echo "You Have Won 25 Points For Winning!<br/>";
echo "<a href=\"$self?action=hangman&amp;cat=$cat&amp;n=$n&amp;sid=$sid\">Play again</a><br/>";
echo "<a href=\"$self?action=hangman&amp;sid=$sid\">Change category</a>";
}
echo "</p>";

}
else{
addonline(getuid_sid($sid),"Lost in Games lol","");
boxstart("Error!!!");
echo "<p align=\"center\">";
echo "I don't know how did you get into here, but there's nothing to show<br/><br/>";
echo "</p>";

}
echo "";
boxend();
getfooter($sid);
?>

</font></body></html>