games.php

来自「wap 程序 手器电脑通用」· PHP 代码 · 共 138 行

PHP
138
字号
<?php
/** 
*
* @package wappyCULT: wap community script
* @version 1.00 2006/09/12 21:53:27 wappy
* @copyright (c) 2004-2006 wappyCULT 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
*/
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=\"wappyCULT (ERROR!)\">";
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
    echo "ERROR! cannot connect to database<br/><br/>";

    echo "</p>";
    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=\"wappyCULT\">";
      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 "</card>";
      echo "</wml>";
      exit();
}
if(isbanned($uid))
    {
        echo "<card id=\"main\" title=\"wappyCULT\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
      echo "You are <b>Banned</b><br/>";
      $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<br/><br/>";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
if($action=="guessgm")
{
    addonline(getuid_sid($sid),"PLAYING GTN","");
    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 = "<small>Just try to guess the number before you have no more tries, the number is between 1-100</small><br/><br/>";
                echo $gmsg;
                $tries = $tries-1;
                $gpl = $tries*3;
                echo "Tries:$tries, Plusses:$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 "<small>Congrats! the number was $rn, $gpl Plusses has been added to your Game Plusses, <a href=\"games.php?action=guessgm&amp;sid=$sid\">New Game</a></small><br/><br/>";
                      }else{
                        if($un <$rn)
                        {
                          echo "Try bigger number than $un !<br/><br/>";
                        }else{
                            echo "Try smaller number than $un !<br/><br/>";
                        }
echo "Your Guess: <input type=\"text\" name=\"un\" format=\"*N\" size=\"3\" value=\"$un\"/><anchor>";
		echo " TRY";
		echo "<go href=\"games.php?action=guessgm&amp;sid=$sid\" method=\"post\">";
		echo "<postfield name=\"un\" value=\"$(un)\"/>";
		echo "<postfield name=\"gid\" value=\"$gid\"/>";
		echo "</go>";
		echo "</anchor><br/>";
                      }


                }else{
                    $gmsg = "<small>GAME OVER, <a href=\"games.php?action=guessgm&amp;sid=$sid\">New Game</a></small><br/><br/>";
                    echo $gmsg;
                }
  echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}else{
   addonline(getuid_sid($sid),"Lost in Games lol","");
    echo "<card id=\"main\" title=\"Inbox\">";
  echo "<p align=\"center\">";
  echo "I don't know how you got into here, but there's nothing to show<br/><br/>";
  echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}
?>
</wml>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?