M'n script geeft geen error, maar de drugs van de overige word niet weergeven!
_drugs.php
PHP
<?
//kijken of bedrag boven 0 is.
$beer2 = $_POST['beer2'];
$rum2 = $_POST['rum2'];
$wine2 = $_POST['wine2'];
$vodka2 = $_POST['vodka2'];
$wiet2 = $_POST['wiet2'];
$hasj2 = $_POST['hasj2'];
$heroine2 = $_POST['heroine2'];
$cocaine2 = $_POST['cocaine2'];
$controle = 0;
if ($beer2 < 0) {
$controle = 1;
}
if ($rum2 < 0) {
$controle = 1;
}
if ($wine2 < 0) {
$controle = 1;
}
if ($vodka2 < 0) {
$controle = 1;
}
if ($wiet2 < 0) {
$controle = 1;
}
if ($hasj2 < 0) {
$controle = 1;
}
if ($heroine2 < 0) {
$controle = 1;
}
if ($cocaine2 < 0) {
$controle = 1;
}
if ($beer2 OR $rum2 OR $wine2 OR $vodka2 OR $wiet2 OR $hasj2 OR $heroine2 OR $cocaine2) {
if ($controle == 1) {
$melding = "Foute invoer!";
} else {
$what = $_POST['what'];
if ($what == 1) {
$how_much = ($rank_status_you * 5);
$now = ($beer2 + $rum2 + $wine2 + $vodka2 + $wiet2 + $hasj2 + $heroine2 + $cocaine2);
$current = (($beer + $rum) + ($wine + $vodka) + ($wiet + $hasj) + ($heroine + $cocaine) + ($now));
if ($current > $how_much) {
$melding = "Je kan niet meer dan: <b>$how_much</b> units kopen.";
} else {
if ($beer2) {
$price = ($price_beer * $beer2);
if (($geld - $price) < 0) {
$melding = "You can't afford it";
} else {
$opdracht = "insert INTO booze_units values('0','beer','$beer2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
}
if ($rum2) {
$price = ($price_rum * $rum2);
if (($geld - $price) < 0) {
$melding = "You do not have enough money!";
} else {
$opdracht = "insert INTO booze_units values('0','rum','$rum2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
}
if ($wine2) {
$price = ($price_wine * $wine2);
if (($geld - $price) < 0) {
$melding = "You do not have enough money!";
} else {
$opdracht = "insert INTO booze_units values('0','wine','$wine2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
}
if ($vodka2) {
$price = ($price_vodka * $vodka2);
if (($geld - $price) < 0) {
$melding = "You do not have enough money!";
} else {
$opdracht = "insert INTO booze_units values('0','vodka','$vodka2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
}
if ($wiet2) {
$price = ($price_wiet * $wiet2);
if (($geld - $price) < 0) {
$melding = "You do not have enough money!";
} else {
$opdracht = "insert INTO booze_units values('0','wiet','$wiet2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
}
if ($hasj2) {
$price = ($price_hasj * $hasj2);
if (($geld - $price) < 0) {
$melding = "You do not have enough money!";
} else {
$opdracht = "insert INTO booze_units values('0','hasj','$hasj2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
if ($cocaine2) {
$price = ($price_cocaine * $cocaine2);
if (($geld - $price) < 0) {
$melding = "You do not have enough money!";
} else {
$opdracht = "insert INTO booze_units values('0','cocaine','$cocaine2','$userid','$locatie')";
$resultaat = mysql_query($opdracht);
$geld = ($geld-$price);
mysql_query("UPDATE `users` SET `geld`='$geld' WHERE `username`='$cookieusername'");
$melding = "You successfully bought!";
}
}
}
}
} else {
if ($beer2) {
$price = ($price_beer * $beer2);
$blep = sell("beer",$beer2,$beer,$price,$userid,$geld);
echo "$blep <br />";
}
if ($rum2) {
$price = ($price_rum * $rum2);
$blep = sell("rum",$rum2,$rum,$price,$userid,$geld);
echo "$blep <br />";
}
if ($wine2) {
$price = ($price_wine * $wine2);
$blep = sell("wine",$wine2,$wine,$price,$userid,$geld);
echo "$blep <br />";
}
if ($vodka2) {
$price = ($price_vodka * $vodka2);
$blep = sell("vodka",$vodka2,$vodka,$price,$userid,$geld);
echo "$blep <br />";
}
if ($wiet2) {
$price = ($price_wiet * $wiet2);
$blep = sell("wiet",$wiet2,$wiet,$price,$userid,$geld);
echo "$blep <br />";
}
if ($hasj2) {
$price = ($price_hasj * $hasj2);
$blep = sell("hasj",$hasj2,$hasj,$price,$userid,$geld);
echo "$blep <br />";
}
}
}
}
?>
Toon Meer
drugs.php
PHP
<?
// bezoekers statistieken
$pagename = "Booze Cartel";
include("./counter.inc.php");
?>
<?PHP
include "header.php";
include "_menu.php";
include "_drugs.php";
if ($melding) {
echo "<div class=\"window\">";
echo "<div class=\"mainTitle\">Drugs</div>";
echo "<div class=\"mainText\">";
echo "$melding";
echo "</div></div>";
} else {
?>
<div class="window">
<div class="mainTitle">Drank/Drugs</div>
<div class="mainText">
<? echo "Je kan zoveel <b>" . ($rank_status_you * 5) . "</b>"; ?>units kopen
<br />
<br />
<table border=1>
<tr><td class=pik3 background="images/bgMainTitle.jpg"><b>Booze</b></td><td class=pik3 background="images/bgMainTitle.jpg"><b>Ammount</b></td><td class=pik3 background="images/bgMainTitle.jpg"><b>You have</b></td><td class=pik3 background="images/bgMainTitle.jpg"><b>Price</b></td></tr>
<form action="" method=post>
<tr><td><font color="red">Bier</font></td><td><input size=7 type=text name=beer2></td><td><? echo "$beer"; ?></td><td>€<? echo "$price_beer"; ?></td></tr>
<tr><td><font color="red">Rum</font></td><td><input size=7 type=text name=rum2></td><td><? echo "$rum"; ?></td><td>€<? echo "$price_rum"; ?></td></tr>
<tr><td><font color="red">Wijn</font></td><td><input size=7 type=text name=wine2></td><td><? echo "$wine"; ?></td><td>€<? echo "$price_wine"; ?></td></tr>
<tr><td><font color="red">Vodka</font></td><td><input size=7 type=text name=vodka2></td><td><? echo "$vodka"; ?></td><td>€<? echo "$price_vodka"; ?></td></tr>
<tr><td>Marihuana </td><td><input size=7 type=text name=wiet2></td><td><? echo "$wiet"; ?></td><td>€<? echo "$price_wiet"; ?></td></tr>
<tr><td>Hasj</td><td><input size=7 type=text name=hasj2></td><td><? echo "$hasj"; ?></td><td>€<? echo "$price_hasj"; ?></td></tr>
<tr><td>Heroine</td><td><input size=7 type=text name=heroine2></td><td><? echo "$heroine"; ?></td><td>€<? echo "$price_heroine"; ?></td></tr>
<tr><td>Cocaine</td><td><input size=7 type=text name=cocaine2></td><td><? echo "$cocaine"; ?></td><td>€<? echo "$price_cocaine"; ?></td></tr><br />
<tr><td>Koop<input type=radio name=what value=1></td><td class=pik3>Verkoop:<input type=radio name=what value=2></td><td></td><td><input type=submit value=Koop/Verkoop></td></tr>
</form>
</table>
</div>
</div>
<?
}
include "footer.php";
?>
Toon Meer
en de tabel:
PHP
CREATE TABLE `booze` (
`Beer` varchar(255) default '0',
`Rum` varchar(255) default '0',
`Whiskey` varchar(255) default '0',
`Vodka` varchar(255) default '0',
`Wiet` varchar(255) default '0',
`Hasj` varchar(255) default '0',
`Heroine` varchar(255) default '0',
`Cocaine` varchar(255) default '0',
`state` varchar(255) default NULL
) TYPE=MyISAM;
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Netherlands');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Italy');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'United States');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Japan');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Poland');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Russia');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Columbia');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'China');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'France');
INSERT INTO `booze` VALUES ( '784', '467', '7953', '157', '200', '290', '4000', '9000', 'Australia');
Toon Meer
en de screen: