Hallo, ik heb een probleem met mijn slot machine
Je kan het wel spelen, wie er aan deelneemt verliest wel zijn geld, maar de eigenaar krijgt het geld niet bij :s
Weet iemand wat er fout is? gelieve het dan te zeggen
PHP
<?php /* ------------------------- */
include("_include-config.php");
/* ------------------------- */ ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body background="#333333" text="#FFFFFF" link="#999999" vlink="#999999" alink="#999999" topmargin="0">
<?
if(isset($_GET['v']) && ($_GET['v'] == 1 || $_GET['v'] == 2 || $_GET['v'] == 3)) {
setcookie("v",$_GET['v'],time()+24*60*60*365,"/","");
$_COOKIE['v'] = $_GET['v'];
}
if($_COOKIE['v'] == '3') {
include("style3.php");
} else
if($_COOKIE['v'] == '2') {
include("style2.php");
} else
if($_COOKIE['v'] == '1') {
include("style1.php");
} else
include("style3.php");
?>
<base target="main" />
</head>
<table align=center width=100%>
<tr><td class=subTitle><b>Slot Machine</b></td></tr>
<?php
$dbres = mysql_query("SELECT * FROM `[buildings]` WHERE `type`='slot' AND `city`='{$data->land}'");
$aantal = mysql_fetch_object($dbres);
if($aantal->owner == ''){
echo "<table width=100% align=\"center\">
<tr><td class=\"mainTxt\"><center>Dit spel heeft nog geen Eigenaar!<br><br>
Zonder Eigenaar kan je niet spelen!<br><br>
Het kopen van dit spel kost <font color=red><b>100 credits</font></b>!<br><br>
Klik <font color=red><a href=\"belservice.php\"><b>hier</b></a></font> om credits via de Bel Service te kopen!<br>
Klik <font color=red><a href=\"SMSservice.php\"><b>hier</b></a></font> om credits via de SMS Service te kopen!<br><br>
Als je de 100 credits hebt moet je ze aan de Admin <font color=red><a href=\"profile.php?x=woetie\"><b>woetie</b></a></font> doneren, <br>
stuur hem dan een berichtje met <font color=red>'slot + land'</font> (land dat je wilt) en wij geven je jouw Casino dan!
</center></a></td></tr></table>";
} else {
$ownerr = ($aantal->owner == "") ? "<b><a href=\"take.php?t=slot&c={$data->land}\">Neem over!</a></b>" : "<a href=\"profile.php?x={$aantal->owner}\">$aantal->owner</a>";
$owner = ($aantal->owner == "Acid") ? "<font color=white>State Owned</font>" : "$ownerr";
?>
<center><table width="180" border="1" cellspacing="0" cellpadding="2" bordercolor="black" height="170">
<tr><td align=center background=images/maincontent_blank1.gif colspan=3><b>Slot Machine</b></td></tr>
<?PHP
if (isset($_POST['submit1'])) {
if($data->login == $owner->owner){
echo " Jij bent de eigenaar van deze Slot Machine.. Dus kan je zelf niet mee spelen!";
exit;
}
$inzet = $_POST['inzet'];
if(!preg_match('/^[0-9]{1,15}$/',$_POST['inzet']) OR $_POST['inzet'] < 0){
echo "<tr><td class=\"mainTxt\">Ongeldig bedrag geld";
echo "</font></td></tr>";
}
elseif($inzet > $data->cash){
echo "<tr><td class=\"mainTxt\">Je hebt niet genoeg geld.";
echo "</font></td></tr>";
}
elseif($inzet > $aantal->price){
echo "<tr><td class=\"mainTxt\">Je moet je aan de max. inzet houden!";
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);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
elseif($nr1 == 2 && $nr2 == 2 && $nr3 == 2){
$profit2 = round($inzet*51);
$profit1 = round($profit2-$inzet);
$profit = number_format($profit1,0);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
elseif($nr1 == 3 && $nr2 == 3 && $nr3 == 3){
$profit2 = round($inzet*36);
$profit1 = round($profit2-$inzet);
$profit = number_format($profit1,0);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
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);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
elseif($nr1 == 2 XOR $nr2 == 2 XOR $nr3 == 2){
$profit2 = round($inzet*4);
$profit1 = round($profit2-$inzet);
$profit = number_format($profit1,0);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
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);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
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);
$gewonnen = 1;
echo "<b>Gefeliciteert!</b><br>Je hebt €$profit,- gewonnen";
}
else{
$profit2 = round($inzet);
$profit1 = round(0-$inzet);
$profit = number_format($profit2,0);
$gewonnen = 0;
print"<center>je hebt €$profit,- verloren.</center>";
}
echo "</td></tr>";
mysql_query("UPDATE `[buildings]` SET `profit`=`profit`-$profit1, `bank`=`bank`-$profit1 WHERE `type`='slot' AND `city`='{$data->land}'");
//mysql_query("UPDATE `[users]` SET `cash`=`cash`-$profit1 WHERE `login`='{$aantal->owner}'");
mysql_query("UPDATE `[users]` SET `cash`=`cash`+$profit1 WHERE `login`='{$data->login}'");
if($aantal->bank <= 0 && $gewonnen == 1) {
mysql_query("UPDATE `[buildings]` SET `owner`='$data->login', `profit`='0', `bank`='250000' WHERE `city`='$data->land' AND `type`='slot'");
mysql_query("UPDATE `[users]` SET `cash`='0' WHERE `cash`<='0' ANd `login`='{$aantal->owner}'");
mysql_query("INSERT INTO `[messages]`(`time`,`IP`,`from`,`to`,`subject`,`message`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','**xtreme-worlds**','{$aantal->owner}','Slots','Helaas! {$data->login} heeft je Slots in {$data->land2} gewonnen. Je had niet genoeg geld cash staan om de winst te betalen!')");
echo "<font color=red><b>Gefeliciteert!</b><br>Je hebt ook het slot machine in $data->land2 gewonnen</font>";
$owner = $data->login;
}
}
}
$price = number_format($aantal->price,0);
?>
<tr><td class="mainTxt" colspan="3" align="center">
<FORM METHOD=post>
Inzet:<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>
Deze slotmachine heeft als owner <? echo $owner; ?>. De max. inzet is <b>$<? echo $price; ?></b>.<br>
<?php
if ($data->login == $aantal->owner){
print <<<ENDHTML
<center><table width=90%>
<tr><td align=center background=images/maincontent_blank1.gif><b>Slot Machine</b></td></tr>
<tr><td class="mainTxt">
<center>
<form method="POST" action=""><center>De winst is: <b>{$aantal->profit}</b>.<br>
Nieuwe max. inzet: <input type="text" name="newprice" size="4" maxlength="5" value="{$aantal->price}"><input type="submit" name="setnewprice" value="Set!"><br>
je kunt de slot machine ook weg doen, hij heeft dan geen owner meer en iemand anders kan hem kopen<br></center>
<input type="submit" name="drop" value="Doe de slot machine weg!"><br>
<center>Je kunt hem ook weggeven.<br>
<input type="text" name="newowner" size="20" maxlength="20"><input type="submit" name="giveto" value="geef!"><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->land}'");
mysql_query("UPDATE `[buildings]` SET `profit`='0' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("UPDATE `[buildings]` SET `amount`='0' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("UPDATE `[buildings]` SET `price`='25000' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("UPDATE `[buildings]` SET `active`='0' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Je Slot Machine is weggedaan!',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">Je hebt de slotmachine weggedaan</td></tr></table></center>";
}
else {
echo "<center><table width=90%><tr><td class=\"mainTxt\">Deze slotmachines zijn niet van jou!</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->land}'");
mysql_query("UPDATE `[buildings]` SET `profit`='0' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("UPDATE `[buildings]` SET `amount`='0' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("UPDATE `[buildings]` SET `price`='25000' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("UPDATE `[buildings]` SET `active`='0' WHERE `type`='slot' AND `city`='{$data->land}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','0','Slot Machine weggegeven',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">Jij hebt de slotmachine aan {$logincheck->login} gegeven!</td></tr></table></center>";
}
else {
echo "<center><table width=90%><tr><td class=\"mainTxt\">Ongeldige naam!</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->land}'");
mysql_query("INSERT INTO `[logs]`(login,IP,code,area,time) values('$login','$IP','$newprice','Maximum inzet van je Slot Machine is verandert',NOW())");
echo "<center><table width=90%><tr><td class=\"mainTxt\">je hebt de max. inzet veranderd in <b>\${$newprice}</b>!</td></tr></table></center>";
}
else {
echo "<center><table width=90%><tr><td class=\"mainTxt\">Ongeldige aantal geld</td></tr></table></center>";
}
}
}
}
?>
</body>
</html>
Toon Meer