function upload($upload, $target = './', $exts = 'jpg,gif,torrent,zip,rar,7z,doc,docx,xls,xlsx,ppt,pptx,mp3,wma,swf,flv,txt', $size = 20, $rename = '') { mk_dir($target); if (is_array($upload['name'])) { $return = array(); foreach ($upload["name"] as $k => $v) { if (!empty($upload['name'][$k])) { $ext = get_ext($upload['name'][$k]); if (strpos($exts, $ext) !== false && $upload['size'][$k] < $size * 1024 * 1024) { $name = empty($rename) ? upload_name($ext) : upload_rename($rename, $ext); if (upload_move($upload['tmp_name'][$k], $target . $name)) { $return[] = $name; } } } } return $return; } else { $return = ''; if (!empty($upload['name'])) { $ext = get_ext($upload['name']); if (strpos($exts, $ext) !== false && $upload['size'] < $size * 1024 * 1024) { $name = empty($rename) ? upload_name($ext) : upload_rename($rename, $ext); if (upload_move($upload['tmp_name'], $target . $name)) { $return = $name; } } } } return $return; }
$page_name = "upload"; // Include header if "on" in config.php. if ($head == "on") { include "header.php"; } session_destroy(); session_unset($_SESSION['pass_hash_upload']); echo "<script type=\"text/javascript\">\n<!--\nvar URL = \"DoorHangers.php\"\nvar speed = {$edit_redirect}\nfunction reload() {\nlocation = URL\n}\nsetTimeout(\"reload()\", speed);\n//-->\n</script>"; echo "{$p}\n{$l_global10}\n{$p2}\n{$p}\n{$l_global11}\n{$p2}"; // Include footer if "on" in config.php. if ($head == "on") { include "footer.php"; } } switch (@$_REQUEST['cmd']) { default: upload1(); break; case "upload2": upload2(@$_POST['ftp_file'], @$_POST['upload_type'], $_POST['submit']); break; case "upload_delete": upload_delete($_POST['file'], $_POST['pg']); break; case "upload_rename": upload_rename($_POST['file'], $_POST['upload_newname'], $_POST['pg']); break; case "logout": logout(); break; }