| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/governmentgrants.us/vx/usa/givesback/ |
Upload File : |
<?php
function pretty_string($str)
{
return ucwords(str_replace('_',' ',$str));
}
function pretty_size($str)
{
$end = array('B','KB','MB','GB','TB','PB','EB','ZB','YB');
$i = 0;
while($str >= 1024 && $i < count($end))
{
$i++;
$str /= 1024;
}
return round($str,2).' '.$end[$i];
}
if(!empty($_GET['file'])) {
require_once('AWSSDKforPHP/sdk.class.php');
define('AWS_KEY','AKIAJIOW3K3BIX5SRZIQ');
define('AWS_SECRET_KEY','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');
try {
$s3 = new AmazonS3();
} catch(Exception $e) {
die('<pre>'.print_r($e,true).'</pre>');
}
if(!$s3->if_bucket_exists('media.learningcentersupport.com'))
{
die('Can\'t connect to storage server for audio recordings');
}
$recordings = array();
try {
$meta = $s3->get_object_metadata('media.learningcentersupport.com', $_GET['file']);
} catch(Exception $e) {
die('<pre>'.print_r($e,true).'</pre>');
}
$url = $s3->get_object_url('media.learningcentersupport.com', $_GET['file'], '8 hour');
//$url = str_replace('.s3.amazonaws.com','',$url);
$urlParts = explode('/',preg_replace('/\?.*/','',urldecode($url)));
$fileName = $urlParts[count($urlParts)-1];
$type = $urlParts[count($urlParts)-2];
$fileParts = explode('.',$fileName);
$uuid = $fileParts[0];
$recordings[] = array(
'url' => $url,
'fileName' => $fileName,
'type' => pretty_string($type),
'UUID' => $uuid,
'fileSize' => pretty_size($meta['Size']),
'dateCreated' => date('m/d/Y h:i:s',strtotime($meta['Headers']['last-modified']))
);
foreach($recordings as $r) {
if(!empty($_GET['mime'])) {
$mime = $_GET['mime'];
} else {
switch(strtolower(substr(strrchr($r['fileName'], '.'), 1))) {
case 'pdf': $mime = 'application/pdf'; break;
case 'zip': $mime = 'application/zip'; break;
case 'jpeg':
case 'jpg': $mime = 'image/jpg'; break;
case 'png': $mime = 'image/png'; break;
case 'html': $mime = 'text/html'; break;
default: $mime = 'application/force-download';
}
}
//header("Location: ".$r['url']);
$file = file_get_contents($r['url']);
header('Content-Disposition: inline; filename="'.$r['fileName'].'"');
header('Content-Type: '.$mime);
die($file);
}
}
?>