2 function scan_dir($dir) {
3 $ignored = array('.', '..', '.htaccess','index.php','getmail.php');
5 foreach (scandir($dir) as $file) {
6 if (in_array($file, $ignored)) continue;
7 $files[$file] = filemtime($dir . '/' . $file);
10 $files = array_keys($files);
11 return ($files) ? $files : false;
13 include '../api/functions.php';
16 if (isset($_GET['box'])){
17 if (strpos($_GET['box'],'/') or strpos($_GET['box'],'..') or strpos($_GET['box'],'\\')){}
19 if ($_GET['box']==''){$_GET['box']=='mails';}
20 echo 'Raw Box of '.preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$_GET['box'].'\\<br>';
21 foreach (scan_dir(getcwd().'\\'.preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$_GET['box'].'\\') as $d){
22 include preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$_GET['box'].'\\'.$d;
23 try{echo '<a href="getmail.php?box='.$_GET['box'].'&id='.$d.'">'.$sender.'</a> '.$date.'<br>';}catch (Exception $e){echo '<a href="getmail.php?id='.$d.'">'.$sender.'</a> <br>';}
28 foreach (scan_dir(getcwd().'\\'.preg_split('/@/',$_SESSION['m_user'])[0]) as $d){
29 foreach (scan_dir(getcwd().'\\'.preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$d.'\\') as $i){
30 include preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$d.'\\'.$i;
31 echo '<a href="getmail.php?id='.$i.'">'.$sender.'</a> '.$date.' '.$d.'<br> ';
37 header('Location: ../login.php');