Garage
maar ik stuitte op een probleem.
ik wil dat je de plaatjes kunt zien en dat laat hij niet zien :(
het geld en schade wel maar plaatjes nee hoor !
Code (php)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
include("../config.php");
if(! check_login()) {
header('Location: ../login.php');
exit;
}
if ($jisin == 1) {
header('Location: ../jisin.php');
}
?>
<?
if($_GET['mode'] == sell){
$auto1 = mysql_query("SELECT * FROM `garage` WHERE `login`='$data->login' AND `id`='{$_GET['x']}'");
$auto = mysql_fetch_object($auto1);
if($auto->login != $data->login){
$error = 1;
}
if($error == ""){
$includ = $auto->waarde/100;
$schadekosten = $auto->damage*$damage;
$waarde = $auto->waarde-$schadekosten;
$showwaarde = number_format($waarde, 0, '.', '.');
mysql_query("UPDATE `users` SET `cash`=`cash`+'$waarde' WHERE `id`='$data->id'");
mysql_query("DELETE FROM `autos` WHERE `id`='$auto->id'");
$error = verkocht;
}}
if($_GET['mode'] == repair){
$auto1 = mysql_query("SELECT * FROM `garage` WHERE `login`='$data->login' AND `id`='{$_GET['x']}'");
$auto = mysql_fetch_object($auto1);
if($auto->login != $data->login){
$error = 1;
}
if($error == ""){
$damage = $auto->waarde/100;
$schadekosten = $auto->damage*$damage;
if($data->cash < $schadekosten){
$error = 2;
}else{
mysql_query("UPDATE `users` SET `cash`=`cash`-'$schadekosten' WHERE `id`='$data->id'");
mysql_query("UPDATE `garage` SET `damage`='0' WHERE `id`='$auto->id'");
$error = niks;
}}}
if($error == 1){
?>
<html>
<head>
<title>The Sicilians</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup_error" align="center">
<tr>
<td style="color:red">
<b>FOUT!</b><br><br>Deze auto is helemaal niet van jou! </td>
</tr>
<tr>
<td>
<br><br>
<a href="#" onclick="history.go(-1); return false" class="error_ok">OK</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<?}if($error == 2){?>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup_error" align="center">
<tr>
<td style="color:red">
<b>FOUT!</b><br><br>Je hebt niet genoeg geld om je auto te kunnen repareren </td>
</tr>
<tr>
<td>
<br><br>
<a href="#" onclick="history.go(-1); return false" class="error_ok">OK</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<?}
if($error == niks){?>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup" align="center">
<tr>
<td>
Je hebt je auto gerepareerd, hij heeft weer 0% damage! </td>
</tr>
<tr>
<td>
<br><br>
<a href="index.php?a=garage" class="msg_ok">Klik hier indien je niet automatisch verder gaat.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
setTimeout("document.location.href='index.php?a=garage'",(3000*2));
</script>
</div>
</td>
</tr>
</table>
</td>
<?}if($error == verkocht){?>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup" align="center">
<tr>
<td>
Je hebt je auto verkocht voor €<?echo$showwaarde;?>,- </td>
</tr>
<tr>
<td>
<br><br>
<a href="index.php?a=garage" class="msg_ok">Klik hier indien je niet automatisch verder gaat.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
setTimeout("document.location.href='index.php?a=garage'",(3000*2));
</script>
</div>
</td>
</tr>
</table>
</td>
<?
}if($error == ""){
?>
<div class="title_bg">
<div class="subtitle">Garage</div>
</div>
<div style="background-color:#d5d2c0; padding:10px; padding-top:4px;">
<table cellpadding="0" cellspacing="0" width="100%"><tr><td>
<table width="97%" border="0" cellspacing="2" cellpadding="2" class="mod_list">
<?
$dbres = mysql_query("SELECT * FROM `garage` WHERE `login`='{$data->login}'");
while($list = mysql_fetch_object($dbres))
{
$plaatje = array("","alfa_romeo _fnm_2000_jk.jpg","golf.jpg","1967-fordmustang gt500.jpg","seat.jpg","2rover.jpg","delorean.jpg","2CadillacV16.jpg","cadillac.jpg","pontiac.jpg","2chrysler.jpg","audir8.jpg","mustang.jpg","gmc.jpg","hummer.jpg","2rolls.jpg","viper.jpg","ferarri.jpg");
$naam = array("","Alfa_romeo","Golfkar","Mustang Shelby GT500","Seat Cordoba","Rover","DeLorean DMC","Cadillac V16","Cadillac","Pontiac Firebird","Chrysler","Audi R8","Mustang","GMC","Hummer","Rolls Royce","Dodge Viper","Ferrari Spyder");
$plaatje = $plaatje[$list->naam];
$naam = $naam[$list->naam];
$damage = $list->waarde/100;
$schadekosten = $list->damage*$damage;
$waarde = number_format($list->waarde-$schade, 0, '.' , '.');
?>
<tr>
<td colspan="3"><font size="4" style="padding-left:7px;"><font size="4"><?echo$naam;?></font></td>
</tr>
<tr>
<td rowspan="4" width="120px" align="center"><img src="../images/<?echo$plaatje;?>" width="100"></td>
<td width="18px" align="center"><img src='../images/icons/money.gif'></td>
<td>Waarde: <b>€ <?echo$waarde;?></b></td>
</tr>
<tr>
<td width="18px" align="center"><img src='../images/icons/error.gif'></td>
<td>damage: <b><?echo$list->damage;?> %</b></td>
</tr>
<tr>
<td width="18px" align="center"><a href="index.php?a=garage&mode=repair&x=<?echo$list->id;?>"><img src="images/icons_gif/wrench.gif" border="0" alt="Repareer!"></a></td>
<td><b><a href="index.php?a=garage&mode=repair&x=<?echo$list->id;?>">Repareer</a></b></td>
</tr>
<tr>
<td width="18px" align="center"><a href="index.php?a=garage&mode=sell&x=<?echo$list->id;?>"><img src="images/icons_gif/money_add.gif" border="0" alt="Verkoop!"></a></td>
<td><b><a href="index.php?a=garage&mode=sell&x=<?echo$list->id;?>">Verkoop</a></b></td>
</tr>
<?
}if(mysql_num_rows($dbres) == 0){
?>
<i>Je hebt geen auto's</i>
<?
}
?>
</table>
</td></tr></table>
</div>
<table width='100%' cellspacing='2' cellpadding='2'>
<tr>
<td class='content_bottom'></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<?
}
?>
include("../config.php");
if(! check_login()) {
header('Location: ../login.php');
exit;
}
if ($jisin == 1) {
header('Location: ../jisin.php');
}
?>
<?
if($_GET['mode'] == sell){
$auto1 = mysql_query("SELECT * FROM `garage` WHERE `login`='$data->login' AND `id`='{$_GET['x']}'");
$auto = mysql_fetch_object($auto1);
if($auto->login != $data->login){
$error = 1;
}
if($error == ""){
$includ = $auto->waarde/100;
$schadekosten = $auto->damage*$damage;
$waarde = $auto->waarde-$schadekosten;
$showwaarde = number_format($waarde, 0, '.', '.');
mysql_query("UPDATE `users` SET `cash`=`cash`+'$waarde' WHERE `id`='$data->id'");
mysql_query("DELETE FROM `autos` WHERE `id`='$auto->id'");
$error = verkocht;
}}
if($_GET['mode'] == repair){
$auto1 = mysql_query("SELECT * FROM `garage` WHERE `login`='$data->login' AND `id`='{$_GET['x']}'");
$auto = mysql_fetch_object($auto1);
if($auto->login != $data->login){
$error = 1;
}
if($error == ""){
$damage = $auto->waarde/100;
$schadekosten = $auto->damage*$damage;
if($data->cash < $schadekosten){
$error = 2;
}else{
mysql_query("UPDATE `users` SET `cash`=`cash`-'$schadekosten' WHERE `id`='$data->id'");
mysql_query("UPDATE `garage` SET `damage`='0' WHERE `id`='$auto->id'");
$error = niks;
}}}
if($error == 1){
?>
<html>
<head>
<title>The Sicilians</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup_error" align="center">
<tr>
<td style="color:red">
<b>FOUT!</b><br><br>Deze auto is helemaal niet van jou! </td>
</tr>
<tr>
<td>
<br><br>
<a href="#" onclick="history.go(-1); return false" class="error_ok">OK</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<?}if($error == 2){?>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup_error" align="center">
<tr>
<td style="color:red">
<b>FOUT!</b><br><br>Je hebt niet genoeg geld om je auto te kunnen repareren </td>
</tr>
<tr>
<td>
<br><br>
<a href="#" onclick="history.go(-1); return false" class="error_ok">OK</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<?}
if($error == niks){?>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup" align="center">
<tr>
<td>
Je hebt je auto gerepareerd, hij heeft weer 0% damage! </td>
</tr>
<tr>
<td>
<br><br>
<a href="index.php?a=garage" class="msg_ok">Klik hier indien je niet automatisch verder gaat.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
setTimeout("document.location.href='index.php?a=garage'",(3000*2));
</script>
</div>
</td>
</tr>
</table>
</td>
<?}if($error == verkocht){?>
<table width="100%">
<tr>
<td align="center">
<br><br><br><br>
<table class="div_popup" align="center">
<tr>
<td>
Je hebt je auto verkocht voor €<?echo$showwaarde;?>,- </td>
</tr>
<tr>
<td>
<br><br>
<a href="index.php?a=garage" class="msg_ok">Klik hier indien je niet automatisch verder gaat.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
setTimeout("document.location.href='index.php?a=garage'",(3000*2));
</script>
</div>
</td>
</tr>
</table>
</td>
<?
}if($error == ""){
?>
<div class="title_bg">
<div class="subtitle">Garage</div>
</div>
<div style="background-color:#d5d2c0; padding:10px; padding-top:4px;">
<table cellpadding="0" cellspacing="0" width="100%"><tr><td>
<table width="97%" border="0" cellspacing="2" cellpadding="2" class="mod_list">
<?
$dbres = mysql_query("SELECT * FROM `garage` WHERE `login`='{$data->login}'");
while($list = mysql_fetch_object($dbres))
{
$plaatje = array("","alfa_romeo _fnm_2000_jk.jpg","golf.jpg","1967-fordmustang gt500.jpg","seat.jpg","2rover.jpg","delorean.jpg","2CadillacV16.jpg","cadillac.jpg","pontiac.jpg","2chrysler.jpg","audir8.jpg","mustang.jpg","gmc.jpg","hummer.jpg","2rolls.jpg","viper.jpg","ferarri.jpg");
$naam = array("","Alfa_romeo","Golfkar","Mustang Shelby GT500","Seat Cordoba","Rover","DeLorean DMC","Cadillac V16","Cadillac","Pontiac Firebird","Chrysler","Audi R8","Mustang","GMC","Hummer","Rolls Royce","Dodge Viper","Ferrari Spyder");
$plaatje = $plaatje[$list->naam];
$naam = $naam[$list->naam];
$damage = $list->waarde/100;
$schadekosten = $list->damage*$damage;
$waarde = number_format($list->waarde-$schade, 0, '.' , '.');
?>
<tr>
<td colspan="3"><font size="4" style="padding-left:7px;"><font size="4"><?echo$naam;?></font></td>
</tr>
<tr>
<td rowspan="4" width="120px" align="center"><img src="../images/<?echo$plaatje;?>" width="100"></td>
<td width="18px" align="center"><img src='../images/icons/money.gif'></td>
<td>Waarde: <b>€ <?echo$waarde;?></b></td>
</tr>
<tr>
<td width="18px" align="center"><img src='../images/icons/error.gif'></td>
<td>damage: <b><?echo$list->damage;?> %</b></td>
</tr>
<tr>
<td width="18px" align="center"><a href="index.php?a=garage&mode=repair&x=<?echo$list->id;?>"><img src="images/icons_gif/wrench.gif" border="0" alt="Repareer!"></a></td>
<td><b><a href="index.php?a=garage&mode=repair&x=<?echo$list->id;?>">Repareer</a></b></td>
</tr>
<tr>
<td width="18px" align="center"><a href="index.php?a=garage&mode=sell&x=<?echo$list->id;?>"><img src="images/icons_gif/money_add.gif" border="0" alt="Verkoop!"></a></td>
<td><b><a href="index.php?a=garage&mode=sell&x=<?echo$list->id;?>">Verkoop</a></b></td>
</tr>
<?
}if(mysql_num_rows($dbres) == 0){
?>
<i>Je hebt geen auto's</i>
<?
}
?>
</table>
</td></tr></table>
</div>
<table width='100%' cellspacing='2' cellpadding='2'>
<tr>
<td class='content_bottom'></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<?
}
?>
db:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--
-- Tabel structuur voor tabel `garage`
--
CREATE TABLE IF NOT EXISTS `garage` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`login` varchar(16) NOT NULL DEFAULT '',
`naam` varchar(16) NOT NULL DEFAULT '',
`waarde` int(6) NOT NULL DEFAULT '0',
`damage` char(3) NOT NULL DEFAULT '',
`stad` varchar(16) NOT NULL DEFAULT '',
`safe` char(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2122 ;
--
-- Gegevens worden uitgevoerd voor tabel `garage`
--
-- Tabel structuur voor tabel `garage`
--
CREATE TABLE IF NOT EXISTS `garage` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`login` varchar(16) NOT NULL DEFAULT '',
`naam` varchar(16) NOT NULL DEFAULT '',
`waarde` int(6) NOT NULL DEFAULT '0',
`damage` char(3) NOT NULL DEFAULT '',
`stad` varchar(16) NOT NULL DEFAULT '',
`safe` char(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2122 ;
--
-- Gegevens worden uitgevoerd voor tabel `garage`
--
db cars:
Code (php)
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
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
--
-- Tabel structuur voor tabel `cars`
--
CREATE TABLE IF NOT EXISTS `cars` (
`naam` varchar(16) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`waarde` varchar(6) NOT NULL DEFAULT '',
`auto` varchar(255) NOT NULL DEFAULT '',
FULLTEXT KEY `naam` (`naam`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `cars`
--
INSERT INTO `cars` (`naam`, `url`, `waarde`, `auto`) VALUES
('Alfa Romeo', 'images/alfa_romeo%20_fnm_2000_jk.jpg', '25000', 'Alfa Romeo'),
('Aston Martin', 'images/aston_martin_db3s.jpg', '60000', 'Aston Martin'),
('Buick Cabrio', 'images/buick_cabrio.jpg', '30000', 'Buick Cabrio'),
('Caddillac Sedan', 'images/caddillac_sedan.jpg', '40000', 'Caddillac Sedan'),
('Chevy Camaro', 'images/chevy_camaro_ss.jpg', '85000', 'Chevy Camaro'),
('Dodge Dart', 'images/dodge_dart.jpg', '12500', 'Dodge Dart'),
('Ford Mustang', 'http://www.al-pacino.nl/images/ford_fairlane.jpg', '22500', 'Ford Mustang'),
('Ford Fairlane', 'images/ford_mustang.jpg', '5000', 'Ford Fairlane'),
('Mustang Shelby G', 'images/1967-fordmustang gt500.jpg', '170000', 'Ford mustang shelby GT500'),
('Mercury Cougar', 'images/mercury_cougar.jpg', '145000', 'Mercury Cougar');
-- Tabel structuur voor tabel `cars`
--
CREATE TABLE IF NOT EXISTS `cars` (
`naam` varchar(16) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`waarde` varchar(6) NOT NULL DEFAULT '',
`auto` varchar(255) NOT NULL DEFAULT '',
FULLTEXT KEY `naam` (`naam`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `cars`
--
INSERT INTO `cars` (`naam`, `url`, `waarde`, `auto`) VALUES
('Alfa Romeo', 'images/alfa_romeo%20_fnm_2000_jk.jpg', '25000', 'Alfa Romeo'),
('Aston Martin', 'images/aston_martin_db3s.jpg', '60000', 'Aston Martin'),
('Buick Cabrio', 'images/buick_cabrio.jpg', '30000', 'Buick Cabrio'),
('Caddillac Sedan', 'images/caddillac_sedan.jpg', '40000', 'Caddillac Sedan'),
('Chevy Camaro', 'images/chevy_camaro_ss.jpg', '85000', 'Chevy Camaro'),
('Dodge Dart', 'images/dodge_dart.jpg', '12500', 'Dodge Dart'),
('Ford Mustang', 'http://www.al-pacino.nl/images/ford_fairlane.jpg', '22500', 'Ford Mustang'),
('Ford Fairlane', 'images/ford_mustang.jpg', '5000', 'Ford Fairlane'),
('Mustang Shelby G', 'images/1967-fordmustang gt500.jpg', '170000', 'Ford mustang shelby GT500'),
('Mercury Cougar', 'images/mercury_cougar.jpg', '145000', 'Mercury Cougar');
groetjes thymen
Omg wat is dit ranzig, backticks in querys, geen tabs, blegh! Schrijf het voortaan zelf ipv te jatten!
ik vraag toch niet voor hoe "ranzig" het geschreven is?
ik vraag voor een oplossing ;)