[<?php if (session_is_registered("sess_loginnr") && session_is_registered("sess_id")) { ?>
<b>Controlpanel</b> [Apparel]
<hr color=#FF0000 size="1"><br>
<b>Upload jpg-files</b><hr color=#000000 size="1">
<?php
$config['map'] = "Apparel/"; //aanpassen
function upload_size( $size, $maxm="10000000" ) { //maxm wijzigen
if( $size > $maxm ) {
error( 'Je file is te groot!<br><br>' );
}
}
function error( $error, $exit=TRUE ) {
echo $error;
if( $exit == TRUE ) {
exit;
}
}
function bestaat_al( $naam ) {
if( file_exists( $naam ) ) {
error( 'Filename allready excised/Make sure all fields are filled in!<br><br>' );
}
}
if( isset($_POST['uploaden']) ) {
if (!isset($_POST['description'])){
error ('Je hebt geen description opgegeven<br><br>');
} else {
upload_size( $_FILES['upload']['size'] );
bestaat_al( $config['map'] . $_FILES['upload']['name'] );
if (!move_uploaded_file( $_FILES['upload']['tmp_name'], $config['map'] . $_FILES['upload']['name'] )) {
error ('Het uploaden van het plaatje is mislukt<br><br>');
} else {
if (!file_put_contents( $config['map'] . 'photo_description.txt', '>' . $_FILES['upload']['name'] . '<' . htmlentities($_POST['description']), FILE_APPEND)) {
unlink($config['map'] . $_FILES['upload']['name']);
error ('Het commentaar kon worden opgeslagen. Het plaatje is niet geupload');
} else {
echo 'Je plaatje is geupload!<br><br>';
}
}
}
} else {
?>
<table> <form method="post" enctype="multipart/form-data" name="upload">
<tr>
<td height="56">File:</td>
<td><input type="file" name="upload" id="upload"></td>
</tr>
<tr>
<td>Omschrijving:</td>
<td><input type="text" name="description"></td>
</tr>
<tr>
<td>Upload:</td>
<td><p> </p>
<p>
<input type="submit" name="uploaden" value="uploaden" />
</p></td>
</tr>
</form></table>
<?php
} ?>
<br><b>Delete jpg-files</b><hr color=#000000 size="1">
<?php
$the_array = Array();
$handle = opendir('Apparel');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") { /* as descripted below: these "files" will not be added to the array */
$the_array[] = $file;
}
}
closedir($handle);
echo "<form action=\"index.php?page=admin7\" method=\"post\">";
echo " <select name=\"verwijderen\">";
foreach ($the_array as $element) {
echo "\n <option>$element <br></option> ";
}
echo "\n";
echo "</select> <input type=\"submit\" name=\"action\" value=\"Verwijder\">";
if($_POST['verwijderen']) {
//verwijderen
if($_POST['verwijderen'] !='.thumbs' AND $_POST['verwijderen'] !='.modified' AND $_POST['verwijderen'] != 'photo_description.txt') {
unlink("Apparel/" . $_POST['verwijderen']);
$descriptions = explode('>',file_get_contents('photo_description.txt'));
$descriptions_array = array();
while ($value = next($descriptions)) {
$value = explode('<', $value);
$descriptions_array[$value[0]] = $value[1];
}
unset($descriptions_array[$_POST['verijderen']]);
echo "<br><br><b>Deleting... </b>";
echo "<META HTTP-EQUIV=\"REFRESH\"CONTENT=\"0.5; URL=index.php?page=admin7\">";
} else { echo '<br><br>Not allowed.'; }}
?>
</form>
<br><br>
<i>Make your choice: <a href=index.php?page=admin3>[Portal]</a> <a href=index.php?page=admin3> [Home]</a> <a href=index.php?page=admin10> [Team]</a> <a href=index.php?page=admin5>[News]</a> <a href=index.php?page=admin4>[Pictures]</a> <a href=index.php?page=admin6> [Calendar]</a> <a href=index.php?page=3> [Results]</a> <a href=index.php?page=admin12> [Products]</a> <a href=index.php?admin7> [Apparel]</a> <a href=index.php?page=11> [Contact]</a> <a href=index.php?page=admin9>[Logout]</a></i>
<?php } else { echo '<b>Controlpanel</b><hr color=#FF0000 size="1"><br>Sorry, no permission.';} ?>