⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slot.php

📁 还是WEB游戏源码 Darkstep 还是WEB游戏源码 Darkstep
💻 PHP
字号:
<?php /* ------------------------- */ 

  $UPDATE_DB                                = 1; 
  include("_include-config.php"); 
  if(! check_login) { 
    header("Location: login.php"); 
  } 

  mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'"); 

/* ------------------------- */ ?> 
<html> 
 
<head> 
<title>[( Elite Avengers )]</title> 
<link rel="stylesheet" type="text/css" href="css-v1.css"> 

</head> 
<body> 
<?php

    $dbres			= mysql_query("SELECT * FROM `[buildings]` WHERE `type`='slot' AND `city`='{$data->City}'");
    $aantal			= mysql_fetch_object($dbres);

if($aantal->owner == unowned){
echo "<table width=90% align=\"center\">
<tr><td class=\"subTitle\">Slot Machines</td></tr>
<tr><td class=\"mainTxt\">Those slot machines are unowned!<br><a href=\"take.php?t=slot&c={$data->City}\"><font size=4>Take them over!</font></a></td></tr>
</table>";
} else {

$ownerr = ($aantal->owner == "unowned") ? "<b><a href=\"take.php?t=slot&c={$data->City}\">Take Over!</a></b>" : "<a href=\"profile.php?x={$aantal->owner}\">$aantal->owner</a>";
$owner = ($aantal->owner == "ZeRoDeaD") ? "<font color=white>State Owned</font>" : "$ownerr";
?>
<center><table width="180" border="1" cellspacing="0" cellpadding="2" bordercolor="black" height="170">
<tr><td colspan="3" class="subTitle" height=25><b>Slot Machines</b></td></tr>
<?PHP 



if (isset($_POST['submit1'])) { 
$inzet		= $_POST['inzet'];
	if(!preg_match('/^[0-9]{1,15}$/',$_POST['inzet']) OR $_POST['inzet'] < 0){
		echo "<tr><td class=\"mainTxt\"><font color=\"red\">* Invalid amount of money.";
		echo "</font></td></tr>";
	}
	elseif($inzet > $data->cash){
		echo "<tr><td class=\"mainTxt\"><font color=\"red\">You haven't got enough money.";
		echo "</font></td></tr>";
	}
	elseif($inzet > $aantal->price){
		echo "<tr><td class=\"mainTxt\"><font color=\"red\">* Your bet may not exeet the maxbet!";
		echo "</font></td></tr>";
	} else {
if($aantal->profit > 0) {
   $nr12		= rand(0,71);
   $nr22		= rand(0,71);
   $nr32		= rand(0,71);
   $nr11		= array("1","2","3","4","5","6","7","8","3","4","5","6","7","8","3","4","5","6","7","8","3","5","6","7","8","3","4","2","5","6","4","1","6","3","7","5","6","7","8","3","4","5","6","7","8","3","4","5","6","7","8","3","5","6","7","8","3","4","2","5","6","4","5","6","7","8","5","6","7","8","3","4");
   $nr21		= array("1","2","3","4","5","6","7","8","3","4","5","6","7","8","3","4","5","6","7","8","3","5","6","7","8","3","4","4","5","6","4","1","6","3","7","5","6","7","8","3","4","5","6","7","8","3","4","5","6","7","8","3","5","6","7","8","3","4","4","5","6","4","5","6","7","8","5","6","7","8","3","4");
   $nr31		= array("1","2","3","4","5","6","7","8","3","4","5","6","7","8","3","4","5","6","7","8","3","5","6","7","8","3","4","4","5","6","4","1","6","3","7","5","6","7","8","3","4","5","6","7","8","3","4","5","6","7","8","3","5","6","7","8","3","4","4","5","6","4","5","6","7","8","5","6","7","8","3","4");
} else {
   $nr12		= rand(0,81);
   $nr22		= rand(0,81);
   $nr32		= rand(0,81);
   $nr11		= array("1","2","3","4","5","6","7","8","3","9","5","6","7","8","3","3","5","6","4","8","3","5","6","7","8","7","5","5","7","8","3","1","5","8","5","8","1","3","5","6","7","8","3","9","5","6","7","8","3","3","5","6","4","8","3","5","6","7","8","7","5","5","7","8","3","1","5","8","5","8","5","6","7","8","5","6","7","8","5","6","7","8");
   $nr21		= array("1","2","3","4","5","6","7","8","3","9","5","6","7","8","3","3","5","6","4","8","3","5","6","7","8","7","5","5","7","8","3","1","5","8","5","8","1","3","5","6","7","8","3","9","5","6","7","8","3","3","5","6","4","8","3","5","6","7","8","7","5","5","7","8","3","1","5","8","5","8","5","6","7","8","5","6","7","8","5","6","7","8");
   $nr31		= array("1","2","3","4","5","6","7","8","3","9","5","6","7","8","3","3","5","6","4","8","3","5","6","7","8","7","5","5","7","8","3","1","5","8","5","8","1","3","5","6","7","8","3","9","5","6","7","8","3","3","5","6","4","8","3","5","6","7","8","7","5","5","7","8","3","1","5","8","5","8","5","6","7","8","5","6","7","8","5","6","7","8");
}
   $nr1			= $nr11[$nr12];
   $nr2			= $nr21[$nr22];
   $nr3			= $nr31[$nr32];

 print <<<ENDHTML
    <tr> 
      <td width=60 height=60 bgcolor="white"> 
        <center><img src="images/casino/{$nr1}.gif"></center>
      </td>
      <td width=60 height=60 bgcolor="white"> 
       <center><img src="images/casino/{$nr2}.gif"></center>
      </td>
      <td width=60 height=60 bgcolor="white"> 
        <center><img src="images/casino/{$nr3}.gif"></center>
      </td>
    </tr>
ENDHTML;
	echo "<tr><td class=\"mainTxt\" align=\"center\" colspan=\"3\">";

if($nr1 == 1 && $nr2 == 1 && $nr3 == 1){
$profit2	= round($inzet*76);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
elseif($nr1 == 2 && $nr2 == 2 && $nr3 == 2){
$profit2	= round($inzet*51);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
elseif($nr1 == 3 && $nr2 == 3 && $nr3 == 3){
$profit2	= round($inzet*36);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
elseif(($nr1 == 4 && $nr2 == 4 && $nr3 == 4) XOR ($nr1 == 4 && $nr2 == 4 && $nr3 == 9) XOR ($nr1 == 4 && $nr2 == 9 && $nr3 == 9) XOR ($nr1 == 9 && $nr2 == 9 && $nr3 == 9) XOR ($nr1 == 9 && $nr2 == 9 && $nr3 == 4) XOR ($nr1 == 9 && $nr2 == 4 && $nr3 == 4) XOR ($nr1 == 9 && $nr2 == 4 && $nr3 == 9) XOR ($nr1 == 4 && $nr2 == 9 && $nr3 == 4)){
$profit2	= round($inzet*7);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
elseif($nr1 == 2 XOR $nr2 == 2 XOR $nr3 == 2){
$profit2	= round($inzet*4);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
elseif(($nr1 == 2 && $nr2 == 2) XOR ($nr2 == 2 && $nr3 == 2) XOR ($nr3 == 2 && $nr1 == 2)){
$profit2	= round($inzet*8);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
elseif(($nr1 == 4 && $nr2 == 4) XOR ($nr1 == 4 && $nr2 == 9) XOR ($nr1 == 9 && $nr2 == 4) XOR ($nr1 == 9 && $nr2 == 9) XOR ($nr1 == 4 && $nr3 == 4) XOR ($nr1 == 4 && $nr3 == 9) XOR ($nr1 == 9 && $nr3 == 4) XOR ($nr1 == 9 && $nr3 == 9) XOR ($nr2 == 4 && $nr3 == 4) XOR ($nr2 == 4 && $nr3 == 9) XOR ($nr2 == 9 && $nr3 == 4) XOR ($nr2 == 9 && $nr3 == 9)){
$profit2	= round($inzet*7);
$profit1	= round($profit2-$inzet);
$profit		= number_format($profit1,0);
       echo "<b>Congratulations!</b><br>You won \$$profit";
}
else{
$profit2	= round($inzet);
$profit1	= round(0-$inzet);
$profit		= number_format($profit2,0);
print"<center>You lost \$$profit.</center>";
}
echo "</td></tr>";
mysql_query("UPDATE `[buildings]` SET `profit`=`profit`-$profit1 WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[users]` SET `cash`=`cash`-$profit1 WHERE `login`='{$aantal->owner}'");
mysql_query("UPDATE `[users]` SET `cash`=`cash`+$profit1 WHERE `login`='{$data->login}'");

}
}
$price	= number_format($aantal->price,0);
?>
<tr><td class="mainTxt" colspan="3" align="center">
<FORM METHOD=post>
      Bet:<br>
  <font size="4">$</font>
	<input type=text name=inzet size=8 maxlength="11" value="<? echo $_POST['inzet']; ?>"><br>
	<input type=submit name=submit1 value="Pull Handle">
</FORM> 
</td></tr>
</table><br><br>

This Slot Machine is owned by <? echo $owner; ?>. The maxbet is set at <b>$<? echo $price; ?></b>.<br>
<b>Report any errors to ZeRoDeaD!</b></center>
<?php

if ($data->login == $aantal->owner){
    print <<<ENDHTML
  <center><table width=90%>
    <tr><td class="subTitle"><b>Slot Machines</b></td></tr>
    <tr><td class="mainTxt">
	<center>
<form method="POST" action=""><center>The profit of the Slot Machines are: <b>{$aantal->profit}</b>.<br>
Set new maxbet: <input type="text" name="newprice" size="5" maxlength="12" value="{$aantal->price}"><input type="submit" name="setnewprice" value="Set!"><br>
You can always drop the Slot Machines, the slot machines will then be unowned, other people can take it then!<br></center>
                  <input type="submit" name="drop" value="Drop the Slot Machines!"><br>
<center>You can also give it to someone else.<br>
<input type="text" name="newowner" size="20" maxlength="20"><input type="submit" name="giveto" value="Give!"><br>
</form>
                     </font>
	</center>
    </td></tr>
</table></center>
ENDHTML;

if (isset($_POST['drop'])){
if ($data->login == $aantal->owner){
mysql_query("UPDATE `[buildings]` SET `owner`='unowned' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `profit`='0' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `amount`='0' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `price`='25000' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `active`='0' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Drop BF',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">* You dropped the Slot Machines!</td></tr></table></center>";
}
else {
echo "<center><table width=90%><tr><td class=\"mainTxt\"><font color=red>* Those Slot Machines aren't yours!</font></td></tr></table></center>";
}
}

$newowner = $_POST['newowner'];
if (isset($_POST['giveto']) && $data->login == $aantal->owner){
$dbres = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='$newowner'");
$logincheck = mysql_fetch_object($dbres);
$logincheck1 = mysql_num_rows($dbres);
if ($logincheck1 >= 1){
mysql_query("UPDATE `[buildings]` SET `owner`='{$logincheck->login}' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `profit`='0' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `amount`='0' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `price`='25000' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `active`='0' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Give Slot Machines',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">You gave the Slot Machines to {$logincheck->login}!</td></tr></table></center>";
}
else {
echo "<center><table width=90%><tr><td class=\"mainTxt\">* Invalid username!</td></tr></table></center>";
}
}
if (isset($_POST['setnewprice'])){
if (preg_match('/^[0-9]{1,15}$/',$_POST['newprice']) && $data->login == $aantal->owner){
$newprice = $_POST['newprice'];
mysql_query("UPDATE `[buildings]` SET `price`='$newprice' WHERE `type`='slot' AND `city`='{$data->City}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','$newprice','Update SM maxbet',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">You changed the maxbet to <b>\${$newprice}</b>!</td></tr></table></center>";
}
else {
echo "<center><table width=90%><tr><td class=\"mainTxt\">* Invalid amount of money!</td></tr></table></center>";
}
}
}
}
?>

<p align="center"><sub>&copy; 2005 - 2006 Elite Avengers version 2.1 - All rights reserved.</sub></p>

</body>

</html>

⌨️ 快捷键说明

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