break; case 'json': echo "{\r\n\t\t\t\"MAXIMUM_PARALLEL_DOWNLOADS\" : " . MAXIMUM_PARALLEL_DOWNLOADS . ",\r\n\t\t\t\"MAXIMUM_DAILY_DOWNLOADS\" : " . MAXIMUM_DAILY_DOWNLOADS . ",\r\n\t\t\t\"PARALLEL_DOWNLOADS\" : " . get_current_downloads() . ",\r\n\t\t\t\"DAILY_DOWNLOADS\" : " . get_daily_downloads() . ",\r\n\t\t\t\"DOWNLOAD_ABILITY\" : "; echo check_download_ability() ? 'true' : 'false'; echo "}"; break; case 'reset': if ($_GET['password'] == RESET_PASSWORD) { reset_sessions(); } default: $template_vars['maximum_parallel'] = MAXIMUM_PARALLEL_DOWNLOADS; $template_vars['maximum_daily'] = MAXIMUM_DAILY_DOWNLOADS; $template_vars['current'] = get_current_downloads(); $template_vars['day'] = get_daily_downloads(); $template_vars['download_ability'] = check_download_ability(); $seconds_to_next_reset_daily = mktime(0, 0, 0, date('m') + $mth, date('d') + 1, date('Y')) - time(); $seconds_to_next_reset_current = AVG_DOWNLOAD_TIME - (time() - get_oldest_current()); $seconds_to_next_reset = !check_download_ability_current() && check_download_ability_daily() ? $seconds_to_next_reset_current : $seconds_to_next_reset_daily; $next_reset_houre = floor($seconds_to_next_reset / 60 / 60); $next_reset_minute = round($seconds_to_next_reset / 60 - $next_reset_houre * 60); $template_vars['next_reset'] = $next_reset_houre . ' hours ' . $next_reset_minute . ' minutes'; echo loadTemplate('./template/status.html', $template_vars); } /** * My cool template engine ;-) * @param $template_path * @param $template_variables * @return string */ function loadTemplate($template_path, $template_variables)
<?php /* * Author: Hendrik Still * Email: gamma32@gmail.com */ require_once 'config.php'; require_once 'lib.php'; $requested_file = $_GET['file']; //file alias $file_path = $files[$requested_file]['path']; //real filepath $file_name = $files[$requested_file]['name']; if (isset($file_path)) { //check if alias exists if (check_download_ability()) { $session_name = create_session_files(); sent_header($file_name, $file_path); readfile($file_path); // remove_session_file($session_name); } else { header('Location:' . NO_DOWNLOAD_REDIRECTION); } } else { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); }