Update status.php
[clinton/MarylandElectronicPetitionSignature.git] / admin / status.php
1 <?PHP
2 include_once('security.php');
3 include_once('header.php');
4 function secondsToDHMS($seconds) {
5 $s = (int)$seconds;
6 return sprintf('%d:%02d:%02d:%02d', $s/86400, $s/3600%24, $s/60%60, $s%60);
7 }
8 ?>
9
10 <?PHP
11 $expected = 4313592; // old data file...
12 if ($result = $petition->query("SELECT VTRID FROM VoterList2")) {
13 $row_cnt = $result->num_rows;
14 echo "<meta http-equiv=\"refresh\" content=\"60; url=https://www.md-petition.com/admin/status.php?last=$row_cnt\">";
15 $c = $row_cnt / $expected;
16 $p = number_format($c,2)*100;
17 $per_minute = intval($_GET['last']) - $row_cnt;
18 $left = $expected - $row_cnt;
19 $minutes = round($left/$per_minute);
20 $human = secondsToDHMS($minutes*60);
21 echo '<h1>'.date('r').'</h1><h1>'.number_format($row_cnt).' out of '.number_format($expected).' '.$p.'% done</h1>';
22 echo "<h3>$per_minute Per Minute</h3><h3>$left Rows Left</h3><h3>$human Left</h3>";
23 echo '<title>'.$p.'% loaded</title>';
24 }
25
26 include_once('footer.php');
27 ?>