Beste leden ,
als ik wil reizen blijf ik in Nederland ( 1 )
hier het script:
PHP
<?php /* ------------------------- */
include("_include-config.php");
if(! check_login()) {
header("Location: login.php");
exit;
}
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
/* ------------------------- */ ?>
<head>
<title>MaffiaCity.nl - Het leukste spel op het web !</title>
<body style="background: #808080; margin: 0px;">
<link rel="stylesheet" type="text/css" href="css-v1.css">
</head>
<table align="center" width=50%>
<tr><td class="subTitle"><b>Trein Station</b></td></tr>
<?php
if($data->landvlieg == 5)
{
echo "<tr><td class=subtitle>Reistijd</tr></td>";
echo "<tr><td class=maintxt>
<center>Je hebt de afgeloopen 1 uur al 5x Gereist.</center>
<center>wacht 1 uur voordat je weer kan reisen.</center></tr></td>";
exit;
}
?>
<?php /* ------------------------- */
$gn1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`landkut`) AS `landkut`,0 FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$gn = mysql_fetch_object($gn1); if($gn->landkut + $gn->landkut > time()){
$verschil1 = $gn->landkut + $gn->landkut - time() - 3600;
$verschil = date("H:i:s", "$verschil1");print <<<ENDHTML
<tr><td class="mainTxt" align="center">
<p align="center"><font size="5"><b>Je hebt het afgelopen half uur al gereist</b></font></p>
<p align="center"> </p>
<p align="center"><font size="5"><b>Je kan over $verschil Weer reizen</b></font></p>
</table>
ENDHTML;
}
else{
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='1'");
$nederland = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='2'");
$duitsland = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='3'");
$engeland = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='4'");
$frankrijk = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='5'");
$griekenland = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='6'");
$italie = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT id FROM `[users]` WHERE `land`='7'");
$nederland = mysql_num_rows($dbres);
$tekoop1 = mysql_query("SELECT * FROM `[trein]` WHERE `land`='$data->land'");
$tekoop = mysql_fetch_assoc($tekoop1);
$owner1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`tijd`) AS `tijd`,0 FROM `[trein]` WHERE `land`='$data->land'");
$owner = mysql_fetch_object($owner1);
$owner2 = mysql_query("SELECT *,UNIX_TIMESTAMP(`ltijd`) AS `ltijd`,0 FROM `[trein]` WHERE `land`='$data->land'");
$owner3 = mysql_fetch_object($owner2);
$owner1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`tijd`) AS `tijd`,0 FROM `[trein]` WHERE `land`='$data->land'");
$owner = mysql_fetch_object($owner1);
$land = array("","Nederland","Frankrijk","Spanje","Turkije","Griekenland","Australie","Amerika","Ierland","Afrika","Polen","Zwitserland","");
$land1 = $land[$data->land];
print "<tr><td class=\"mainTxt\">";
if ($owner->owner == '')
print "<center><b>Geen Eigenaar</b><br>Koop deze Trein Station voor €10.000 <a href=\"koop.php?spel=trein\">Klik hier</a></center>";
if ($data->login == $owner->owner) {
print "<center></center><br>";
if(!isset($_POST['verander'])) {
$geld = $_POST['prijs'];
if($geld > 150000){
print " <b> {$data->login}, </b> <font color='black'>De reisprijs mag maximaal €150.000,- zijn!</font>";
exit;
}
print <<<ENDHTML
<tr><td class="mainTxt" align="center">
<form method="POST">
<p> Verander de prijs naar: <input type="text" name="prijs" size="15">
<input type="submit" value="verander" name="verander"></p>
</form>
</td></tr>
ENDHTML;
}
if(isset($_POST['verander'])){
if($_POST['prijs'] > 100000){
echo 'De max. is €100.000 let daar even op';
exit;
}
$prijs = $_POST['prijs'];
$bod = $_POST['bod'];
if($bod > 150000){
print " <b> {$data->login},</b> <font color='black'>Het beginbod mag maximaal €150.000,- zijn!</font>";
exit;
}
print <<<ENDHTML
<tr><td class="mainTxt" align="center">
<form method="POST">
<p> Verander de prijs naar: <input type="text" name="prijs" size="15">
<input type="submit" value="verander" name="verander"></p>
</form>
</td></tr>
ENDHTML;
mysql_query("UPDATE `[trein]` SET `geld`='$prijs' WHERE `owner`='$data->login' ");
print "<tr><td class=\"mainTxt\" align=\"center\"> De reisprijs is verandert naar €<b>$prijs</b>.</td></tr>";
print <<<ENDHTML
<tr><td class="mainTxt" align="center">
<form method="POST">
<p> De reisprijs is nu: €{$owner->geld}</p>
<p> Verander de prijs naar: <input type="text" name="prijs" size="15">
<input type="submit" value="verander" name="verander"></p>
</form>
</td></tr>
ENDHTML;
}
print <<<ENDHTML
<table width="50%" align=center>
<tr><td class="mainTxt" align="center">
<form method="POST">
<p><b>Jij bent de eigenaar van deze trein station, Verkoop hem op de veiling.</b></p>
<p><b>Info</b><BR><textarea name="info" rows=5 cols=16 wrap="on"></textarea><br><br>
<input type="submit" value="Zet op de Veiling" name="veiling"></p>
</form>
</td></tr>
ENDHTML;
if(isset($_POST['veiling']) && $info !=""){
$info = $_POST['info'];
$beginbod = $_POST['bod'];
$dbres2 = mysql_query("SELECT `id` FROM `[veiling]` WHERE `land`='$land1' AND `item`='2'");
if(mysql_num_rows($dbres2) != 0) {
print " <tr><td class=\"mainTxt\">Deze treinstation staat al op de veiling</td></tr>\n";
}
else if($beginbod > 1000000) {
print " <tr><td class=\"mainTxt\">Dit beginbod is tehoog... Maximaal €1.000.000</td></tr>\n";
}
else {
mysql_query("INSERT INTO `[veiling]` (`plaatser`, `tijd`, `item`, `land`, `beginbod`, `bod`, `info`) VALUES ('$data->login', NOW(), '2', '$land1', '5000', '5000', '$info')");
print "<tr><td class=\"mainTxt\" align=\"center\"> Je hebt de treinstation van $land1 op de veiling gezet";
}
}
}
if ($data->land == 1) {
$land = "Nederland";}
elseif ($data->land == 2){
$land = "Frankrijk";}
elseif ($data->land == 3){
$land = "Spanje";}
elseif ($data->land == 4){
$land = "Turkije";}
elseif ($data->land == 5){
$land = "Griekenland";}
elseif ($data->land == 6){
$land = "Australie";}
elseif ($data->land == 7){
$land = "Amerika";}
elseif ($data->land == 8){
$land = "Ierland";}
elseif ($data->land == 9){
$land = "Afrika";}
elseif ($data->land == 10){
$land = "Polen";}
if(isset($_POST['vlieg'])) {
if($data->cash >= $owner->geld) {
$land = $_POST['land'];
mysql_query("UPDATE `[users]` SET `land`='{$land}',`cash`=`cash`-$owner->geld WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `bank`=`bank`+'$owner->geld' WHERE `login`='{$owner->owner}'");
mysql_query("UPDATE `[users]` SET `energie`=`energie`-'5' WHERE `login`='$data->login'");
mysql_query("UPDATE `[users]` SET `landvlieg`=`energie`+'1' WHERE `login`='$data->login'");
mysql_query("UPDATE `[trein]` SET `aantalx`=`aantalx`+'1' WHERE `land`='$data->land'");
mysql_query("UPDATE `[trein]` SET `winst`=`winst`+'$owner->geld' WHERE `land`='$data->land'");
print " <tr><td class=\"mainTxt\">Welkom in de $data->land..</td></tr>\n";
exit;
}
else
print " <tr><td class=\"mainTxt\"><font color='red'><b>Je hebt niet genoeg geld om een treinticket te kopen!</b></font></td></tr>\n";
}
print <<<ENDHTML
<tr><center><BR><td class="MainTxt">Je verblijft momenteel in <b> $land.
<BR></b>De reisprijs is <b> €$owner->geld </b><BR>
De eigenaar van dit trein station is <b>$owner->owner</b><br>
Je kan 5x per uur Reizen
</td></tr></center>
<td class="MainTxt"><form method="post"></td>
<tr><td class="mainTxt">
<input name="land" value="1" type="radio" checked>
Nederland</td>
<tr><td class="mainTxt">
<input name="land" value="2" type="radio">
Frankrijk</td>
<tr><td class="mainTxt">
<input name="land" value="3" type="radio" checked>
Spanje</td>
<tr><td class="mainTxt">
<input name="land" value="4" type="radio" checked>
Turkije</td>
<tr><td class="mainTxt">
<input name="land" value="5" type="radio" checked>
Griekenland</td>
</select>
</td></tr>
<tr><td class="mainTxt">
<table align="center">
<td align="center"><input type="submit" name="vlieg" value="Uitvoeren"></td></tr>
</table>
</td></tr>
<table align="center" width=50%>
<tr><td class="mainTxt"><a href="treinstats.php"><center><b>Klik hier voor de trein stats</b></a></center></td></tr></table>
</table>
</td></tr>
</table><table>
ENDHTML;
}
?>
</table>
</body>
</html>
Toon Meer
Edit:Topic verplaatst naar server-side scripting, gelieve hier in het vervolg op te letten aub.