File manager - Edit - /home/missmand/public_html/learning/old/main/cooperation/download.php
Back
<?php require_once '../inc/global.inc.php'; require_once(api_get_path(SYS_PATH) . 'main/subrole/subrole.php'); require_once(api_get_path(SYS_PATH) . 'main/couple/error.php'); require_once(api_get_path(SYS_PATH) . 'main/couple/doc.php'); require_once(api_get_path(SYS_PATH) . 'main/couple/doc_system.php'); if (isset($_GET['couple_id']) && isset($_GET['couple_type'])) { $couple_id = read_param('couple_id', false); $couple_type = strtoupper(read_param('couple_type', false)); $title = doc_convert_filename(read_param('title', false)); $user_id = api_get_user_id(); if (!UserManager::is_user_id_valid($user_id)) error_throw('User id is not valid'); // File uplaod if (couple_id_is_valid($couple_id, $couple_type) && couple_includes_user($couple_id, $couple_type, $user_id)) { $file = DIRECTORY_FOR_UPLOAD . "$couple_id/" . strtolower($couple_type) . "/$title"; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); } else { error_throw('You are not allowed to download this file'); } } else { error_throw("Expected GET couple_id and GET couple_type"); }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings