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

📄 bulletfactory.php

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

  include("_include-jail.php");

/* ------------------------- */ ?>
<html>


<head>

<title>RealCrime.Be Join The Crime Version</title>
<link rel="stylesheet" type="text/css" href="css-v1.css">

</head>


<body>
<table width=100%>
<?PHP
  $dbres                = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
    $aantal                = mysql_fetch_object($dbres);

if($aantal->owner == unowned){
echo "<table width=90% align=\"center\">
<tr><td class=\"subTitle\">Bullet Factory</td></tr>
<tr><td class=\"mainTxt\">This bulletfactory is unowned!<br><a href=\"take.php?t=bulletfactory&c={$data->City}\"><font size=4>Take it over!</font></a></td></tr>
</table>";
} else {

$ownerr = ($aantal->owner == "freaky-flow") ? "<b><a href=\"take.php\">Take Over!</a></b>" : "<a href=\"profile.php?x={$aantal->owner}\">$aantal->owner</a>";
$owner = ($aantal->owner == "freaky-flow") ? "<font color=white>State Owned</font>" : "$ownerr";

$active = ($aantal->active >= "25") ? "<font color=green>Producing</font>" : "<font color=red>Stopped</font>";

if (isset($_POST['buy'])) {
       $amount = $_POST['amount'];
       $genoegcash = round($aantal->price*$amount);
       if($genoegcash <= $data->cash) {
if($aantal->amount >= $amount) {
if($amount > 0 && preg_match('/^[0-9]{1,15}$/',$_POST['amount'])) {
mysql_query("UPDATE `[users]` set `bullets`=`bullets`+{$amount}, `cash`=`cash`-{$genoegcash} WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` set `cash`=`cash`+{$genoegcash} WHERE `login`='{$aantal->owner}'");
mysql_query("UPDATE `[buildings]` set `amount`=`amount`-{$amount}, `profit`=`profit`+{$genoegcash} WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
echo "<tr><td class=\"mainTxt\">You bought $amount bullets.</td></tr>";

} else {
echo "<font color=red>* Invalid amount of bullets!</font>";
}

} else {
echo "<font color=red>* This factory does not have that many bullets!</font>";
}
} else {
echo "<font color=red>* You don't have enough money!</font>";
}
}
if (isset($_POST['drop'])){
if ($data->login == $aantal->owner){
mysql_query("UPDATE `[buildings]` SET `owner`='unowned' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `profit`='0' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `amount`='0' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `price`='2500' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `active`='0' WHERE `type`='bulletfactory' 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 Bullet Factory!</td></tr></table></center>";
}
else
echo "<center><table width=90%><tr><td class=\"mainTxt\"><font color=red>* This Bullet Factory isn'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_num_rows($dbres);
$new = mysql_fetch_object($dbres);
if ($logincheck >= 1){
mysql_query("UPDATE `[buildings]` SET `owner`='$new->login' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `profit`='0' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `amount`='0' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `price`='2500' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("UPDATE `[buildings]` SET `active`='0' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Give Bullet Factory',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">You gave the Bullet Factory to $newowner!</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,7}$/',$_POST['newprice']) && $data->login == $aantal->owner){
$newprice = $_POST['newprice'];
mysql_query("UPDATE `[buildings]` SET `price`='$newprice' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','$newprice','Set new Bullet price',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">You changed the price 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>";
}
if (isset($_POST['setbph'])){
$newbph = $_POST['bphour'];
mysql_query("UPDATE `[buildings]` SET `active`='$newbph' WHERE `type`='bulletfactory' AND `city`='{$data->City}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','$newbph','Set new BPH',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">You have set the amount of Bullets per Hour to $newbph bullets per hour!</td></tr></table></center>";
}

}

?>
<html>
<table width=90% align="center">
<tr><td class="subTitle">Bullet Factory</td></tr>
<tr><td class="mainTxt" align="center">This bullet factory is owned by <b><? echo $owner; ?></b> and it has <b><? echo $aantal->amount; ?></b> bullets. The price is <b>$<? echo $aantal->price; ?></b> per bullet.<br>
This Bullet Factory is currently: <b><? echo $active; ?></b>.</td></tr></table>
	<form method="POST"  action="">
	<table align="center" cellspacing="1">
	<tr>
	<td colspan=2 class=subTitle align=center>Buy Bullets</td>
	</tr>
	<tr>
	<td class="mainTxt">Amount of Bullets:</td>
	<td class="mainTxt"><input type=text name=amount size=6></td>
	</tr>
	<tr>
	<td class="mainTxt">&nbsp;</td>
	<td align=right class="mainTxt"><input type="submit" value="Buy!" name="buy"></td>
	</tr>
	</table>
	</form>

</center>
<?

if ($data->login == $aantal->owner){
  $activate				= ($aantal->active == 1) ? "Stop the Bullet Factory" : "Start the Bullet Factory";
    print <<<ENDHTML
  <center>
<table width=90%>
    <tr><td class="subTitle"><b>Bullet Factory</b></td></tr>
    <tr><td class="mainTxt" align="center">The profit of this Bullet Factory is: <b>{$aantal->profit}</b>.
<form method="POST" action="">You can always drop the Factory, the Bullet Factory will then be unowned, other people can take it then!<br></center>
                  <input type="submit" name="drop" value="Drop the Factory!"></form>
<form method="POST" action="">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!"></form>
<form method="POST" action="">New price: <input type="text" name="newprice" size="3" maxlength="5" value="{$aantal->price}"><input type="submit" name="setnewprice" value="Set!"></form>
<form method="POST" action="">
	<table width="80%">
		<tr><td colspan="4" class="subTitle">Machine Quality</td></tr>
		<tr><td class="subTitle" width="5">&nbsp;#&nbsp;</td><td class="subTitle">Amount</td><td class="subTitle">Quality of the Machines</td><td class="subTitle">Price</td></tr>
		<tr><td class="mainTxt" align="center"><input type="radio" name="bphour" value="0"></td><td class="mainTxt">0</td><td class="mainTxt">Stop</td class="mainTxt"><td class="mainTxt">$0</td></tr>
		<tr><td class="mainTxt" align="center"><input type="radio" name="bphour" value="25"></td><td class="mainTxt">25</td><td class="mainTxt">Very Bad</td class="mainTxt"><td class="mainTxt">$2,500</td></tr>
		<tr><td class="mainTxt" align="center"><input type="radio" name="bphour" value="50"></td><td class="mainTxt">50</td><td class="mainTxt">Bad</td class="mainTxt"><td class="mainTxt">$6,500</td></tr>
		<tr><td class="mainTxt" align="center"><input type="radio" name="bphour" value="100"></td><td class="mainTxt">100</td><td class="mainTxt">Reasonable</td class="mainTxt"><td class="mainTxt">$17,500</td></tr>
		<tr><td class="mainTxt" align="center"><input type="radio" name="bphour" value="250"></td><td class="mainTxt">250</td><td class="mainTxt">Good</td class="mainTxt"><td class="mainTxt">$50,000</td></tr>
	   <tr><td colspan="4" class="mainTxt"><table width="100%"><tr><td>Currently making $aantal->active bullets per hour.</td><td align="right"><input type="submit" name="setbph" value="Do it!" style="width: 50;"></td></tr></table></td></tr>
	</table></form>
                     </font>
    </td></tr>
</table></center>
ENDHTML;

}
?>

<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 + -