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