<?php

/* Check to see if all values are there, and link them to variables */
if (isset($_GET['username'])){
    $userName = $_GET['username']; 
} 



if (isset($_GET['time'])){
    $timeInterval = $_GET['time'];
    
} 
if (isset($_GET['data'])){
    $dataType = $_GET['data'];
    
} 

$customReportFile = $userName.$dataType.'.txt';

//$customReportString = file_get_contents($customReportFile);
$customReportStringContainer = file($customReportFile);
$customReportString = '';
for ($i = 0; $i < $timeInterval; $i++){
    $customReportString = $customReportStringContainer[11-$i].$customReportString;
    
}
$customReportString = preg_replace('/[ ]{2,}|[\t]/', ' ', trim($customReportString));
echo "<pre>".$customReportString."</pre>";
//echo "<pre>".$userName."</pre>";
//echo "Test test test";
?>
