1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
|
<?php
$erro = 0;
$sql = "SELECT * FROM techs WHERE stufe <= '".getUserData("epoche")."' AND art='g'";
$result = mysql_query($sql) or die(mysql_error());
$nahrung = getCity("nahrung");
$holz = getCity("holz");
$gold = getCity("gold");
$stein = getCity("stein");
$stufe = getUserData("epoche");
echo '<table width="100%">' .
'<tr>' .
' <td><strong> Name</strong></td>' .
' <td><strong>Holz</strong></td>' .
' <td><strong>Gold</strong></td>' .
' <td><strong>Stein</strong></td>' .
' <td><strong>Nahrung</strong></td>' .
' <td><strong>Bauen</strong></td>' .
'</tr>';
while ($row = mysql_fetch_array($result)) {
if ($gold < $row["gold"]) {
$req_gold = '<span style="color:red">'.$row["gold"].'</span>';
$error = 1;
} else {
$req_gold = '<span style="color:green">'.$row["gold"].'</span>';
}
if ($holz < $row["holz"]) {
$req_holz = '<span style="color:red">'.$row["holz"].'</span>';
$error = 1;
} else {
$req_holz = '<span style="color:green">'.$row["holz"].'</span>';
}
if ($nahrung < $row["nahrung"]) {
$req_nahrung = '<span style="color:red">'.$row["nahrung"].'</span>';
$error = 1;
} else {
$req_nahrung = '<span style="color:green">'.$row["nahrung"].'</span>';
}
if ($stein < $row["stein"]) {
$req_stein = '<span style="color:red">'.$row["stein"].'</span>';
$error = 1;
} else {
$req_stein = '<span style="color:green">'.$row["stein"].'</span>';
}
if ($error == 1) {
$link="<span style=\"color:red\">Bauen</span>";
} else {
$link="<span style=\"color:green\"><a href=\"?ac=build&bauen=".$row["id"]."\">Bauen</a></span>";
}
echo '<tr>' .
' <td> <a href="?ac=infos#'.$row["name"].'">'.$row["name"].'</a> [Stufe: '.getCity("".$row['name']."").']</td>' .
' <td>'.$req_holz.'</td>' .
' <td>'.$req_gold.'</td>' .
' <td>'.$req_stein.'</td>' .
' <td>'.$req_gold.'</td>' .
' <td>'.$link.'</td>' .
'</tr>';
}
if(isset($_GET['bauen'])) {
// check ob id vorhanden ist
$check=mysql_query("SELECT * FROM techs WHERE id='".intval($_GET['bauen'])."' AND art='g'");
if(mysql_num_rows($check) == 0) {
echo "<b><font color=red>Die Angegebene BauID existiert nicht!</font></b>";
} else {
// check bestanden -> check ob der user die anforderungen hat
$check2=mysql_fetch_array(mysql_query("SELECT * FROM techs WHERE art='g' AND id='".$buildid."'"));
if ($gold < $check2["gold"]) {
$req_gold = '<span style="color:red">'.$row["gold"].'</span>';
echo "<b><font color=red>Du hast nicht genügend Gold</b></font>";
}
if ($holz < $check2["holz"]) {
$req_holz = '<span style="color:red">'.$row["holz"].'</span>';
echo "<b><font color=red>Du hast nicht genügend Holz</b></font>";
}
if ($nahrung < $check2["nahrung"]) {
$req_nahrung = '<span style="color:red">'.$row["nahrung"].'</span>';
echo "<b><font color=red>Du hast nicht genügend Nahrung</b></font>";
}
if ($stein < $check2["stein"]) {
$req_stein = '<span style="color:red">'.$row["stein"].'</span>';
echo "<b><font color=red>Du hast nicht genügend Stein</b></font>";
} elseif($stein > $check2["stein"] or $nahrung > $check2["nahrung"] or $holz > $check2["holz"] or $gold > $check2["gold"]) {
mysql_query("UPDATE stadt SET ".$check2['name']."+1 WHERE userid='".getUserData('UserID')."'");
}
}
}
?>
</table>
|