Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- session_start();
- include_once "includes/db_connect.php";
- include_once "includes/functions.php";
- logincheck();
- $username=$_SESSION['username'];
- $fetch= mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
- $bf = mysql_fetch_object(mysql_query("SELECT * FROM bf WHERE location='$fetch->location'"));
- $fetch_owner=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$bf->owner'"));
- ?>
- <?
- if ($site->gupdate == "1"){
- echo "<link href='style.css' rel='stylesheet' type='text/css'><center><div class='update'>$site->gupdatetext</div></center>
- <br>";
- }
- ?>
- <link href='style.css' rel='stylesheet' type='text/css'>
- <script type="text/javascript" src="/js/select.js"></script>
- <style type="text/css">
- .select, .selected {
- width: 110px;
- padding: 10px;
- }
- </style>
- <?php
- if($_GET['buyfactory']){
- $bf = mysql_fetch_object(mysql_query("SELECT * FROM bf WHERE location='$fetch->location'"));
- if($bf->owner == "0"){
- if($info->money < 25000000){
- echo "<table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You dont have £25,000,000 to purchase this factory!</td></tr></table>";
- }else{
- mysql_query("UPDATE users SET money=money-25000000 WHERE username='$username'");
- mysql_query("UPDATE bf SET owner='$username' WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET jspprice='4500' WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET fmjprice='4500' WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET profit='0' WHERE location='$fetch->location'");
- echo" <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=green>Your now the owner of $fetch->location bullet factory!</td></tr></table>";
- }}}
- ?>
- <?php
- if($_GET['drop']){
- $bf = mysql_fetch_object(mysql_query("SELECT * FROM bf WHERE location='$fetch->location' AND owner='$username' LIMIT 1"));
- if ($bf->owner == $username) {
- mysql_query("UPDATE bf SET owner='0' WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET jspprice='4500' WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET fmjprice='4500' WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET profit='0' WHERE location='$fetch->location'");
- echo"<br><div class=success>You have dropped the bullet factory in $fetch->location!<br><br>";
- }}
- /////////////////////////////////////////////////////
- if(strip_tags($_POST['submit'])){
- $type=$_POST['type'];
- $amount=strip_tags($_GET['amount']);
- if($type == "1"){
- $bf = mysql_fetch_object(mysql_query("SELECT * FROM bf WHERE location='$fetch->location'"));
- if ($bf->owner == $username) {
- echo" <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cant buy from your own factory!</td></tr></table><br>"; }
- elseif ($bf->owner != $username) {
- $amount=intval(strip_tags($_POST['amount']));
- if ($amount == 0 || !$amount || ereg('[^0-9]',$amount)){
- print " <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cant buy that amount!</td></tr></table><br>";
- }elseif ($amount != 0 || $amount || !ereg('[^0-9]',$amount)){
- $costs = $bf->jhpprice * $amount;
- if ($costs > $fetch->money){
- echo " <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You do not have enough money!</td></tr></table><br>";
- }elseif ($costs <= $fetch->money){
- if ($bf->jhpstock < $amount){
- echo " <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>There isn't enough JHP in stock for you to buy that amount!</td></tr></table><br>";
- }elseif ($amount <= $bf->jhpstock){
- mysql_query("UPDATE users SET money=money-$costs WHERE username='$username'");
- mysql_query("UPDATE users SET JHP=JHP+$amount WHERE username='$username'");
- mysql_query("UPDATE bf SET jhpstock=jhpstock-$amount WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET profit=profit+$cost WHERE location='$fetch->location'");
- mysql_query("UPDATE users SET money=money+$costs WHERE username='$bf->owner'");
- echo" <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0>
- <tr><td class=notice align=center><center><font color=green>You've bought ".makecomma($amount)." JHP for £".makecomma($costs)."!</td></tr></table><br>";
- }}}}}}
- /////////////////////////////////////////////////
- if($type == "2"){
- $bf = mysql_fetch_object(mysql_query("SELECT * FROM bf WHERE location='$fetch->location'"));
- if ($bf->owner == $username) {
- echo" <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cant buy from your own factory!</td></tr></table><br>"; }
- elseif ($bf->owner != $username) {
- $amount=intval(strip_tags($_POST['amount']));
- if ($amount == 0 || !$amount || ereg('[^0-9]',$amount)){
- print " <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You cant buy that amount!</td></tr></table><br>";
- }elseif ($amount != 0 || $amount || !ereg('[^0-9]',$amount)){
- $costs = $bf->fmjprice * $amount;
- if ($costs > $fetch->money){
- echo " <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>You do not have enough money!</td></tr></table><br>";
- }elseif ($costs <= $fetch->money){
- if ($bf->fmjstock < $amount){
- echo " <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center><font color=red>There isn't enough FMJ in stock for you to buy that amount!</td></tr></table><br>";
- }elseif ($amount <= $bf->fmjstock){
- mysql_query("UPDATE users SET money=money-$costs WHERE username='$username'");
- mysql_query("UPDATE users SET FMJ=FMJ+$amount WHERE username='$username'");
- mysql_query("UPDATE bf SET fmjstock=fmjstock-$amount WHERE location='$fetch->location'");
- mysql_query("UPDATE bf SET profit=profit+$cost WHERE location='$fetch->location'");
- mysql_query("UPDATE users SET money=money+$costs WHERE username='$bf->owner'");
- echo" <table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0>
- <tr><td class=notice align=center><center><font color=green>You've bought ".makecomma($amount)." FMJ for £".makecomma($costs)."!</td></tr></table><br>";
- }}}}}
- ?>
- <?php if($bf->owner == "0"){ echo "<link href='style.css' rel='stylesheet' type='text/css'><table border=0 bordercolor=black align=center cellpadding=2 cellspacing=0><tr><td class=notice align=center><center>This bullet factory has no owner.<br>
- The price to buy this factory is £25,000,000.<br>
- <a href=?buyfactory=yes>Buy Bullet Factory</a></td></tr></table><br>";exit; } ?>
- <br>
- <form action='' method='post'>
- <input type="hidden" name="type" id="select" value="0">
- <table width="400" align="center" cellspacing="0" class="table">
- <tr class="header"><td colspan="2">Bullet Factory - Owner: <?php if($bf->owner == "0"){ echo "No Owner"; }else{ echo "Owned by <a href='profile.php?viewuser=$bf->owner'>$bf->owner</a>"; } ?></td></tr>
- <?php if($bf->producing == "yes"){ ?>
- <tr class="subhead"><td colspan="2" align="center">The stock will update in: <?php echo"".maketime($finds_status->bfstocktime).""; ?></td></tr>
- <? }else{ ?>
- <tr class="subhead"><td colspan="2" align="center">This bullet factory is currently not producing.</td></tr>
- <? } ?>
- <tr><td height="10"> </td></tr>
- <tr><td width='50%' align='center'><div id='1' value='1' class='action select' onclick='SelectOption(this.id, this.className);'><img src='images/items/jhp.png'><br>Jacketed Hollow Point<br>Stock: <?php echo "".number_format($bf->jhpstock).""; ?><br>Cost: <?php echo "£".number_format($bf->jhpprice).""; ?> / per bullet</div></td>
- <td width='50%' align='center'><div id='2' value='2' class='action select' onclick='SelectOption(this.id, this.className);'><img src='images/items/fmj.png'><br>Full Metal Jacketed<br>Stock: <?php echo "".number_format($bf->fmjstock).""; ?><br>Cost: <?php echo "£".number_format($bf->fmjprice).""; ?> / per bullet</div></td></tr>
- <tr><td height="10"> </td></tr>
- <?php if($username == $bf->owner){ ?>
- <tr><td class=notice colspan='5' align=center><center><font color=red>You cannot buy from your own Bullet Factory!</td></tr>
- <? }else{ ?>
- <tr><td align='center' colspan='2'>Bullets: <input type="text" name="amount" class="textbox" id="bullets" autocomplete="off" class="input"></td></tr>
- <tr><td align='center' colspan='2'><input type='submit' name='submit' class='button' value='Purchase'></td></tr>
- </table>
- <? } ?>
- </form>
- <table align="center">
- <tr>
- <td>
- <table align="center" cellspacing="0" class="table">
- <tr>
- <td width="25" align="right"><img src='/images/items/jhp.png' width="25"></td>
- <td>You have <?php echo "".number_format($fetch->JHP).""; ?> JHP!</td>
- </tr>
- </table>
- </td>
- <td>
- <table align="center" cellspacing="0" class="table">
- <tr>
- <td width="25" align="right"><img src='/images/items/fmj.png' width="25"></td>
- <td>You have <?php echo "".number_format($fetch->FMJ).""; ?> FMJ!</td>
- </tr>
- </table>
- </td>
- <td>
- <table align="center" cellspacing="0" class="table">
- <tr>
- <td width="25" align="right"><img src='/images/items/gbullet.png' width="25"></td>
- <td>You have <?php echo "".number_format($fetch->GoldenBullet).""; ?> Golden Bullets!</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement