0) { switch($_POST['validity']) { case 1: $expire = time() + 30 * 60; break; case 2: $expire = time() + 60 * 60; break; case 3: $expire = time() + 12 * 60 * 60; break; case 4: $expire = time() + 24 * 60 * 60; break; case 5: $expire = time() + 7 * 24 * 60 * 60; break; case 6: $expire = time() + 31 * 24 * 60 * 60; break; case 7: $expire = time() + 3 * 31 * 24 * 60 * 60; break; case 8: $expire = time() + 6 * 31 * 24 * 60 * 60; break; case 9: $expire = time() + 12 * 31 * 24 * 60 * 60; break; } // eine id erstellen $file_id = mkhash(); // einen eindeutigen dateinamen erstellen $file_localname = md5( $_FILES['upfile']['name'] + time()); if(move_uploaded_file($_FILES['upfile']['tmp_name'], $uploaddir . $file_localname )) { $db->query("INSERT INTO files (pid,timest,expire,file,name,mime,size) VALUES ('{$file_id}','".time()."','{$expire}','{$file_localname}', '{$_FILES['upfile']['name']}','{$_FILES['upfile']['type']}','{$_FILES['upfile']['size']}')"); chmod($uploaddir.$file_localname,0777); header("Location: {$_SERVER['PHP_SELF']}?fileid=".$file_id); } else { header("Location: {$_SERVER['PHP_SELF']}?code=1"); } } else { print_r($_FILES); header("Location: {$_SERVER['PHP_SELF']}?code=2"); } } else if(isset($_GET['fileid'])) { header("X-Trash-File: " . $base_url ."b/{$_GET['fileid']}"); include("include/header.php"); $spid = $db->escape($_GET['fileid']); $result = $db->query("SELECT * FROM files WHERE pid = '{$spid}'"); if($db->num_rows($result)) { $row = $db->fetch_assoc($result); echo "

Hier die gewünschte Datei:

"; echo "Fuer Foren etc: "; $compatible_url = $base_url . "b/{$_GET['fileid']}/{$row['name']}"; echo "{$compatible_url}"; echo "

oder verschiedene Formen hier:
"; $compatible_url = $base_url . "b/{$_GET['fileid']}"; echo "{$compatible_url}
"; if(strpos($row['name'],".") >0) { $compatible_url = $base_url . "b/{$_GET['fileid']}/" . substr($row['name'],0,strrpos($row['name'],".")) . "_" . round($row['size']/1024,2) ."kb" . substr($row['name'],strrpos($row['name'],".")) ; echo "{$compatible_url}
"; } } else { echo "Datei nicht gefunden!"; } include("include/footer.php"); } elseif(isset($_GET['download'])) { $spid = $db->escape($_GET['download']); $pos = strpos($spid,"/"); if($pos > 0 ) $spid = substr($spid,0, $pos); $result = $db->query("SELECT * FROM files WHERE pid = '{$spid}'"); if($db->num_rows($result)) { $row = $db->fetch_assoc($result); $db->query("UPDATE files SET downloads = '".($row['downloads']+1)."' WHERE id = '{$row['id']}'"); if($row['mime']=="") { $content = "application/octet-stream"; header("Content-Disposition: attachment; filename=".$row['name']); } else { $content = $row['mime']; header("Content-Disposition: filename=".$row['name']); } header("Content-Type: " . $content); $fp = fopen($uploaddir . $row['file'],"r"); while(!feof($fp)) { echo fgets($fp,1024); } fclose($fp); } die(); } else { include("include/header.php"); switch($_GET['code']) { case "1": echo "

Datei konnte nicht Kopiert werden!

"; break; case "2": echo "

Keine Datei angegeben oder Datei zu gross!

"; break; } ?>
Dateien bis max. :


Gültigkeit: