File: //home/awaldron/_accomods/_apibak/admin/codes.php
<?php
error_reporting(E_ALL);
include('_helpers.php');
if (isset($_POST['submitForm'])) {
$fp = fopen('/home/awaldron/_accomods/api.accomods.com/schoolCodes.txt', 'w');
fwrite($fp, $_POST['codes']);
fclose($fp);
}
$file = file_get_contents('/home/awaldron/_accomods/api.accomods.com/schoolCodes.txt');
$codes = file('/home/awaldron/_accomods/api.accomods.com/schoolCodes.txt');
sort($codes);
include '_header.php';
?>
<div class="container">
<div class="row">
<div class="col-xs-12">
<h1>School Code Editor</h1>
<p><a href="/admin">Back to Admin Panel</a></p>
<form action="/admin/codes.php" method="post">
<input type="hidden" name="hi" value="ho" />
<textarea style="min-width:600px;min-height:400px;padding:5px 10px;" name="codes"><?php echo $file; ?></textarea>
<br><br/><input type="submit" name="submitForm" value="submit edit" />
</form>
</div>
</div>
</div>
<br/><br/><br/>
<div class="container">
<div class="row">
<div class="col-xs-12">
<!--
<h1>School Code Editor</h1>
<p><a href="/admin">Back to Admin Panel</a></p>
-->
<table class="table table-striped table-hover">
<thead>
<tr><th>School Name</th><th>School Code</th><th>Expires</th></tr>
</thead>
<tbody>
<?php
$i=0;
foreach ($codes as $row) {
$s = explode("||",$row);
echo '<tr>';
echo '<td>'.$s[0].'</td>';
echo '<td>'.$s[1].'</td>';
echo '<td>'.get_expiration_date( trim($s[1]) ).'</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
include '_footer.php';
?>