<?php
    
include "config.php";
    if (isset(
$_REQUEST['del']))
    {
        
$f $_REQUEST['del'];
        if (
file_exists("$thepath/$f"))
        {
            
system("rm $thepath/$f");
            
header("Location: index.php");
        }        
        else
            echo 
"<font color=red>File could not be deleted; no file by that name exists.</font><br>";
        
    }

    
system("ls -1t --color=never --almost-all $thepath | grep -v in | grep -v out > /tmp/some_list3991-0s022");
    
$a file("/tmp/some_list3991-0s022");
    if (isset(
$a[0]))
    {
        echo 
"<h1>Recordings found:</h1><br>";
        
$i 1;
        
        foreach(
$a as $b)
        {
            
$k explode("."$b);
            
$l explode("-"$k[0]);
            
$q date('F j, Y \a\t g:i a'$l[1]);
            
            echo 
"$i. $q by <b>".$l[2]."</b>, while connected to <b>".$l[3]."</b> - <a href=monitor/$b>Listen</a> - <a href=\"dl.php?fn=$b\">Download</a> - <a href=\"confirm_delete.php?which=$b\">Delete</a><br>\n";
            
$i++;
            
        }
        
    }
    else
        echo 
"<center><h1>No Recordings Found</h1></center><br>";
    
    echo 
"<center><h2>Record a conversation by pressing *#<br>";
    echo 
"on your phone. Then check back here.</h2><br>";
    echo 
"<font size=\"+1\"><a href=index.php>Check again</a></font></center>";


?>