From 1c409deca17761a07badd945007d26544bf9e4f1 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 12 Mar 2016 23:58:23 +1100 Subject: [PATCH] php - add time left on page_ips --- pool/page_ips.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pool/page_ips.php b/pool/page_ips.php index a81ad811..f41d9952 100644 --- a/pool/page_ips.php +++ b/pool/page_ips.php @@ -14,12 +14,14 @@ function doips($data, $user) $pg .= 'Name'; $pg .= 'Is?'; $pg .= 'Lifetime'; + $pg .= 'Left'; $pg .= 'Log'; $pg .= 'Desc'; $pg .= 'UTC'; $pg .= "\n"; if ($ans['STATUS'] == 'ok') { + $now = $ans['STAMP']; $pg .= ''; $count = $ans['rows']; for ($i = 0; $i < $count; $i++) @@ -37,6 +39,21 @@ function doips($data, $user) $pg .= ''.$ans['eventname:'.$i].''; $pg .= ''.$ans['is_event:'.$i].''; $pg .= ''.$ans['lifetime:'.$i].''; + $exp = $ans['lifetime:'.$i]; + if ($exp == 0) + $dxp = '∞'; + else + { + $exp += $ans['createdate:'.$i]; + if ($exp <= $now) + $dxp = 'Exp'; + else + { + $exp -= $now; + $dxp = $exp . 's'; + } + } + $pg .= ''.$dxp.''; $pg .= ''.$ans['log:'.$i].''; $pg .= ''.$ans['description:'.$i].''; $pg .= ''.gmdate('j/M H:i:s',$ans['createdate:'.$i]).'';