From 3aca8066ddc00ae019e6a0540cafb0e46cf48fd5 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 21 Feb 2016 00:56:03 +1100 Subject: [PATCH] php - add an admin IP event log --- pool/db.php | 12 +++++++++++ pool/page_ips.php | 54 +++++++++++++++++++++++++++++++++++++++++++++++ pool/prime.php | 1 + 3 files changed, 67 insertions(+) create mode 100644 pool/page_ips.php diff --git a/pool/db.php b/pool/db.php index 97af40d2..4b84f4e3 100644 --- a/pool/db.php +++ b/pool/db.php @@ -496,4 +496,16 @@ function getOpts($user, $optlist) return repDecode($rep); } # +function eventIPs($user) +{ + if ($user == false) + showIndex(); + $flds = array('action' => 'ips'); + $msg = msgEncode('events', 'events', $flds, $user); + $rep = sendsockreply('eventIPs', $msg); + if (!$rep) + dbdown(); + return repDecode($rep); +} +# ?> diff --git a/pool/page_ips.php b/pool/page_ips.php new file mode 100644 index 00000000..7124fc16 --- /dev/null +++ b/pool/page_ips.php @@ -0,0 +1,54 @@ +Event IP Information'; + + $ans = eventIPs($user); + + $pg .= "\n"; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= "\n"; + if ($ans['STATUS'] == 'ok') + { + $pg .= ''; + $count = $ans['rows']; + for ($i = 0; $i < $count; $i++) + { + if (($i % 2) == 0) + $row = 'even'; + else + $row = 'odd'; + + $pg .= ""; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= "\n"; + } + $pg .= ''; + } + $pg .= "
GroupIPNameIs?LifetimeLogDescCreateDate
'.$ans['group:'.$i].''.$ans['ip:'.$i].''.$ans['eventname:'.$i].''.$ans['is_event:'.$i].''.$ans['lifetime:'.$i].''.$ans['log:'.$i].''.$ans['description:'.$i].''.gmdate('j/M H:i:s',$ans['createdate:'.$i]).'
\n"; + + return $pg; +} +# +function show_ips($info, $page, $menu, $name, $user) +{ + gopage($info, NULL, 'doips', $page, $menu, $name, $user); +} +# +?> diff --git a/pool/prime.php b/pool/prime.php index 86e142b1..af842a1b 100644 --- a/pool/prime.php +++ b/pool/prime.php @@ -25,6 +25,7 @@ function process($p, $user, $menu) $menu['Admin']['PPLNS2'] = 'pplns2'; $menu['Admin']['PPLNS'] = 'pplns'; $menu['Admin']['AllWork'] = 'allwork'; + $menu['Admin']['IPS'] = 'ips'; } bp: $page = '';