Jump to content

Add a new Auction Item - Cant Figure Out How To Place the Script -


Recommended Posts

Well here I am again :)

 

I'm having an easy to solve hopefully problem.

 

I have a website and It's a game. Currently, only the Bullet Factory can be auctioned, but now I'm adding a feature where the BlackJack table can be auctioned too.

 

Everything was going great until I found this ..

 

			if($by == $cookieusername){
				mysql_query("UPDATE `users` SET `geld`='$geldbij' WHERE `username`='$cookieusername'");
				mysql_query("UPDATE `users` SET `geld`='$geldaf' WHERE `username`='$who2'");
				mysql_query("UPDATE `factory` SET `owner`='$who2' WHERE `state`='$country'");

				mysql_query("DELETE FROM `auctions` WHERE `id`='$accept' LIMIT 1");
				mysql_query("DELETE FROM `auctions_data` WHERE `itemid`='$accept'");
				$melding = "Your $what has been deleted from the auctions list!";
			} else {
				$melding = "This username is not yours!";
			}
		}
}
?>

 

Now, as you can see, the Bullet Factory is in there (factory). I need to add the BlackJack table in there as well, to get it to work. But I really don't know how to, without making a mess. (Script Bug)

 

I tried adding

mysql_query("UPDATE `blackjack` SET `owner`='$who2' WHERE `state`='$country'");

 

Under

mysql_query("UPDATE `factory` SET `owner`='$who2' WHERE `state`='$country'");

 

but it didn't work.

 

Help would be appreciated.

 

Thanks,

FuZzI

I have a Auction section where people can Auction their BulletFactory. In the game, there is also a BlackJack section where people owns it.

 

I've decided that I wanted so people can also auction the BlackJack and not only the BulletFactory.

 

In my database, I have a table called 'factory' which is for the BulletFactory and one for the BlackJack called 'blackjack'.

 

2 of them has the same Owner Options, except BlackJack was missing the auction option.

 

bullets.php (bullet factory)

<?
$give2 = $_POST['give2'];
if($give2) {
		$lijstGebruikers = "SELECT * FROM users WHERE username='$give2'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		if (mysql_num_rows($resultLijstGebruikers) == 1) {
	$result = mysql_query("   
				UPDATE factory  																				
				SET `owner` = '$give2'																			
				WHERE `owner` = '$cookieusername' AND `state` = '$locatie'
				");  
	if ($result) {
	$melding = "The Bullet Factory has successfully been transfered!";
	} else {
	$melding = "The Bullet Factory transaction was unsuccessful. Please try again.";
	}
	} else {
	$melding = "The user whom you are trying to give the Bullet Factory to does not exist!";
	}
	}

			$what = $_POST['what'];
			if ($what) {

				if ($what == 1) {
				$time_making = strtotime( "+59 minutes" );
				$number_of_bullets = 500;
				$price_make = ($number_of_bullets * 50);
				if (($geld - $price_make) < 1) {
					$melding = "You do not have enough money to make 500 bullets!";
				} else {
				$geld = ($geld - $price_make);
				$result = mysql_query("   
				UPDATE users  																				
				SET `geld` = '$geld'																			
				WHERE `id` = '$userid'
				");  
				if ($result) {
				$melding = "Succes";  
				$result = mysql_query("   
				UPDATE factory  																				
				SET `stamp` = '$time_making'																			
				WHERE `owner` = '$cookieusername'
				");  
				if ($result) {
				 $bullets_make = ($bullets_factory + $number_of_bullets);
				 $result = mysql_query("   
					UPDATE factory  																				
					SET `bullets` = '$bullets_make'																			
					WHERE `owner` = '$cookieusername'
				");  
				if ($result) {

				 $melding = "You have successfully created $number_of_bullets bullets! You're factory now has $bullets_make bullets now!";      
				} else {
					$melding = "You're bullet factory could not be updated! Please try again.";      
				}    

				} else {
					$melding = "The stamp could not be updated!";      
				}    


				} else {
					$melding = "The money could not be updated!";      
				}        

				}
				}
				if ($what == 2) {
				$time_making = strtotime( "+35 minutes" );
				$number_of_bullets = 250;
				$price_make = ($number_of_bullets * 50);
				if (($geld - $price_make) < 1) {
					$melding = "You do not have enough money to make 500 bullets!";
				} else {
				$geld = ($geld - $price_make);
				$result = mysql_query("   
				UPDATE users  																				
				SET `geld` = '$geld'																			
				WHERE `id` = '$userid'
				");  
				if ($result) {
				$melding = "Succes";  
				$result = mysql_query("   
				UPDATE factory  																				
				SET `stamp` = '$time_making'																			
				WHERE `owner` = '$cookieusername'
				");  
				if ($result) {
				 $bullets_make = ($bullets_factory + $number_of_bullets);
				 $result = mysql_query("   
					UPDATE factory  																				
					SET `bullets` = '$bullets_make'																			
					WHERE `owner` = '$cookieusername'
				");  
				if ($result) {

				 $melding = "You successfully produced $number_of_bullets bullets. You're factory now has $bullets_make bullets!";      
				} else {
					$melding = "The bullets could not be updated!";      
				}    

				} else {
					$melding = "The stamp could not be updated!";      
				}    


				} else {
					$melding = "The money could not be updated!";      
				}        

				}

				}
				if ($what == 3) {
				$time_making = strtotime( "+15 minutes" );
				$number_of_bullets = 100;
				$price_make = ($number_of_bullets * 50);
				if (($geld - $price_make) < 1) {
					$melding = "You do not have enough money to make 500 bullets!";
				} else {
				$geld = ($geld - $price_make);
				$result = mysql_query("   
				UPDATE users  																				
				SET `geld` = '$geld'																			
				WHERE `id` = '$userid'
				");  
				if ($result) {
				$melding = "Succes";  
				$result = mysql_query("   
				UPDATE factory  																				
				SET `stamp` = '$time_making'																			
				WHERE `owner` = '$cookieusername'
				");  
				if ($result) {
				 $bullets_make = ($bullets_factory + $number_of_bullets);
				 $result = mysql_query("   
					UPDATE factory  																				
					SET `bullets` = '$bullets_make'																			
					WHERE `owner` = '$cookieusername'
				");  
				if ($result) {

				 $melding = "You successfully produced $number_of_bullets bullets! You're factory now has $bullets_make bullets!";      
				} else {
					$melding = "The bullets could not be updated!";      
				}    

				} else {
					$melding = "The stamp could not be updated!";      
				}    


				} else {
					$melding = "The money could not be updated!";      
				}        



				}

				}

			}



			$producing3 = $_POST['producing3'];
			if ($producing3 == 1)	{  
				$melding = $producing3;
				$result = mysql_query("   
				UPDATE factory  																				
				SET `producing` = '1'																			
				WHERE `owner` = '$cookieusername'
				");  
				if ($result) {
				$melding = "Success!";   
				} else {
					$melding = "Unsuccessful.";      
				}           																						
			}
			$producing3 = $_POST['producing3'];
			if ($producing3 == 2)	{  
				$melding = $producing3;
				$result = mysql_query("   
				UPDATE factory  																				
				SET `producing` = '0'																			
				WHERE `owner` = '$cookieusername'
				");  
				if ($result) {
				$melding = "Success!";   
				} else {
					$melding = "Unsuccessful.";      
				}           																						
			}
		$edit_price = $_POST['edit_price'];
		if ($edit_price) {
			$result = mysql_query("
			UPDATE factory  																				
			SET `price` = '$edit_price'																			
			WHERE `owner` = '$cookieusername'
			");  
			if ($result) {
				$melding = "Success!";   
				} else {
					$melding = "Unsuccessful.";      
				}           

		}

		$buy = $_POST['buy'];
			if($buy) {
				$buy = round($buy);
				if ($buy < 0) {
				} else {
				if ($locatie == $state_factory) {
					if (($geld - ($buy * $prijs_factory)) < 0) {
						$melding = "You don't have enough money for this transaction!";
					} else {
					if (($bullets_factory - $buy) < 0) {
						$melding = "There are not enough bullets!";
					} else {
						$lijstGebruikers = "SELECT * FROM users WHERE username='$owner_factory'";
						$resultLijstGebruikers = mysql_query($lijstGebruikers);
						while ($row = mysql_fetch_array($resultLijstGebruikers)) {
						$id3 = $row[id];
						$geld2 = $row[geld];
					}
						$buy2 = ($buy * $prijs_factory);
						$geld3 = ($buy2 + $geld2);
						$result = mysql_query("
								UPDATE users
							SET `geld` = '$geld3'  
							WHERE `id` = $id3
							");
							if ($result) {
								$melding = "$owner_factory accepted your offer";
						$geld = ($geld - $buy2);
						UpdateTable(users,geld,$geld,id,$userid);
						$kills = ($buy + $kills);
						mysql_query("
								UPDATE users
							SET `kills` = '$kills'  
							WHERE `id` = $userid
							");
						$bullets_factory = ($bullets_factory - $buy);
						echo $bullets_factory;
						$blaat = mysql_query("
								UPDATE factory
							SET `bullets` = '$bullets_factory'  
							WHERE `owner` = '$owner_factory'
							");
							if ($blaat) {
								$melding = $melding . " <br/>You bought $buy rounds from $owner_factory.";
							} else {

							}
					} else {
						$melding = "$owner_factory didn't accept the offer. You didn't obtain the bullets.";

					}
						}
					}
				} else {
					$melding = "You need to be in $state_factory to buy the bullets!";
				}
			}	
		}
if($_POST['money'] && $_POST['reason']){
$money = $_POST['money'];
$reason = $_POST['reason'];
$lijstGebruikers = "SELECT * FROM auctions WHERE `country`='$locatie' AND `what`='Bulletfactory' ORDER BY id DESC";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
$num_factory = mysql_num_rows($resultLijstGebruikers);
if($num_factory == 0){
	$opdracht = "insert INTO `auctions` values('0','Bulletfactory','$cookieusername','$locatie','$money','$reason','$datem')";
	$resultaat = mysql_query($opdracht);
	$melding = "You have added your Bullet Factory on the auction list for $$money";
} else {
	$melding = "Your Bullet Factory has already added to the auction list!";
}
}
?>

<?
#################################################
// bezoekers statistieken
$pagename = "Bullet Factory";
include("./counter.inc.php");
?>
<?	
include "header.php";
include "_menu.php";
include "_bullets.php";
if ($melding) {
	echo "<div class=\"window\">";
	echo "<div class=\"mainTitle\">Bullet Factory</div>";
	echo "<div class=\"mainText\">";
	echo "$melding";
	echo "</div></div>";
} else {	
?>
<div class="window">
<div class="mainTitle">Bullet Factory</div>
<div class="mainText">
<?
if ($barsten == 1) {
	echo "There is no bullet factory in $locatie";
} else {
	$bullets_factory2 = number_format($bullets_factory);
	$prijs_factory2 = number_format($prijs_factory);
echo "This Bullet Factory is owned by $owner_factory and has $bullets_factory2 bullets at a price of $prijs_factory2 per piece. <br />";
if ($producing_factory == 1) {
	echo "Status: Not Producing";
} else {
	echo "Status: Producing";
echo "<br />";

?>
<table border=1>
	<form method=post>
	<tr><td>Amount<BR><img src="images/weapons/bullet.png"></td><td><input type=text name=buy size=13></td></tr>
	<tr><td></td><td align=right><input type=submit value="Buy"></td></tr>
	</form>
	<?
}
}
?>
</table>
</div>
</div>
<?
if ($owner_factory == $cookieusername) {
?>
<div class="window">
<div class="mainTitle">Manage Bullet Factory</div>
<div class="mainText">
<?
echo "<form method=\"post\">";
if ($producing_factory == 1) {
echo "<input type=hidden name=producing3 value=2>";
echo "<input type=submit value=\"Set Factory as Producing\">";
} else {
echo "<input type=hidden name=producing3 value=1>";
echo "<input type=submit value=\"Set Factory as Not Producing\">";
}
echo "</form>";
echo "<br />";
echo "<table border=1><tr><td>";
echo "<font color=grey>Edit Price per Bullet (Note: Producing bullets cost's $50/each)</font>";
echo "</td><td><form method=post><input type=text name=edit_price></td></tr><tr><td></td><td align=right><input type=submit value=\"Set Price\"></td></tr>";
echo "";
if((time() < $datum_factory) ) {
				echo "You are now producing bullets, time left: " . date( "i:s", $datum_factory - time() );
				echo "</td></tr>";
			} else {
echo "<tr><td background=\"images/bgMainTitle.jpg\"><b>Make the bullets</b></td></tr>";
echo "</td><td background=\"images/bgMainTitle.jpg\"><b>select</b></td>";
echo "</tr>";
echo "<tr><td>500 bullets takes 1 hour to produce</td><td><form method=post><input type=radio name=what value=1></td></tr>";
echo "<tr><td>250 bullets takes 35 minutes to produce</td><td><input type=radio name=what value=2></td></tr>";
echo "<tr><td>100 bullets takes 15 minutes to produce</td><td><input type=radio name=what value=3></td></tr>";
echo "<tr><td></td><td align=right><input type=submit value=\"Make bullets\"></td></tr>";
echo "</form>";
}
echo "<form method=post><tr><td>Give this Bulletfactory to someone else (username)</td><td><input type=text name=give2></td></tr><tr><td></td><td align=right><input type=submit value=\"Give\"></td></tr></form>";

echo "<tr><td background=\"images/bgMainTitle.jpg\"><b>Sell this Bulletfactory</b></td></tr>";
echo "<form method=post>";
echo "<tr><td>Starting Bid:</td><td><input type=text value=0 name=money maxlength=16></td></tr>";
echo "<tr><td>Comments:</td><td><input type=text name=reason></td></tr>";
echo "<tr><td></td><td align=right><input type=submit name=add value=Add></td></tr>";
echo "</form>";

echo "</table>";

?><BR><b><font color="Red">WARNING:</font></b> If you are not active atleast once per 2 weeks, your bullet factory will be sold for $500,000 from the Bank.
</div>
</div>

<?	
}
}
include "footer.php";

?>

blackjack.php

<?

$give2 = $_POST['give2'];
if($give2) {
		$lijstGebruikers = "SELECT * FROM users WHERE username='$give2'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		if (mysql_num_rows($resultLijstGebruikers) == 1) {
	$result = mysql_query("   
				UPDATE casino  																				
				SET `owner_casino` = '$give2'																			
				WHERE `owner_casino` = '$cookieusername' AND `state_cas` = '$locatie'
				");  
	if ($result) {
	$melding = "You successfully transfered the Blackjack table!";
	} else {
	$melding = "You unsuccessfully transfered the Blackjack table!";
	}
	} else {
	$melding = "The user you are trying to transfer your Blackjack to does not exist!";
	}
	}
?>

<?
$max_bet_set=$_POST['max_bet_set'];
if ($max_bet_set) {	
mysql_query("   
UPDATE casino  																				
SET `max_bet` = '$max_bet_set'																			
WHERE `owner_casino` = '$cookieusername' AND `state_cas` = '$locatie'
"); 
echo "<META http-equiv=refresh content=\"0;url=blackjack.php\">";	
}
$lijstGebruikers = "SELECT * FROM blackjack WHERE better='$userid' AND state='$locatie'";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
if (mysql_num_rows($resultLijstGebruikers) == 1) {
$bet2 = 1;
$lijstGebruikers = "SELECT * FROM blackjack WHERE better='$userid'";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
while ($row = mysql_fetch_array($resultLijstGebruikers)) {
$bet_ammount = $row[bet];
$state_black = $row[state];
$card1 = $row[card1];
$your_cards = explode("|",$card1); 
$card2 = $row[card2];
$dealer_cards = explode("|",$card2);
}
} else {
$bet2 = 0;
}

$bet = $_POST['bet'];
if ($bet) {
/*
*******************
* Een paar Checks *
*******************
*/
if ($bet < 0) {
} else {
if ($bet > $max_bet) {
	$melding = "You're bet is higher than the owner's maximum bet!";
} else {
if (($geld - $bet) < 0) {
	$melding = "You don't Have enough money!";
} else {
/*
*******************************
* Pak kaarten voor de speler  *
*******************************
*/
$rand_card1 = rand(1,52);
$value1 = GetCard($rand_card1);
$rand_card2 = rand(1,52);
while ($rand_card2 == $rand_card1) {
$rand_card2 = rand(1,52);	
}
$value2 = GetCard($rand_card2);
/*
*******************************
* Pak kaarten voor de dealer  *
*******************************
*/
$rand_card1_dealer = rand(1,52);
$value1_dealer = GetCard($rand_card1_dealer);
$value1_dealer = $value;
$rand_card2_dealer = rand(1,52);
while ($rand_card2_dealer == $rand_card1_dealer) {
$rand_card2_dealer = rand(1,52);	
}
$value2_dealer = GetCard($rand_card2_dealer);
/*
************************************************************************
* Update het geld van jouw min je $bet en update dealer geld plus $bet *
************************************************************************
*/
$money_me = Select1(users,username,$owner_casino);
$money_me = ($money_me + $bet);
UpdateTable(users,geld,$money_me,username,$owner_casino);
$geld = ($geld - $bet);
UpdateTable(users,geld,$geld,username,$cookieusername);
/*
*************************************
* Alles in tabel 'BlackJack zetten' *
*************************************
*/
$rand_card1 = $rand_card1 . "|" . $rand_card2;
$rand_card1_dealer = $rand_card1_dealer . "|" . $rand_card2_dealer;
$opdracht = "insert INTO blackjack values('0','$userid','$bet','$locatie','$rand_card1','$rand_card1_dealer')";
$resultaat = mysql_query($opdracht);
if ($resultaat) {
// Laat de kaarten zien...
} else {
$melding = "Error: Please try again!";	
}
}
}
}
}
/*
*******************************
* Kijk of er een bet bestaat! *
*******************************
*/
$lijstGebruikers = "SELECT * FROM blackjack WHERE better='$userid' AND state='$locatie'";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
if (mysql_num_rows($resultLijstGebruikers) == 1) {
$bet2 = 1; 
$lijstGebruikers = "SELECT * FROM blackjack WHERE better='$userid'";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
while ($row = mysql_fetch_array($resultLijstGebruikers)) {
$bet_ammount = $row[bet];
$state_black = $row[state];
$card1 = $row[card1];
$your_cards = explode("|",$card1); 
$card2 = $row[card2];
$dealer_cards = explode("|",$card2);
}
} else {
$bet2 = 0;
}
/*
***************************************
* Einde | Kijk of er een bet bestaat! *
***************************************
*/
$hit = $_POST['hit'];
if ($hit) {
	/*
	*************************************
	* Tel de waarde van jouw kaarten    *
	*************************************
	*/
	$thing = 0;	
	$random_card_hit = rand(1,52);
	$value_new_card = GetCard($random_card_hit);
	$i2 = 0;
	$value_your_cards = 0;
	$bamsa2 = sizeof($your_cards);
	while ($bamsa2 != $i2) {
	$value_your_cards = ($value_your_cards + GetCard($your_cards[$i2]));			
	$i2++;	
	}
	/*
	*************************************
	* Is je waarde hoger dan 21?        *
	*************************************
	*/
	if (($value_your_cards + $value_new_card) > 21) {
	$melding = "You busted with a  ";	
	if ($random_card_hit < 10) {
	$melding = $melding . "<img src=images/cards/0" . $random_card_hit . ".gif>";	
	} else {
	$melding = $melding . "<img src=images/cards/". $random_card_hit . ".gif>";
	}
	$sql2 = "DELETE FROM blackjack WHERE better='$userid'";
	mysql_query($sql2);
	} else {
	$ace = 0;
	$your_shit = 0;
	$bamsa3 = sizeof($your_cards);
	while ($bamsa3 != $your_shit) {
	if (($your_cards[$your_shit] > 32) AND ($your_cards[$your_shit] < 37)) {
	$ace++;
	}
	$your_shit++;	
	}
	if ($ace == 0) {
	} else {
		if (($value_your_cards + 10) > 21) {
		} else {
		$value_your_cards = ($value_your_cards + 10);
		}	
	}
	/*
	***********************
	* Dealer Card trekken *
	***********************
	*/
	$ammount_dealer = 0;
	$i = 0;
	$ace2 = 0;
	$bamsa = sizeof($dealer_cards);
	while ($bamsa != $i) {
		if (($dealer_cards[$i] >= 33) AND ($dealer_cards[$i] <= 36)) {
		$ace2++;
		}
		$ammount_dealer = ($ammount_dealer + GetCard($dealer_cards[$i]));
		$i++;
	}
	if ($ace2 > 0) {
	} else {
		if (($ammount_dealer + 10) > 21) {
		} else {
		$ammount_dealer = ($ammount_dealer + 10);
		}	
	}
	/*
	*******************************
	* value berekenn dealer klaar * 
	*******************************
	*/	
	$card_dealer_rand_3 = rand(1,52);
	$value_dealer_card2 = GetCard($card_dealer_rand_3);
	//echo "$value_dealer_card2";
	if (($value_dealer_card2 + $ammount_dealer) > 21) {
	$card_dealer_rand_3 = 0;
	} else {

	}
	$q = 0;
	$bamsa2 = sizeof($your_cards);
	while ($bamsa2 != $q) {
		if ($q == 0) {
		$insert_your = $your_cards[$q];	
		} else {
		$insert_your = $insert_your . "|" . $your_cards[$q];	
		}
	$q++;					
	}
		$w = 0;
		$bamsa = sizeof($dealer_cards);
		while ($bamsa != $w) {
		if ($w == 0) {
		$insert_dealer = $dealer_cards[$w];	
		} else {
		$insert_dealer = $insert_dealer . "|" . $dealer_cards[$w];
		}	
		$w++;
		}
		$insert_dealer = $insert_dealer . "|" . $card_dealer_rand_3;
		$insert_your = $insert_your . "|" . $random_card_hit;
	mysql_query("   
		UPDATE blackjack
		SET `card1` = '$insert_your'																			
		WHERE `better` = '$userid'
		"); 
		if ($card_dealer_rand_3 == 0) {
			echo "<META http-equiv=refresh content=\"0;url=blackjack.php\">";
		} else {
		mysql_query("   
		UPDATE blackjack
		SET `card2` = '$insert_dealer'																			
		WHERE `better` = '$userid'
		"); 
		echo "<META http-equiv=refresh content=\"0;url=blackjack.php\">";
	}

}
}
$stand = $_POST['stand'];
if ($stand) {
	$ammount_dealer = 0;
	$i = 0;
	$ace2 = 0;
	$bamsa = sizeof($dealer_cards);
	while ($bamsa != $i) {
		if (($dealer_cards[$i] >= 33) AND ($dealer_cards[$i] <= 36)) {
		$ace2++;
		}
		$ammount_dealer = ($ammount_dealer + GetCard($dealer_cards[$i]));
		$i++;
	}
	if ($ace2 > 1) {
	} else {
		if (($ammount_dealer + 10) > 21) {
		} else {
		$ammount_dealer = ($ammount_dealer + 10);
		}	
	}



	$card3 = rand(1,52);
	$value2 = GetCard($card3);
	if (($ammount_dealer + $value2) < 22) {
		$ammount_dealer = ($ammount_dealer + $value2);
	}
	$i2 = 0;
	$value_your_cards = 0;
	$bamsa2 = sizeof($your_cards);
	while ($bamsa2 != $i2) {
	$value_your_cards = ($value_your_cards + GetCard($your_cards[$i2]));
	if (GetCard($your_cards[$i2]) == 1) {
	echo "<br />Your Cards = ACE";	
	} else {
	echo "<br />Your Cards=" . GetCard($your_cards[$i2]);		
	}
	$i2++;	
	}
	$ace = 0;
	$your_shit = 0;
	$bamsa3 = sizeof($your_cards);
	while ($bamsa3 != $your_shit) {
	if (($your_cards[$your_shit] > 32) AND ($your_cards[$your_shit] < 37)) {
	$ace++;
	}
	$your_shit++;	
	}
	if ($ace == 0) {
	} else {
		if (($value_your_cards + 10) > 21) {
		} else {
		$value_your_cards = ($value_your_cards + 10);
		}	
	}
	if ($value_your_cards > $ammount_dealer) {
		$melding = "You had <b>$value_your_cards</b> and the dealer had <b>$ammount_dealer</b> You won $<font color=green>" . number_format($bet_ammount) . "</font>";
		$money_me = Select1(users,username,$owner_casino);
		if (($money_me - ($bet_ammount * 2)) < 0) {
		$melding = "<font color=gold>You won all the owners money you now own the blackjack table!</font>";
		mysql_query("   
			UPDATE casino  																				
			SET `owner_casino` = '$cookieusername'																			
			WHERE `owner_casino` = '$owner_casino' AND `state_cas` = '$locatie'
			"); 
		} else {
		$money_me = ($money_me - ($bet_ammount * 2));
		mysql_query("   
			UPDATE users  																				
			SET `geld` = '$money_me'																			
			WHERE `username` = '$owner_casino'
			"); 
		$geld = ($geld + ($bet_ammount * 2));
		UpdateTable(users,geld,$geld,id,$userid); 
		}
	} elseif ($value_your_cards == $ammount_dealer) {
	$melding = "You both had the same, both <b>$value_your_cards</b>";
	$money_me = Select1(users,username,$owner_casino);
	$money_me = ($money_me - $bet_ammoun);
	UpdateTable(users,geld,$money_me,username,$owner_casino);
	$geld = ($geld + $bet_ammount);
	UpdateTable(users,geld,$geld,username,$cookieusername); 	
	} else {
	$melding = "You had <b>$value_your_cards</b> and the dealer had <b>$ammount_dealer</b>, <font color=red>you lost " . number_format($bet_ammount) . "</font>";	
	}
	$sql2 = "DELETE FROM blackjack WHERE better='$userid'";
	mysql_query($sql2);
}
if($_POST['money'] && $_POST['reason']){
$money = $_POST['money'];
$reason = $_POST['reason'];
$lijstGebruikers = "SELECT * FROM auctions WHERE `country`='$locatie' AND `what`='Blackjack' ORDER BY id DESC";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
$num_factory = mysql_num_rows($resultLijstGebruikers);
if($num_factory == 0){
	$opdracht = "insert INTO `auctions` values('0','BlackJack Table','$cookieusername','$locatie','$money','$reason','$datem')";
	$resultaat = mysql_query($opdracht);
	$melding = "You have added your BlackJack Table on the auction list for $$money";
} else {
	$melding = "Your BlackJack Table has already been added to the auction list!";
}
}
?>
<?

// bezoekers statistieken
$pagename = "BlackJack";
include("./counter.inc.php");
?>
<?	
include "header.php";
include "_menu.php";
include "_blackjack.php";
if ($no_casino == 1) {
	$melding = "There is no casino in this state";
}
if ($melding) {
	echo "<div class=\"window\">";
	echo "<div class=\"mainTitle\">BlackJack</div>";
	echo "<div class=\"mainText\">";
	echo "$melding";
	echo "</div></div>";
} else {

?>
<div class="window">
<div class="mainTitle">
<?PHP
echo "$owner_casino's BlackJack Table in $locatie";
?>
</div>
<div class="mainText">


<?
echo "BlackJack is a game where you have to be the closes to 21, the closes to 21 between you and the dealer wins. If you get higher than 21, you lose.<table border=1><tr><td background=\"images/bgMainTitle.jpg\"><b>Expression</b></td><td background=\"images/bgMainTitle.jpg\"><b>Meaning</b></td></tr><tr><td>Stand</td><td>Keep the cards you currently have.</td></tr><tr><td>Hit</td><td>Get another card.</td></tr><br /></table><br />This Blackjack table is owned by $owner_casino and has a max-bet of $" . number_format($max_bet);
if ($bet2 == 1) {
	echo "<table border=1>";
	echo "<tr><td>Dealer's Cards</td><td>Dealer's Down Card</tD>";
	echo "</tr>";
	echo "<tr>";

	$dealer_shit = 0;
	$value_dealer_cards = 0;
	$bamsa = sizeof($dealer_cards);
	while ($bamsa != $dealer_shit) {	
	if ($dealer_shit < 1) {
	if ($dealer_cards[$dealer_shit] < 10) {
	echo "<td><img src=images/cards/0" . $dealer_cards[$dealer_shit] . ".gif></td>";	
	} else {
	echo "<td><img src=images/cards/". $dealer_cards[$dealer_shit] . ".gif></td>";
	}

	} else {
		if ($cookieusername == "test") {
		if ($dealer_cards[$dealer_shit] < 10) {
	echo "<td><img src=images/cards/0" . $dealer_cards[$dealer_shit] . ".gif></td>";	
	} else {
	echo "<td><img src=images/cards/". $dealer_cards[$dealer_shit] . ".gif></td>";
	}	
		} else {
	echo "<td><img src=images/cards/j.gif></td>";		
	}
	}
	$value_dealer_cards = ($value_dealer_cards + GetCard($dealer_cards[$dealer_shit]));
	$dealer_shit++;	
	}
	echo "</td></tr><tr><td>Your Cards</td></tr><tr>";
	$your_shit = 0;
	$value_your_cards = 0;
	$bamsa2 = sizeof($your_cards);
	while ($bamsa2 != $your_shit) {
	if ($your_cards[$your_shit] < 10) {
	echo "<td><img src=images/cards/0" . $your_cards[$your_shit] . ".gif></td>";	
	} else {
	echo "<td><img src=images/cards/". $your_cards[$your_shit] . ".gif></td>";
	}
	$value_your_cards = ($value_your_cards + GetCard($your_cards[$your_shit]));			
	$your_shit++;	
	}


	echo "</tr>";
	echo "</table><table>";
	echo "<tr><td><form method=post><input type=hidden name=hit value=1><input type=submit value=\"Hit\"></form></td><td><form method=post><input type=hidden name=stand value=1><input type=submit value=\"Stand\"></form></td></tr>";
	echo "</table>";

} else {
	echo "<form method=post>";
	echo "<table border=1><tr><td>";
	echo "Bet</td><Td><input type=text name=bet></td></tr>";
	echo "<tr><td></td><Td align=right><input type=submit value=\"Bet at this table\"></td></tr></table>";
	echo "</form>";
}


?>
</div>
</div>
<!-- ONLY OWNERS CAN VIEW BELOW -->
<?
if (strtolower($owner_casino) == strtolower($cookieusername)) {
	echo "<div class=\"window\">";
	echo "<div class=\"mainTitle\">Manage BlackJack</div>";
	echo "<div class=\"mainText\">";
	echo "<table border=1><tr><td>Change max-bet</td><td><form method=post><input type=text name=max_bet_set></td></tr><tr><td></tD><td><input type=submit value=\"Set Max Bet\"></form>";
	echo "<form method=post><tr><td>Give the BlackJack to someone else(name)</td><td><input type=text name=give2></td></tr><tr><td></td><td align=right><input type=submit value=\"Give\"></td></tr></form></table>";
	echo "</div></div>";

	echo "<div class=\"window\">";
	echo "<div class=\"mainTitle\">Auction This BlackJack Table (DO NOT AUCTION, BETA VERSION)</div>";
	echo "<div class=\"mainText\">";
        echo "<form method=post>";
        echo "<tr><td>Starting Bid:   $</td><td><input type=text value=OnlyNumbers name=money maxlength=16></td></tr><BR><BR>";
        echo "<tr><td>Comments:      </td><td><input type=text name=reason></td></tr><BR><BR>";
        echo "<tr><td></td><td align=right><input type=submit name=add value=Add></td></tr>";
        echo "</form>";
        echo "</div></div>";
}


}
include "footer.php";
?>

 

Finally, the auctions.php

<?php

if($_POST['money']){
$detail = $_GET['detail'];
$money = $_POST['money'];
$opdracht = "insert INTO auctions_data values('0','$detail','$cookieusername','$money','$datem')";
$resultaat = mysql_query($opdracht);
}

if($_GET['remove']){
$remove = $_GET['remove'];
$lijstGebruikers = "SELECT * FROM auctions_data WHERE `id`='$remove'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$id = $row[id];
			$who = $row[who];
			$money = $row[money];
			$datem = $row[datem];
			if($who == $cookieusername){
				mysql_query("DELETE FROM `auctions_data` WHERE `id`='$remove' LIMIT 1");
			} else {
				$melding = "This username is not yours!";
			}
		}
}
if($_GET['remove1']){
$remove = $_GET['remove1'];
$lijstGebruikers = "SELECT * FROM auctions WHERE `id`='$remove'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$id = $row[id];
			$by = $row[by];
			$what = $row[what];
			$money = $row[money];
			$datem = $row[datem];
			if($by == $cookieusername){
				mysql_query("DELETE FROM `auctions` WHERE `id`='$remove' LIMIT 1");
				mysql_query("DELETE FROM `auctions_data` WHERE `itemid`='$remove'");
				$melding = "Your $what has been deleted from the auctions list!";
			} else {
				$melding = "This username is not yours!";
			}
		}
}
if($_GET['accept']){
$accept = $_GET['accept'];
$accept2 = $_GET['accept2'];
$lijstGebruikers = "SELECT * FROM auctions WHERE `id`='$accept'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$id = $row[id];
			$by = $row[by];
			$what = $row[what];
			$country = $row[country];
			$money = $row[money];
			$datem = $row[datem];


$lijstGebruikers = "SELECT * FROM auctions_data WHERE `id`='$accept2'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		$adata = mysql_fetch_array($resultLijstGebruikers);
			$who2 = $adata[who];
			$money2 = $adata[money];
			$geldbij = $geld+$money2;
$lijstGebruikers = "SELECT * FROM users WHERE `username`='$who2'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		$adata = mysql_fetch_array($resultLijstGebruikers);
			$geldaf = $adata[geld]-$money2;


			if($by == $cookieusername){
				mysql_query("UPDATE `users` SET `geld`='$geldbij' WHERE `username`='$cookieusername'");
				mysql_query("UPDATE `users` SET `geld`='$geldaf' WHERE `username`='$who2'");
				mysql_query("UPDATE `factory` SET `owner`='$who2' WHERE `state`='$country'");

				mysql_query("DELETE FROM `auctions` WHERE `id`='$accept' LIMIT 1");
				mysql_query("DELETE FROM `auctions_data` WHERE `itemid`='$accept'");
				$melding = "Your $what has been deleted from the auctions list!";
			} else {
				$melding = "This username is not yours!";
			}
		}
}
?>
<?

// bezoekers statistieken
$pagename = "Hitlist";
include("./counter.inc.php");
?>
<?	
include "header2.php";
include "_menu.php";
include "_home.php";
include "_auctions.php";
if ($melding) {
	echo "<div class=\"window\">";
	echo "<div class=\"mainTitle\">Auctions</div>";
	echo "<div class=\"mainText\">";
	echo "$melding";
	echo "</div></div>";
} else {	
?>
<div class="window">
<div class="mainTitle">Auctions</div>
<div class="mainText">
<table border=1>
<tr><Td background="images/bgMainTitle.jpg"><b>Item</b></td><td background="images/bgMainTitle.jpg"><b>Country</b></td><td background="images/bgMainTitle.jpg"><B>Starting Bid</b></td><td background="images/bgMainTitle.jpg"><b>Seller's Comments</b></tD><td background="images/bgMainTitle.jpg"><b>Details</b></tD></tr>
<?
$lijstGebruikers = "SELECT * FROM auctions ORDER BY id DESC";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$id = $row[id];
			$target = $row[what];
			$by = $row[by];
			$payer = $row[country];
			$ammount = $row[hbid];
			$ammount = number_format($ammount);
			$reason = $row[reason];
			$reason = str_replace("<noscript>","", $reason);
			$reason = str_replace("<noscript />","", $reason);
			if($by == $cookieusername){
				echo "<tr><Td>$target</td><td>$payer</td><td>$$ammount</td><td>$reason</tD><td><a href=\"auctions.php?detail=$id\">Details</tD><td><a href=\"auctions.php?remove1=$id\">Remove</tD></tr>";
			} else {
				echo "<tr><Td>$target</td><td>$payer</td><td>$$ammount</td><td>$reason</tD><td><a href=\"auctions.php?detail=$id\">Details</tD></tr>";

			}
		}




?>	
</table>
</div>
</div>
<?
if($_GET['detail']){
			$detail = $_GET['detail'];
$lijstGebruikers = "SELECT * FROM auctions WHERE `id`='$detail' ORDER BY id DESC";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$id = $row[id];
			$by = $row[by];
			$target = $row[what];
			$payer = $row[country];
			$ammount = $row[hbid];
			$date = $row[datem];
			$ammount = number_format($ammount);
			$reason = $row[reason];
			$reason = str_replace("<noscript>","", $reason);
			$reason = str_replace("<noscript />","", $reason);
?>
<div class="window">
<div class="mainTitle">Item Details</div>
<div class="mainText">
<table border=1>
<tr><Td background="images/bgMainTitle.jpg"><b>Item Info</b></td><Td background="images/bgMainTitle.jpg"></td></tr>
<tr><td>Item:</td><td><?echo "$target"; ?></td></tr>
<tr><td>Country:</td><td><?echo "$payer"; ?></td></tr>
<tr><td>Seller:</td><td><a href="viewprofile.php?viewprofile=<?echo "$by"; ?>"><?echo "$by"; ?></a></td></tr>
<tr><td>Start auction:</td><td><?echo "$date"; ?></td></tr>
<tr><td>Start bidding at:</td><td>$<?echo "$ammount"; ?></td></tr>
<tr><td>Comments:</td><td><?echo "$reason"; ?></td></tr>
</table>
</div>
</div>

<div class="window">
<div class="mainTitle">Bids by another players</div>
<div class="mainText">
<table border=1>
<tr><Td background="images/bgMainTitle.jpg"><b>Who:</b></td><Td background="images/bgMainTitle.jpg"><b>Bid</b></td><Td background="images/bgMainTitle.jpg"><b>Date</b></td><Td background="images/bgMainTitle.jpg"><b>Remove Bid</b></td></tr>


<?
$lijstGebruikers = "SELECT * FROM auctions WHERE `id`='$detail' ORDER BY id DESC";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		$check = mysql_fetch_array($resultLijstGebruikers);
			if($check[by] == $cookieusername){
				$accept = 1;
			}



$lijstGebruikers = "SELECT * FROM auctions_data WHERE `itemid`='$detail' ORDER BY money DESC";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$id = $row[id];
			$who = $row[who];
			$money = $row[money];
			$datem = $row[datem];

if($who == $cookieusername){
?>
<tr><td><?echo "$who"; ?></td><td>$<?echo "$money"; ?></td><td><?echo "$datem"; ?></td><td><a href="?remove=<? echo "$id"; ?>">Remove Bid</a></td>
<?
if($accept == 1){
?>
<td><a href='auctions.php?accept=<? echo "$check[id]"; ?>&accept2=<? echo "$id"; ?>'>Accept Bid</a></td>
<?
}
?></tr>
<?
} else {
?>
<tr><td><?echo "$who"; ?></td><td>$<?echo "$money"; ?></td><td><?echo "$datem"; ?></td><td></td><? echo "$accept"; ?>
<?
if($accept == 1){
?>
<td><a href='auctions.php?accept=<? echo "$check[id]"; ?>&accept2=<? echo "$id"; ?>'>Accept Bid</a></td>
<?
}
?></tr>
<?
}
}
?>
</table>
</div>
</div>

<div class="window">
<div class="mainTitle">Place Bid</div>
<div class="mainText">
<table border=1>
<tr><Td background="images/bgMainTitle.jpg"><b>Place new bid</b></td><Td background="images/bgMainTitle.jpg"></td></tr>
<form method=post>
<tr><td>Bid:</td><td>$<input type=text value=0 name=money maxlength=16></td></tr>
<tr><td></td><td><input type=submit name=add value=Add></td></tr>
</form>
</table>
</div>
</div>
<?
}

}
}
include "footer.php";
?>		

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.