HTML interesse |
|
dit is het 'scriptje':
<?php
include 'db.php';
$datum=date("j F Y");
echo "
<FORM NAME='upload' METHOD='post' ACTION='index.php?inh=upload'>
Name:<INPUT TYPE='text' NAME='naam'><BR>
Link:<INPUT TYPE='text' NAME='link'><BR>
File?:<br>
Yes<input type='radio' name='file' value='yes' /><br>
No<input type='radio' name='file' value='no' checked /><br>
File:<input type='file' name='torrent' /><br>
Size(KB):<INPUT TYPE='text' NAME='size'>(MB)<BR>
Sort: <SELECT name='sort'>
<option name='software'>software</option>
<option name='mp3'>mp3</option>
<option name='games'>games</option>
</SELECT><br>
<INPUT TYPE='Submit' NAME='Submit' VALUE='Submit'>
<INPUT TYPE='Reset' NAME='Reset' VALUE='Reset'>
</FORM>";
if ($_POST['Submit']) {
if ($file=no){
$query="INSERT INTO torrents (naam, link, datum, downloads, sort, size) VALUES ('$naam', '$link', '$datum', '$downloads', '$sort', '$size')";
mysql_query($query) or die (mysql_error());
echo "Uploaded";
}
else {
$query="INSERT INTO torrents (naam, link, datum, downloads, sort, size) VALUES ('$naam', 'http://members.lycos.nl/justtorrents/torrents/$name', '$datum', '$downloads', '$sort', '$size')";
mysql_query($query) or die (mysql_error());
echo "Uploaded";
$locatie="torrents/"; //of een andere map, vergeet niet de w-rechten
if(is_uploaded_file($_FILES['torrent']['tmp_name']))
{
//controleer grootte
if($_FILES['afbeelding']['size']>20000)
{ //bepaal zelf de max. grootte in bytes
echo "the file is to huge";
exit;
}
//controleer extensie, voeg maar andere toe
if(!eregi("((.torrent)$)", $_FILES['torrent']['name']))
{
echo "the file must have an .torrent extension";
exit;
}
if(!move_uploaded_file($_FILES['torrent']['tmp_name'],
$locatie.$_FILES['torrent']['name']))
{
echo"the file can't be moved";
exit;
}
echo "You're file ".$_FILES['torrent']['name']." is uploaded";
}
else
{
echo "failed to upload";
}
}
}
?>
<?php include 'db.php'; <FORM NAME='upload' METHOD='post' ACTION='index.php?inh=upload'> Name:<INPUT TYPE='text' NAME='naam'><BR> Link:<INPUT TYPE='text' NAME='link'><BR> File?:<br> Yes<input type='radio' name='file' value='yes' /><br> No<input type='radio' name='file' value='no' checked /><br> File:<input type='file' name='torrent' /><br> Size(KB):<INPUT TYPE='text' NAME='size'>(MB)<BR> Sort: <SELECT name='sort'> <option name='software'>software</option> <option name='mp3'>mp3</option> <option name='games'>games</option> </SELECT><br> <INPUT TYPE='Submit' NAME='Submit' VALUE='Submit'> <INPUT TYPE='Reset' NAME='Reset' VALUE='Reset'> </FORM>"; if ($_POST['Submit']) { if ($file=no){ $query="INSERT INTO torrents (naam, link, datum, downloads, sort, size) VALUES ('$naam', '$link', '$datum', '$downloads', '$sort', '$size')"; } else { $query="INSERT INTO torrents (naam, link, datum, downloads, sort, size) VALUES ('$naam', 'http://members.lycos.nl/justtorrents/torrents/$name', '$datum', '$downloads', '$sort', '$size')"; $locatie="torrents/"; //of een andere map, vergeet niet de w-rechten { //controleer grootte if($_FILES['afbeelding']['size']>20000) { //bepaal zelf de max. grootte in bytes echo "the file is to huge"; } //controleer extensie, voeg maar andere toe if(!eregi("((.torrent)$)", $_FILES['torrent']['name'])) { echo "the file must have an .torrent extension"; } $locatie.$_FILES['torrent']['name'])) { echo"the file can't be moved"; } echo "You're file ".$_FILES['torrent']['name']." is uploaded"; } else { } } } ?>
het gaat vooral om het onderste gedeelte, het werkt niet, hij voegt iets heel anders toe, hij doet de link fout invoeren, hij upload de torrent ook niet
|