<?php require_once "../../../inc/header.inc.php"; require_once $sIncPath . "customFunctions.inc.php"; $bResult = false; $sId = (int) $_GET["id"]; $sToken = process_db_input($_GET["token"]); $sFile = "files/" . $sId . "." . (isset($_GET["ext"]) && preg_match('/^[0-9a-z]+$/', $_GET["ext"]) ? $_GET["ext"] : "mp3"); $sType = "audio/" . (isset($_GET["ext"]) && preg_match('/^[0-9a-z]+$/', $_GET["ext"]) ? $_GET["ext"] : "mpeg"); if (!empty($sId) && !empty($sToken) && file_exists($sFile)) { require_once $sIncPath . "db.inc.php"; $sId = getValue("SELECT `ID` FROM `RayMp3Tokens` WHERE `ID`='" . $sId . "' AND `Token`='" . $sToken . "' LIMIT 1"); $bResult = !empty($sId); } if ($bResult) { require_once $sIncPath . "functions.inc.php"; smartReadFile($sFile, $sFile, $sType); } else { readfile($sFileErrorPath); }
<?php require_once "../../../inc/header.inc.php"; require_once $sIncPath . "customFunctions.inc.php"; $bResult = false; $sId = (int) $_GET["id"]; $sToken = process_db_input($_GET["token"]); $sExt = isset($_GET["ext"]) && preg_match('/^[0-9a-z]+$/', $_GET["ext"]) ? $_GET["ext"] : (file_exists("files/" . $sId . ".m4v") ? "m4v" : "flv"); $sFile = "files/" . $sId . "." . $sExt; if (!empty($sId) && !empty($sToken) && file_exists($sFile)) { require_once $sIncPath . "db.inc.php"; $sId = getValue("SELECT `ID` FROM `RayVideo_commentsTokens` WHERE `ID`='" . $sId . "' AND `Token`='" . $sToken . "' LIMIT 1"); $bResult = !empty($sId); } if ($bResult) { require_once $sIncPath . "functions.inc.php"; smartReadFile($sFile, $sFile, "video/" . ('m4v' == $sExt ? 'x-' . $sExt : $sExt)); } else { readfile($sFileErrorPath); }
<?php $bResult = false; $sId = (int) $_GET["id"]; $sFile = "files/" . $sId . ".m4v"; require_once "../../../inc/header.inc.php"; if (!empty($sId) && file_exists($sFile)) { require_once $sIncPath . "constants.inc.php"; require_once $sIncPath . "xml.inc.php"; require_once $sIncPath . "functions.inc.php"; require_once $sIncPath . "apiFunctions.inc.php"; $bResult = getSettingValue("video", "saveMobile") == TRUE_VAL; } if ($bResult) { require_once $sIncPath . "functions.inc.php"; smartReadFile($sFile, $sFile, "video/mp4"); } else { readfile($sFileErrorPath); }
function downloadBackup($file) { global $_CONFIG; $file = realpath($_CONFIG['clonerPath'] . "/{$file}"); //First, see if the file exists if (!is_file($file)) { die("<b>404 File {$file} was not found!</b>"); } //File Info $len = get_filesize($file); $filename = basename($file); $file_extension = strtolower(substr(strrchr($filename, "."), 1)); //Setam Content-Type-urile pentru fisierul in cauza switch ($file_extension) { default: $ctype = "application/force-download"; } smartReadFile($file, $filename); exit; }
header('Pragma: no-cache'); header('Accept-Ranges: bytes'); header("Content-Description: File Transfer"); header('Content-Length:' . ($end - $begin)); header("Content-Range: bytes {$begin}-{$end}/{$size}"); header("Content-Disposition: attachment; filename={$filename}"); //header("Content-Disposition: inline; filename=$filename"); header("Content-Transfer-Encoding: binaryn"); header("Last-Modified: {$time}"); header('Connection: close'); $cur = $begin; fseek($fm, $begin, 0); while (!feof($fm) && $cur < $end && connection_status() == 0) { print fread($fm, min(1024 * 16, $end - $cur)); $cur += 1024 * 16; } } if (!empty($_GET['file'])) { $filePath = substr($_SERVER['DOCUMENT_ROOT'], 0, -1) . trim($_GET['file']); if (file_exists($filePath)) { if (in_array(pathinfo($filePath, PATHINFO_EXTENSION), $allowedExtensions)) { smartReadFile($filePath, pathinfo($filePath, PATHINFO_BASENAME)); } else { send404(); } } else { send404(); } } else { send404(); }
<?php require_once "../../../inc/header.inc.php"; require_once $sIncPath . "customFunctions.inc.php"; $bResult = false; $sId = (int) $_GET["id"]; $sToken = process_db_input($_GET["token"]); $sExt = file_exists("files/" . $sId . ".m4v") ? "m4v" : "flv"; $sFile = "files/" . $sId . "." . $sExt; if (!empty($sId) && !empty($sToken) && file_exists($sFile)) { require_once $sIncPath . "db.inc.php"; $sId = getValue("SELECT `ID` FROM `RayVideo_commentsTokens` WHERE `ID`='" . $sId . "' AND `Token`='" . $sToken . "' LIMIT 1"); $bResult = !empty($sId); } if ($bResult) { require_once $sIncPath . "functions.inc.php"; smartReadFile($sFile, $sFile, "video/x-" . $sExt); } else { readfile($sFileErrorPath); }
$ip = getenv('HTTP_CLIENT_IP') ?: getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_X_FORWARDED') ?: getenv('HTTP_FORWARDED_FOR') ?: getenv('HTTP_FORWARDED') ?: getenv('REMOTE_ADDR'); setlocale(LC_TIME, 'fr_FR.utf8', 'fra'); date_default_timezone_set('Europe/Paris'); $today = date("Y-m-d"); $useragent = getenv("HTTP_USER_AGENT"); try { $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $bdd = new PDO('mysql:host=' . _PAULODB_SERVEUR . ';dbname=' . _PAULODB_BD, _PAULODB_LOGIN, _PAULODB_MDP, $options); if (isset($dl)) { $sql = "INSERT INTO log_ecoute (timeslot, download, dl_ip, dl_day, dl_useragent) VALUES ('" . $datetime . "', 1, '" . $ip . "', '" . $today . "', '" . $useragent . "') on duplicate key update timeslot = timeslot"; } else { $sql = "INSERT INTO log_ecoute (timeslot, download, dl_ip, dl_day, dl_useragent) VALUES ('" . $datetime . "', 0, '" . $ip . "', '" . $today . "', '" . $useragent . "') on duplicate key update timeslot = timeslot"; } //echo $sql; $prep = $bdd->query($sql); } catch (Exception $e) { // En cas d'erreur précédemment, on affiche un message et on arrête tout header("HTTP/1.1 404 Not Found"); die('Erreur : ' . $e->getMessage()); } } } else { header("HTTP/1.1 404 Not Found"); die("No hour or date defined"); } $file = $date . "-" . $fullhour . "00.mp3"; $path = "../OK/" . $date . "/" . $file; $type = "audio/mpeg"; require_once 'smartReadFile.php'; smartReadFile($path, $file, $type, $dl);
// grab the requested file's name $file_name = $file; // make sure it's a file before doing anything! if (is_file($file_name)) { /* Do any processing you'd like here: 1. Increment a counter 2. Do something with the DB 3. Check user permissions 4. Anything you want! */ // required for IE if (ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } $mime = mime_content_type($file_name); if ($_GET['thumb'] == 1) { header('Content-Type: ' . $mime); readfile($file_name, filesize($filename)); // push it out exit; } else { set_time_limit(0); smartReadFile($file_name, basename($file_name), $mime); exit(0); } } } } else { auth_redirect(); }
switch ($file[count($file) - 1]) { case 'mp3': $type = 'audio/mpeg'; break; case 'ogg': $type = 'audio/ogg'; break; case 'oga': $type = 'audio/ogg'; break; case 'm4a': $type = 'audio/mp4'; break; case 'm4v': $type = 'video/mp4'; break; case 'mp4': $type = 'video/mp4'; break; case 'webm': $type = 'video/webm'; break; case 'ogv': $type = 'video/ogg'; break; } $path = $base . $filename; // Include and call smartReadFile require_once 'smartReadFile.php'; smartReadFile($path, $filename, $type);
<?php require_once "common.php"; $filePath = getPathFromURL(); smartReadFile($filePath, basename($filePath)); exit;
<?php require_once "../../../inc/header.inc.php"; require_once $sIncPath . "customFunctions.inc.php"; $bResult = false; $sId = (int) $_GET["id"]; $sToken = process_db_input($_GET["token"]); $sFile = "files/" . $sId . ".mp3"; if (!empty($sId) && !empty($sToken) && file_exists($sFile)) { require_once $sIncPath . "db.inc.php"; $sId = getValue("SELECT `ID` FROM `RayMp3Tokens` WHERE `ID`='" . $sId . "' AND `Token`='" . $sToken . "' LIMIT 1"); $bResult = !empty($sId); } if ($bResult) { require_once $sIncPath . "functions.inc.php"; smartReadFile($sFile, $sFile, "audio/mpeg"); } else { readfile($sFileErrorPath); }