<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<!--
<!DOCTYPE html>
 -->
<html lang="en">

<head>
        <meta charset="utf-8">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!--
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <link rel="stylesheet" href="style.css">
        <script src="script.js"></script>
-->
        <title>email repository</title>
        <style type="text/css">
				a:hover, a:visited, a:link, a:active {
					color: crimson;
					text-decoration: none;
				}
        </style>
</head>

<body>
<!--
        <nav style="text-align: center;">
                <div id="home">home</div>
        </nav>
        <div id='main'>
                <div id='content' style="text-align: center;">
                        <div id='' class=''></div>
                </div>
        </div>
-->

		<?
			date_default_timezone_set('America/New_York');
			// var_dump( $_SERVER );
			// echo ;

			if ( isset($_GET['repository']) && $_GET['repository'] == 'A521DCAC-AC19-4E10-AEC0-D1CA3566729D' ) {



	date_default_timezone_set('America/New_York');
	$epoch = time();
	file_put_contents( '../tracker/'.$_SERVER['REMOTE_ADDR']."__.txt", $epoch );


				$temp_files = glob(__dir__.'/*');
				echo '<br/>';
				echo '<h1>Log of emails sent</h1>';
				echo '<br/>';
				echo '<div>';
				$temp_files = array_reverse( $temp_files );
				$i = 0;
				foreach($temp_files as $file) {
					$file = str_replace( getcwd().'/', '' , $file );



					if ( $file != 'index.php' && $file != 'error_log' && stripos($file,'.htm') !== false ) {
						$hours = 7;
						$fileSplit = explode('__', $file);
						$epoch = intval( $fileSplit[0] );
						// $epoch = time();

						$micro = sprintf("%06d",($epoch - floor($epoch)) * 1000000);
						$dt = new DateTime( date('Y-m-d H:i:s.'.$micro, $epoch) );

						// $epoch = $epoch + ( 60 * 60 * $hours );
						// $dt = new DateTime("@$epoch");
						$theDate = $dt->format('Y-m-d H:i:s');
						// $theDate->add(new DateInterval("PT{$hours}H"));
						$printFile = str_replace($fileSplit[0], $theDate, $file);

						$fileSplit = explode('__', $printFile);

						echo '<div style="display:inline-block;"><a href="' . urlencode($file) . '" target="_blank">';
						echo '<div style="display:inline-block;">' . $fileSplit[0] . '</div>';
						echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
						echo '<div style="display:inline-block;">' . str_replace( '-', ': ' , $fileSplit[1] ) . '</div>';
						echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
						// echo '&emsp;&emsp;';
						echo '<div style="display:inline-block;" class="file" >' . str_replace( '-', '&nbsp;&nbsp;&nbsp;&nbsp;' ,          str_replace( 'CARDS-', 'CARDS: ' , $fileSplit[2] )         ) . '</div>';
						echo '<br/>';

						echo '</a><br/></div><br/>';
					}
					$i++;
				}
				echo '</div>';


			} else {
				echo "not authorized";
			}
		?>




        <script type="text/javascript">
                appName = {};
                appName.v = {};
                appName.form = {
                        record: 0,
                        guid: '',
                        one: function() {
                                $.post(
                                "file.php", {
                                                'id': 0
                                        },
                                        function(data) {
                                                appName.form.two(data)
                                        }
                                );
                                // appName.form.one();
                        }, //==============================================
                        two: function(data) {
                                console.log(data);
                                // appName.form.two();
                        } //==============================================
                };
        </script>

</body>

</html>


