HEY CAN YOU GIVE ME THE CODE TO PUT IN FUNMENU.PHP ? MY SITE IS BONEWAP . CHATX . WS
Lavalair Funmenu
Collapse
X
-
add this in index.php
and then i have games.phpCode:else if ($action=="funm") { addonline(getuid_sid($sid),"Fun Menu",""); echo "<head><title>$site_name</title>"; echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />"; echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" /> <meta http-equiv=\"Cache-Control\" content=\"no-cache\"/></head>"; echo "<body>"; echo "<h3 align=\"center\">Fun Menu</h3>"; echo "<p align=\"center\">"; echo "<img src=\"images/roll.gif\" alt=\"*\"/> "; echo "Hello, so you want to have some creative fun? well you came into the right place"; echo "</p>"; echo " "; echo "<a href=\"ravebabe.php?sid=$sid\">»Ravebabe</a> "; echo "<a href=\"games.php?action=guessgm&sid=$sid\">»Guess The Number</a> "; echo "<a href=\"games.php?action=scramble&sid=$sid\">»Play word scramble</a> "; echo "<a href=\"games.php?action=hangman&sid=$sid\">»Play Hangman</a> "; echo "<a href=\"quiz.php?action=quiz&sid=$sid\">»Quiz game</a> "; echo "<a href=\"adven.php?action=padventure&sid=$sid\">»Adventure game</a> "; //echo "<a href=\"xogame.php?sid=$sid\">»Tic tac toe[size="1"](2 players)[/size]</a> "; //echo "»Hangman "; //echo "»Dares Box "; 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>"; include("ad.php"); echo "</body></html>"; }
guess u can rename it to funmenu.php
Code:<?php include("config.php"); include("core.php"); $bcon = connectdb(); $uid = getuid_sid($sid); $theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'")); header("Content-type: text/html; charset=ISO-8859-1"); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"; 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\">"; echo "<head><title>$site_name</title>"; if($theme){echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";} else{echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";} echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" /> <meta http-equiv=\"Cache-Control\" content=\"no-cache\"/></head>"; echo "<body>"; ?> <?php if (!$bcon) { 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 "</body>"; echo "</html>"; exit(); } $action = $_GET["action"]; $sid = $_GET["sid"]; $uid = getuid_sid($sid); if((islogged($sid)==false)||($uid==0)) { 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 "</body>"; echo "</html>"; exit(); } if(isbanned($uid)) { 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'")); $remain = $banto[0]- time(); $rmsg = gettimemsg($remain); echo "Time to finish your penalty: $rmsg "; //echo "<a href=\"index.php\">Login</a>"; echo "</p>"; echo "</body>"; echo "</html>"; exit(); } if($action=="guessgm") { addonline(getuid_sid($sid),"Playing Gtn",""); echo "<head>"; echo "<title>Guess The Number</title>"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">"; echo "</head>"; echo "<body>"; 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 = "[size="1"]Just try to guess the number before you have no more tries, the number is between 1-100[/size] "; echo $gmsg; $tries = $tries-1; $gpl = $tries*3; echo "Tries:$tries, Plusses:$gpl "; if ($un==$rn){ $gpl = $gpl+3; $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'")); $ugpl = $gpl + $ugpl[0]; mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$uid."'"); echo "Congrats! the number was $rn, $gpl Plusses has been added to your Game Plusses, [b]1 [/b]<a accesskey=\"1\" href=\"games.php?action=guessgm&sid=$sid\">New Game</a> "; }else{ if($un <$rn) { echo "Try bigger number than $un ! "; }else{ echo "Try smaller number than $un ! "; } echo "<form action=\"games.php?action=guessgm&sid=$sid\" method=\"post\">"; echo "Your Guess: <input type=\"text\" name=\"un\" style=\"-wap-input-format: '*N'\" size=\"3\" value=\"$un\"/>"; echo "<input type=\"hidden\" name=\"gid\" value=\"$gid\"/>"; echo "<input type=\"Submit\" name=\"try\" value=\"TRY\"></form> "; } }else{ $gmsg = "GAME OVER, [b]1 [/b]<a accesskey=\"1\" href=\"games.php?action=guessgm&sid=$sid\">New Game</a> "; echo $gmsg; } echo " [b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>"; echo "</p></body>"; }else if($action == "scramble") { addonline(getuid_sid($sid),"playing word scramble",""); echo "<p align=\"center\">"; $answer = $_POST["answer"]; if (empty($_POST["answer"])) { srand((float) microtime() * 10000000); $input = array( "dictionary", "recognize", "example", "entertainment", "experiment", "appreciation", "information", "pronunciation", "language", "government", "psychic", "blueberry", "selection", "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.</p> <form method=\"POST\" action=\"games.php?action=scramble&sid=$sid\"> <center><input type=\"text\" name=\"answer\" size=\"20\"> <input type=\"hidden\" name=\"correct\" value=\"$word\"> <input type=\"submit\" value=\"GO!\" name=\"B1\"></center> </form> <p align=\"center\">[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a></p> </body>"; } else { $answer = strtolower($answer); if($answer == $correct){ $result = "Correct! [b]$answer[/b]"; $uid = getuid_sid($sid); $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'")); $ugpl2 = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'")); $ugpl = "25" + $ugpl[0]; $ugpl2 = "25" + $ugpl[0]; mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."',lastplreas='won 25 plusses playing word scramble' WHERE id='".$uid."'"); mysql_query("UPDATE ibwf_users SET gplus='".$ugpl."' WHERE id='".$uid."'"); echo "<p align=\"center\">$result You Have Had 25 Plusses Added For Winning. </p> <p align=\"center\"><a href=\"games.php?action=scramble&sid=$sid\">Try Another Word?</a> [b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a></p> </body>";} 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."'")); echo "<p align=\"center\">$result you lost. </p> <p align=\"center\"><a href=\"games.php?action=scramble&sid=$sid\">Try Another Word?</a> [b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a></p> </body>"; } } }else if($action == "hangman") { addonline(getuid_sid($sid),"Playing Hangman",""); if ($cat==""){ echo "<p align=\"center\"> <img src=\"../images/hang_6.gif\" alt=\"Hangman\"/> Select a category: "; echo "<a href=\"$PHP_SELF?action=hangman&cat=anmls&sid=$sid\">Animals</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=clrs&sid=$sid\">Colours</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=comp&sid=$sid\">Computers</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=frt&sid=$sid\">Fruit</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=big&sid=$sid\">Big Words</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=lotr&sid=$sid\">Lord Of The Rings</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=mths&sid=$sid\">Months</a> "; echo "<a href=\"$PHP_SELF?action=hangman&cat=web&sid=$sid\">Web / Wap coding</a> "; echo " <a href=\"index.php?action=main&sid=$sid\">Back</a> "; echo "</p></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 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 ====================================================== $sid = $_GET["sid"]; $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=$_SERVER["PHP_SELF"]; $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\">"; 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&cat=$cat&letters=$alpha[$c]$letters&n=$n&sid=$sid\">$alpha[$c]</a> "; } } $nwrong=$wrong; if ($nwrong>6) $nwrong=6; echo " <img src=\"images/hang_$nwrong.gif\" alt=\"Wrong: $wrong out of $max\"/> "; if ($wrong >= $max) { $n++; if ($n>(count($words)-1)) $n=0; echo " $word_line"; echo " <big>SORRY, YOU ARE HANGED!!!</big> "; if (strstr($word, " ")) $term="answer"; else $term="word"; echo "The $term was \"[b]$word[/b]\" "; $sqlfetch=mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"); $sqlfet=mysql_fetch_array($sqlfetch); $res=mysql_query($sql); echo "<a href=\"$self?action=hangman&cat=$cat&n=$n&sid=$sid\">Play again</a> "; echo "<a href=\"$self?action=hangman&sid=$sid\">Change category</a>"; }else{ echo " Wrong Guesses Left: [b]".($max-$wrong)."[/b] "; echo "$word_line"; echo " Choose a letter: "; echo "$links"; } }else{ $n++; # get next word if ($n>(count($words)-1)) $n=0; echo " \n$word_line"; echo " [b]Congratulations!!! You win!!![/b] "; $sqlfetch=mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"); $sqlfetch2=mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"); $sqlfet=mysql_fetch_array($sqlfetch); $sqlfet2=mysql_fetch_array($sqlfetch2); $gplusnew=$sqlfet[0] + "25"; $gplusnew2=$sqlfet2[0] + "25"; $sql="UPDATE ibwf_users SET plusses='".$gplusnew."', lastplreas='won 25 plusses playing hang man' WHERE id='".$uid."'"; $sql="UPDATE ibwf_users SET gplus='".$gplusnew2."' WHERE id='".$uid."'"; $res=mysql_query($sql); echo "You Have Had 25 game Plusses Added For Winning. "; echo "<a href=\"$self?action=hangman&cat=$cat&n=$n&sid=$sid\">Play again</a> "; echo "<a href=\"$self?action=hangman&sid=$sid\">Change category</a>"; } echo " <a href=\"index.php?action=main&sid=$sid\">Back</a>"; echo "</p></body>"; } else{ addonline(getuid_sid($sid),"Lost in Games lol",""); echo "<card id=\"main\" title=\"Games\">"; echo "<p align=\"center\">"; echo "I don't know how did you get into here, but there's nothing to show "; echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p></body>"; } function getchars($text) { $text = strtolower($text); $abc = "abcdefghijklmnopqrstuvwxyz"; $rts = ""; for ($i=0; $i<strlen($text); $i++) { $onc = substr($text,$i, 1); $pos = strpos($abc,$onc); if($pos===false) { //meh }else{ $pos = strpos($rts, $onc); if($pos===false) { $rts .= $onc; } } } return $rts; } ?> </html>
-
here's tictactoe game
Code:<?PHP // If the game has already started, continue // Else start a new game - X goes first session_start(); $move = $HTTP_GET_VARS['move']; // Reset if commanded if($HTTP_GET_VARS['do'] == "reset") { $move = ""; for($a = "0"; $a <= "2"; $a++) { for($b = "0"; $b <= "2"; $b++) { $value = "boardArray"; $value .= $a; $value .= $b; $_SESSION[$value] = ""; } } $_SESSION['whosTurn'] = ""; } // Check for continuing or new game if($move == "") { // Start Game // Initialize variables $whosTurn = "X"; $gameRunning = "1"; $boardArray[0][0] = ""; $boardArray[0][1] = ""; $boardArray[0][2] = ""; $boardArray[1][0] = ""; $boardArray[1][1] = ""; $boardArray[1][2] = ""; $boardArray[2][0] = ""; $boardArray[2][1] = ""; $boardArray[2][2] = ""; // Set session variables $_SESSION['boardArray'] = $boardArray; $_SESSION['whosTurn'] = "X"; } else { // Get board values for($a = "0"; $a <= "2"; $a++) { for($b = "0"; $b <= "2"; $b++) { $value = "boardArray"; $value .= $a; $value .= $b; $boardArray[$a][$b] = $_SESSION[$value]; } } // Get game values and move coOrds $whosTurn = $_SESSION['whosTurn']; $coOrds = explode("-",$HTTP_GET_VARS['move']); $x = $coOrds[0]; $y = $coOrds[1]; // Perform move, but check for refresh (F5) first if($boardArray[$x][$y] == "") {$boardArray[$x][$y] = $whosTurn;} else {$refreshed = "1";} // Stalemate function function doStalemate() { global $staleMate; $staleMate = "1"; } // Game win function $gameWon = "0"; function doWin($whoWon,$wonWith1,$wonWith2,$wonWith3) { // We want to use the global gameWon variable global $gameWon; // Explode the wonWith (which combination won) vars $wonWith1 = explode("-",$wonWith1); $wonWith2 = explode("-",$wonWith2); $wonWith3 = explode("-",$wonWith3); // Transfer the exploded vars to global vars $GLOBALS['whoWon'] = $whoWon; $GLOBALS['wonWith1[0]'] = $wonWith1[0]; $GLOBALS['wonWith1[1]'] = $wonWith1[1]; $GLOBALS['wonWith2[0]'] = $wonWith2[0]; $GLOBALS['wonWith2[1]'] = $wonWith2[1]; $GLOBALS['wonWith3[0]'] = $wonWith3[0]; $GLOBALS['wonWith3[1]'] = $wonWith3[1]; // The game has been won $gameWon = "1"; } // Check for Win or stalemate // X First if($boardArray[0][0] == "X" && $boardArray[0][1] == "X" && $boardArray[0][2] == "X") {doWin("X","0-0","0-1","0-2");} if($boardArray[0][0] == "X" && $boardArray[1][1] == "X" && $boardArray[2][2] == "X") {doWin("X","0-0","1-1","2-2");} if($boardArray[0][0] == "X" && $boardArray[1][0] == "X" && $boardArray[2][0] == "X") {doWin("X","0-0","1-0","2-0");} if($boardArray[1][0] == "X" && $boardArray[1][1] == "X" && $boardArray[1][2] == "X") {doWin("X","1-0","1-1","1-2");} if($boardArray[2][0] == "X" && $boardArray[2][1] == "X" && $boardArray[2][2] == "X") {doWin("X","2-0","2-1","2-2");} if($boardArray[0][1] == "X" && $boardArray[1][1] == "X" && $boardArray[2][1] == "X") {doWin("X","0-1","1-1","2-1");} if($boardArray[0][2] == "X" && $boardArray[1][2] == "X" && $boardArray[2][2] == "X") {doWin("X","0-2","1-2","2-2");} if($boardArray[2][0] == "X" && $boardArray[1][1] == "X" && $boardArray[0][2] == "X") {doWin("X","2-0","1-1","0-2");} // Now O if($boardArray[0][0] == "O" && $boardArray[0][1] == "O" && $boardArray[0][2] == "O") {doWin("O","0-0","0-1","0-2");} if($boardArray[0][0] == "O" && $boardArray[1][1] == "O" && $boardArray[2][2] == "O") {doWin("O","0-0","1-1","2-2");} if($boardArray[0][0] == "O" && $boardArray[1][0] == "O" && $boardArray[2][0] == "O") {doWin("O","0-0","1-0","2-0");} if($boardArray[1][0] == "O" && $boardArray[1][1] == "O" && $boardArray[1][2] == "O") {doWin("O","1-0","1-1","1-2");} if($boardArray[2][0] == "O" && $boardArray[2][1] == "O" && $boardArray[2][2] == "O") {doWin("O","2-0","2-1","2-2");} if($boardArray[0][1] == "O" && $boardArray[1][1] == "O" && $boardArray[2][1] == "O") {doWin("O","0-1","1-1","2-1");} if($boardArray[0][2] == "O" && $boardArray[1][2] == "O" && $boardArray[2][2] == "O") {doWin("O","0-2","1-2","2-2");} if($boardArray[2][0] == "O" && $boardArray[1][1] == "O" && $boardArray[0][2] == "O") {doWin("O","2-0","1-1","0-2");} // No win. How about stalemate? if($gameWon != "1"){ if($boardArray[0][0] != "" && $boardArray[0][1] != "" && $boardArray[0][2] != "" && $boardArray[1][0] != "" && $boardArray[1][1] != "" && $boardArray[1][2] != "" && $boardArray[2][0] != "" && $boardArray[2][1] != "" && $boardArray[2][2] != "") { // Stalemate doStalemate(); } } // Update turn if($refreshed != "1") {if($whosTurn == "X") {$whosTurn = "O";} else {$whosTurn = "X";}} $_SESSION['whosTurn'] = $whosTurn; // Save board values for($a = "0"; $a <= "2"; $a++) { for($b = "0"; $b <= "2"; $b++) { $value = "boardArray"; $value .= $a; $value .= $b; $_SESSION[$value] = $boardArray[$a][$b]; } } } ?> <html> <head> <title>Tic-Tac-Toe</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> a {color: gray; text-decoration: none;} a:hover {color: black; text-decoration: none;} .gameSquare {width: 100px; height: 100px; font-family: Tahoma; font-size: 36pt; color: black;} .gameSquareWon {width: 100px; height: 100px; font-family: Tahoma; font-size: 36pt; color: red;} </style> </head> <body> <div align="center"> <font face="Tahoma" size="5">Tic-Tac-Toe</font> <font face="Tahoma" size="3"><?PHP if($staleMate == "1") {echo("Stalemate.");} else {if($gameWon != "1") {echo $whosTurn; ?>'s Turn<?PHP } else {echo $GLOBALS['whoWon']; echo(" WON!");}} ?></font> <table width="300" height="300" border="1" cellpadding="5" cellspacing="0" bordercolor="#000000"> <?PHP $draw_x = "-1"; $draw_y = "-1"; for($row = 0; $row < 3; $row++) { echo("<tr align=\"center\" valign=\"middle\">"); $draw_x++; for($col = 0; $col < 3; $col++) { $draw_y++; echo("<td class=\"gameSquare"); if($gameWon == "1") { if($draw_x == $GLOBALS['wonWith1[0]'] && $draw_y == $GLOBALS['wonWith1[1]']) {$winningSpot = "1";} else if($draw_x == $GLOBALS['wonWith2[0]'] && $draw_y == $GLOBALS['wonWith2[1]']) {$winningSpot = "1";} else if($draw_x == $GLOBALS['wonWith3[0]'] && $draw_y == $GLOBALS['wonWith3[1]']) {$winningSpot = "1";} if($winningSpot == "1") {echo("Won");$winningSpot = "0";} } echo("\">"); if($boardArray[$draw_x][$draw_y] != "") { echo $boardArray[$draw_x][$draw_y]; } else { if($gameWon != "1") { echo("<A HREF=\"tictactoe.php?do=move&move=".$draw_x."-".$draw_y."&which=".$whosTurn."\">?</A>"); } else { echo("-"); } } echo("</td>"); } $draw_y = "-1"; echo("</tr>"); } ?> </table> <font face="tahoma" size="2">[url="tictactoe.php?do=reset"]Reset Game / Play Again[/url]</font> </div> </body> </html>
Comment
-
Code:<?php /* IrisBlaze wap forum by Ra'ed Shabana */ //» » //« « 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"); $bcon = connectdb(); if (!$bcon) { echo "<card id=\"main\" title=\"lavalair.net (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>"; getAd(); echo "</card>"; echo "</wml>"; exit(); } $action = $_GET["action"]; $sid = $_GET["sid"]; $uid = getuid_sid($sid); if((islogged($sid)==false)||($uid==0)) { echo "<card id=\"main\" title=\"lavalair.net\">"; 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>"; getAd(); echo "</card>"; echo "</wml>"; exit(); } if(isbanned($uid)) { echo "<card id=\"main\" title=\"lavalair.net\">"; 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'")); $remain = $banto[0]- time(); $rmsg = gettimemsg($remain); echo "Time to finish your penalty: $rmsg "; //echo "<a href=\"index.php\">Login</a>"; echo "</p>"; getAd(); echo "</card>"; echo "</wml>"; exit(); } if($action=="guessgm") { addonline(getuid_sid($sid),"Playing G.T.N.",""); echo "<card id=\"main\" title=\"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 = "[size="1"]Just try to guess the number before you have no more tries, the number is between 1-100[/size] "; echo $gmsg; $tries = $tries-1; $gpl = $tries*3; echo "Tries:$tries, Plusses:$gpl "; 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 "[size="1"]Congrats! the number was $rn, $gpl Plusses has been added to your Game Plusses, <a href=\"games.php?action=guessgm&sid=$sid\">New Game</a>[/size] "; }else{ if($un <$rn) { echo "Try bigger number than $un ! "; }else{ echo "Try smaller number than $un ! "; } echo "Your Guess: <input type=\"text\" name=\"un\" format=\"*N\" size=\"3\" value=\"$un\"/><anchor>"; echo " TRY"; echo "<go href=\"games.php?action=guessgm&sid=$sid\" method=\"post\">"; echo "<postfield name=\"un\" value=\"$(un)\"/>"; echo "<postfield name=\"gid\" value=\"$gid\"/>"; echo "</go>"; echo "</anchor> "; } }else{ $gmsg = "[size="1"]GAME OVER, <a href=\"games.php?action=guessgm&sid=$sid\">New Game</a>[/size] "; echo $gmsg; } echo " <a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; getAd(); echo "</p></card>"; }else if($action == "hangman") { addonline(getuid_sid($sid),"Playing hangman",""); echo "<card id=\"main\" title=\"Hangman\">"; echo "<p align=\"center\">"; $gid = $_GET["gid"]; $gchr = $_GET["gchr"]; $alpha = "abcdefghijklmnopqrstuvwxyz"; if($gid=="") { mysql_query("DELETE FROM ibwf_games WHERE uid='".$uid."'"); $hmid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_hangman ORDER BY RAND() LIMIT 1")); mysql_query("INSERT INTO ibwf_games SET uid='".$uid."', gvar1='abcdefghijklmnopqrstuvwxyz', gvar2='', gvar3='', gvar4='".$hmid[0]."'"); $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, gvar3, gvar4 FROM ibwf_games WHERE id='".$gid."' AND uid='".$uid."'")); } if(strlen($ginfo[1])<6) { $txg = mysql_fetch_array(mysql_query("SELECT text, dscr FROM ibwf_hangman WHERE id='".$ginfo[3]."'")); $tofn = getchars($txg[0]); } echo " <a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; getAd(); echo "</p></card>"; }else{ addonline(getuid_sid($sid),"Lost in Games lol",""); echo "<card id=\"main\" title=\"Games\">"; echo "<p align=\"center\">"; echo "I don't know how did you get into here, but there's nothing to show "; echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; getAd(); echo "</p></card>"; } function getchars($text) { $text = strtolower($text); $abc = "abcdefghijklmnopqrstuvwxyz"; $rts = ""; for ($i=0; $i<strlen($text); $i++) { $onc = substr($text,$i, 1); $pos = strpos($abc,$onc); if($pos===false) { //meh }else{ $pos = strpos($rts, $onc); if($pos===false) { $rts .= $onc; } } } return $rts; } ?> </wml>
Comment
Comment