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 "Datei konnte nicht Kopiert werden!
"; break; case "2": echo "Keine Datei angegeben oder Datei zu gross!
"; break; } ?>