kleur fout
ik ben bezig met een script voor een web ftp voor op school:P
nou heb ik het volgende: (sorrie, beetje lang:P)
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
230
231
232
233
234
235
236
237
238
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
230
231
232
233
234
235
236
237
238
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript">
<!-- Begin van de preloader script
document.write('<br><br><br><br><br><br><center><div id="loading" style="border: 2px black solid; width: 200px; height: 100px;"><br><img src="icons/letop.gif" alt="Loading" /> Even geduld...</div>');
window.onload=function(){
document.getElementById("loading").style.display="none";
}
// End -->
</script>
<?php
$dir = dirname($_SERVER['PHP_SELF']);
$dir = str_replace("/", "", $dir);
$dir = "U bevind zich in de directory: '" . $dir . "'";
?>
<title><?php echo $dir; ?></title>
<script>
window.status = "<?php echo $dir; ?>";
</script>
<style>
th
{
background-color: #666666;
color: #FFF;
text-align: left;
}
a
{
text-decoration: none;
}
a:hover
{
color: gray;
}
</style>
</head>
<body link="black" alink="black" vlink="black">
<center>
<br><br><br>
<table cellpadding="4px" cellspacing="0px" style="border: black 2px solid;">
<tr>
<th width="20px">
</th>
<th width="180px">
Naam:
</th>
<th width="60px">
Type:
</th>
<th width="80px">
Grote:
</th>
<th width="170px">
Gewijzigd op:
</th>
<th width="50px" colspan="2">
Actie:
</th>
</tr>
<?php
$i = "1";
$dir = "bestanden/"; // de directory die hij uit moet lezen
$color = "0";
if ($handle = @opendir($dir))
{
while (false !== ($file = @readdir($handle)))
{
$ext = pathinfo($file);
$bestand = str_replace("." . $ext['extension'], "", $file);
IF ($i == "1")
{
$color = "#E1E1E1";
$i = "0";
}
else
{
$color = "#FFFFFF";
$i = "1";
}
IF (!($file == "." || $file == ".."))
{
IF ($ext['extension'] == "") // Mappen
{
echo "
<tr bgcolor='". $color ."'>
<td valign='midle'><img src='icons/". $ext['extension'] .".gif' height='17px'></td>
<td><a href='bestanden/". $file ."'>". $bestand ."</a></td><td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
";
}
}
}
closedir($dir);
}
if ($handle = @opendir($dir))
{
while (false !== ($file = @readdir($handle)))
{
$ext = pathinfo($file);
$bestand = str_replace("." . $ext['extension'], "", $file);
IF ($i == "1")
{
$color = "#E1E1E1";
$i = "0";
}
else
{
$color = "#FFFFFF";
$i = "1";
}
IF (!($file == "." || $file == ".."))
{
IF (!($ext['extension'] == "")) // Bestanden
{
$filesize = filesize("bestanden/" . $file);
$filesize = $filesize / 1000;
$filesize = round($filesize, 2);
echo "
<tr bgcolor='". $color ."'>
<td valign='midle'><img src='icons/". $ext['extension'] .".gif' height='17px'></td>
<td><a href='bestanden/". $file ."'>". $bestand ."</a></td>
<td>" . $ext['extension'] . "</td>
<td>" . $filesize . " kb</td>
<td>" . date("d-m-'y H:i:s", filemtime("bestanden/" . $file)) . "</td>
<td><a href='delete.php?bestand=" . $file . "'><img src='icons/verwijder.gif' border='0' alt='verwijder' width'20px'></a></td>
";
IF (
$ext['extension'] == "php" ||
$ext['extension'] == "txt" ||
$ext['extension'] == "htm" ||
$ext['extension'] == "js" ||
$ext['extension'] == "css" ||
$ext['extension'] == "asp"
)
{
echo "
<td><a href='edit.php?bestand=" . $file . "'><img src='icons/wijzigen.gif' alt='wijzigen' width'20px' border='0'></a></td>
";
}
else
{
echo "<td> </td>";
}
echo "</tr>";
}
}
}
closedir($dir);
}
?>
</table>
<?php
$diskfreespace = disk_free_space("/");
$diskspace = disk_total_space("/");
?>
<br>
<br>
<br>
<?php
$vrij = $diskfreespace / $diskspace * 100;
$vrij = round($vrij);
$gebruikt = 100 - $vrij;
$gebruikt = $gebruikt * 4;
$vrij = $vrij * 4;
?>
<table cellpadding="4px" cellspacing="0px" style="border: black 2px solid; width: 500px;">
<tr>
<th>Schijf ruimte:</th>
</tr>
<tr>
<td><br>
<font style="width: <?php echo $gebruikt . "px"; ?> ; background-color: red; height: 30px; margin-left: 40px; padding: 5px;"><b>Gebruikt</b> </font>
<font style="width: <?php echo $vrij . "px"; ?> ; background-color: green; height: 30px; margin-left: 2px; padding: 5px;"><b>Vrij</b></font>
<br><br>
</td>
</tr>
</table>
</center>
</body>
</html>
<html>
<head>
<script type="text/javascript">
<!-- Begin van de preloader script
document.write('<br><br><br><br><br><br><center><div id="loading" style="border: 2px black solid; width: 200px; height: 100px;"><br><img src="icons/letop.gif" alt="Loading" /> Even geduld...</div>');
window.onload=function(){
document.getElementById("loading").style.display="none";
}
// End -->
</script>
<?php
$dir = dirname($_SERVER['PHP_SELF']);
$dir = str_replace("/", "", $dir);
$dir = "U bevind zich in de directory: '" . $dir . "'";
?>
<title><?php echo $dir; ?></title>
<script>
window.status = "<?php echo $dir; ?>";
</script>
<style>
th
{
background-color: #666666;
color: #FFF;
text-align: left;
}
a
{
text-decoration: none;
}
a:hover
{
color: gray;
}
</style>
</head>
<body link="black" alink="black" vlink="black">
<center>
<br><br><br>
<table cellpadding="4px" cellspacing="0px" style="border: black 2px solid;">
<tr>
<th width="20px">
</th>
<th width="180px">
Naam:
</th>
<th width="60px">
Type:
</th>
<th width="80px">
Grote:
</th>
<th width="170px">
Gewijzigd op:
</th>
<th width="50px" colspan="2">
Actie:
</th>
</tr>
<?php
$i = "1";
$dir = "bestanden/"; // de directory die hij uit moet lezen
$color = "0";
if ($handle = @opendir($dir))
{
while (false !== ($file = @readdir($handle)))
{
$ext = pathinfo($file);
$bestand = str_replace("." . $ext['extension'], "", $file);
IF ($i == "1")
{
$color = "#E1E1E1";
$i = "0";
}
else
{
$color = "#FFFFFF";
$i = "1";
}
IF (!($file == "." || $file == ".."))
{
IF ($ext['extension'] == "") // Mappen
{
echo "
<tr bgcolor='". $color ."'>
<td valign='midle'><img src='icons/". $ext['extension'] .".gif' height='17px'></td>
<td><a href='bestanden/". $file ."'>". $bestand ."</a></td><td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
";
}
}
}
closedir($dir);
}
if ($handle = @opendir($dir))
{
while (false !== ($file = @readdir($handle)))
{
$ext = pathinfo($file);
$bestand = str_replace("." . $ext['extension'], "", $file);
IF ($i == "1")
{
$color = "#E1E1E1";
$i = "0";
}
else
{
$color = "#FFFFFF";
$i = "1";
}
IF (!($file == "." || $file == ".."))
{
IF (!($ext['extension'] == "")) // Bestanden
{
$filesize = filesize("bestanden/" . $file);
$filesize = $filesize / 1000;
$filesize = round($filesize, 2);
echo "
<tr bgcolor='". $color ."'>
<td valign='midle'><img src='icons/". $ext['extension'] .".gif' height='17px'></td>
<td><a href='bestanden/". $file ."'>". $bestand ."</a></td>
<td>" . $ext['extension'] . "</td>
<td>" . $filesize . " kb</td>
<td>" . date("d-m-'y H:i:s", filemtime("bestanden/" . $file)) . "</td>
<td><a href='delete.php?bestand=" . $file . "'><img src='icons/verwijder.gif' border='0' alt='verwijder' width'20px'></a></td>
";
IF (
$ext['extension'] == "php" ||
$ext['extension'] == "txt" ||
$ext['extension'] == "htm" ||
$ext['extension'] == "js" ||
$ext['extension'] == "css" ||
$ext['extension'] == "asp"
)
{
echo "
<td><a href='edit.php?bestand=" . $file . "'><img src='icons/wijzigen.gif' alt='wijzigen' width'20px' border='0'></a></td>
";
}
else
{
echo "<td> </td>";
}
echo "</tr>";
}
}
}
closedir($dir);
}
?>
</table>
<?php
$diskfreespace = disk_free_space("/");
$diskspace = disk_total_space("/");
?>
<br>
<br>
<br>
<?php
$vrij = $diskfreespace / $diskspace * 100;
$vrij = round($vrij);
$gebruikt = 100 - $vrij;
$gebruikt = $gebruikt * 4;
$vrij = $vrij * 4;
?>
<table cellpadding="4px" cellspacing="0px" style="border: black 2px solid; width: 500px;">
<tr>
<th>Schijf ruimte:</th>
</tr>
<tr>
<td><br>
<font style="width: <?php echo $gebruikt . "px"; ?> ; background-color: red; height: 30px; margin-left: 40px; padding: 5px;"><b>Gebruikt</b> </font>
<font style="width: <?php echo $vrij . "px"; ?> ; background-color: green; height: 30px; margin-left: 2px; padding: 5px;"><b>Vrij</b></font>
<br><br>
</td>
</tr>
</table>
</center>
</body>
</html>
Nou krijg ik 2 foutmeldingen en de kleuren kloppen niet...
Warning: closedir(): supplied argument is not a valid Directory resource in C:\Documents and Settings\Versteeg\Mijn documenten\kinderen\Johan\Wamp-php\Scripts en Snipets\Verkenner\index.php on line 118
Warning: closedir(): supplied argument is not a valid Directory resource in C:\Documents and Settings\Versteeg\Mijn documenten\kinderen\Johan\Wamp-php\Scripts en Snipets\Verkenner\index.php on line 118
de kleuren gaan fout:
http://www.praise-culemborg.nl/webftp.gif
kan iemand mij helpen?
Groetejs Johan
Er zijn nog geen reacties op dit bericht.