ik heb een script en als je dan een download toevoegd wil ik dat je een plaatje upload
ik heb zitten knoeien en het werkt half het script dat ik heb is:
voor toevoegen en de include van uploaden:
ik heb zitten knoeien en het werkt half het script dat ik heb is:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]add[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam_download[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Je hebt de naam van de download niet ingevuld.<br>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tekst die komt als je de naam niet hebt ingevuld[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url_download[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"Je hebt de URL naar de download niet ingevuld.<br>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tekst die komt als je de url van de download niet hebt ingevuld[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]type[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"niks"[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"Je moet selecteren wat voor extensie je download heeft.<br>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tekst die komt als je de type hebt geselecteerd[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]cat[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"niks"[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"Je moet aangeven in welke categorie je je download wil posten.<br>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// tekst die komt als je geen categorie hebt geselecteerd[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]grootte[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"Je hebt de grootte van de download niet ingevuld.<br>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tekst die komt als je de grootte van de download niet hebt ingevuld[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"Je hebt geen beschrijving van de download ingevuld.<br>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tekst die komt als je de beschrijving niet hebt ingevuld[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$error[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$beschrijving[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]]);[/COLOR] [COLOR= #FF8000]// enters om zetten in <br />[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO downloadsysteem (naam_van_download, url_van_download,
type, grootte, kleine_afbeelding, beschrijving, cat) VALUES
("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam_download[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url_download[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]type[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]grootte[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]kleine_afbeelding[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$beschrijving[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]cat[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// download invoegen in de database[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] [COLOR= #FF8000]// sql query uitvoeren[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je download is succesvol toegevoegd!"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tekst die komt als de download is ingevoegd[/COLOR]
[COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je download is niet toegevoegd om de volgende reden(en)<br><font color="#FF0000">"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$error[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"</font>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// tekst die komt als je een error krijgt[/COLOR]
[COLOR= #007700]}
}[/COLOR]
?>
<form method="post" action="">
<table width="60%" cellspacing="0" cellpadding"0">
<tr>
<td>Naam van de download: (<font color="#FF0000"><strong>*</strong></font>)</td>
<td><input type="text" size="40" name="naam_download"></td>
</tr>
<tr>
<td><b>URL</b> van download: (met http://) (<font color="#FF0000"><strong>*</strong></font>)</td>
<td><input type="text" size="40" name="url_download"></td>
</tr>
<tr>
<td>Extentie: (<font color="#FF0000"><strong>*</strong></font>)</td>
<td><select name="type">
<option value="niks">Kies een type</option>
<option value=".rar">.rar</option>
<option value=".zip">.zip</option>
<option value=".exe">.exe</option>
<option value=".tar">.tar</option>
<option value=".tar.gz">.tar.gz</option>
<option value=".torrent">.torrent</option>
<option value="Anders">Onbekend</option></select>
</tr>
<tr>
<td>Categorie: (<font color="#FF0000"><strong>*</strong></font>)</td>
<td><select name="cat">
<option value="niks">Kies een categorie</option>
<option value="1">Catogorie 1</option>
<option value="2">Catogorie 2</option>
<option value="3">Catogorie 3</option>
<option value="4">Catogorie 4</option>
<option value="5">Catogorie 5</option>
<option value="6">Catogorie 6</option></select>
</tr>
<tr>
<td>Grootte: (MB) (<font color="#FF0000"><strong>*</strong></font>)</td>
<td><input type="text" size="40" maxlength="10" name="grootte"></td>
</tr>
<tr>
<td>URL afbeelding:</td>
<td>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"img/upload/uploaden.php"[/COLOR][COLOR= #007700])[/COLOR] ?></td>
</tr>
<tr>
<td>Beschrijving: (<font color="#FF0000"><strong>*</strong></font>)</td>
<td><textarea name="beschrijving" rows="5" cols="30"></textarea><input type="hidden" value="1" name="add"></td>
</tr>
<tr>
<td> </td>
<td>(<font color="#FF0000"><strong>*</strong></font>) is verplicht</td>
</tr>
<tr>
<td><input type="reset" value="Maak alles leeg!"></td>
<td><input type="submit" name="submit" value="Voeg download toe!"></td>
</tr>
</table>
</form> voor toevoegen en de include van uploaden:
<form method="post" action="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]];[/COLOR] ?>" enctype="multipart/form-data">
<input type="file" name="kleine_afbeelding"><br>