Browse Source

php - add an admin IP event log

master
kanoi 9 years ago
parent
commit
3aca8066dd
  1. 12
      pool/db.php
  2. 54
      pool/page_ips.php
  3. 1
      pool/prime.php

12
pool/db.php

@ -496,4 +496,16 @@ function getOpts($user, $optlist)
return repDecode($rep); 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);
}
#
?> ?>

54
pool/page_ips.php

@ -0,0 +1,54 @@
<?php
#
function doips($data, $user)
{
$pg = '<h1>Event IP Information</h1>';
$ans = eventIPs($user);
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dl>Group</td>';
$pg .= '<td class=dl>IP</td>';
$pg .= '<td class=dl>Name</td>';
$pg .= '<td class=dr>Is?</td>';
$pg .= '<td class=dr>Lifetime</td>';
$pg .= '<td class=dr>Log</td>';
$pg .= '<td class=dl>Desc</td>';
$pg .= '<td class=dr>CreateDate</td>';
$pg .= "</tr></thead>\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
{
if (($i % 2) == 0)
$row = 'even';
else
$row = 'odd';
$pg .= "<tr class=$row>";
$pg .= '<td class=dl>'.$ans['group:'.$i].'</td>';
$pg .= '<td class=dl>'.$ans['ip:'.$i].'</td>';
$pg .= '<td class=dl>'.$ans['eventname:'.$i].'</td>';
$pg .= '<td class=dr>'.$ans['is_event:'.$i].'</td>';
$pg .= '<td class=dr>'.$ans['lifetime:'.$i].'</td>';
$pg .= '<td class=dr>'.$ans['log:'.$i].'</td>';
$pg .= '<td class=dl>'.$ans['description:'.$i].'</td>';
$pg .= '<td class=dr>'.gmdate('j/M H:i:s',$ans['createdate:'.$i]).'</td>';
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
}
$pg .= "</table>\n";
return $pg;
}
#
function show_ips($info, $page, $menu, $name, $user)
{
gopage($info, NULL, 'doips', $page, $menu, $name, $user);
}
#
?>

1
pool/prime.php

@ -25,6 +25,7 @@ function process($p, $user, $menu)
$menu['Admin']['PPLNS2'] = 'pplns2'; $menu['Admin']['PPLNS2'] = 'pplns2';
$menu['Admin']['PPLNS'] = 'pplns'; $menu['Admin']['PPLNS'] = 'pplns';
$menu['Admin']['AllWork'] = 'allwork'; $menu['Admin']['AllWork'] = 'allwork';
$menu['Admin']['IPS'] = 'ips';
} }
bp: bp:
$page = ''; $page = '';

Loading…
Cancel
Save