diff --git a/pool/base.php b/pool/base.php index 5f2eb774..7993d580 100644 --- a/pool/base.php +++ b/pool/base.php @@ -343,6 +343,14 @@ function safetext($txt, $len = 1024) return $res; } # +function isans($ans, $fld) +{ + if (isset($ans[$fld])) + return $ans[$fld]; + else + return ' '; +} +# function dbd($data, $user) { return "
Database is reloading, mining is all OK
"; diff --git a/pool/db.php b/pool/db.php index 4b84f4e3..23d7d8f3 100644 --- a/pool/db.php +++ b/pool/db.php @@ -496,13 +496,12 @@ function getOpts($user, $optlist) return repDecode($rep); } # -function eventIPs($user) +function eventCmd($user, $flds) { if ($user == false) showIndex(); - $flds = array('action' => 'ips'); $msg = msgEncode('events', 'events', $flds, $user); - $rep = sendsockreply('eventIPs', $msg); + $rep = sendsockreply('eventCmd', $msg); if (!$rep) dbdown(); return repDecode($rep); diff --git a/pool/page_events.php b/pool/page_events.php new file mode 100644 index 00000000..ead6d036 --- /dev/null +++ b/pool/page_events.php @@ -0,0 +1,153 @@ +Event Information'; + + $wh = getparam('what', false); + if (nuem($wh)) + $wh = ''; + + $pg = '
'.makeForm('events')." +What: +"; + + if ($wh == 'settings') + { + $ans = eventCmd($user, array('action' => 'settings')); + + $other = array('event_limits_hash_lifetime', + 'ovent_limits_ipc_factor'); + + $pg .= "

\n"; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= "\n"; + + if ($ans['STATUS'] == 'ok') + { + $pg .= ''; + $i = 0; + foreach ($other as $name) + { + if (($i % 2) == 0) + $row = 'even'; + else + $row = 'odd'; + + $i++; + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= ''; + $pg .= "\n"; + } + $pg .= ''; + } + $pg .= "
#NameValue
$i$name'.$ans[$name].'
\n"; + + $flds = array('enabled' => 'Ena', + 'user_low_time' => 'UserLo', + 'user_low_time_limit' => 'UserLoLim', + 'user_hi_time' => 'UserHi', + 'user_hi_time_limit' => 'UserHiLim', + 'ip_low_time' => 'IPLo', + 'ip_low_time_limit' => 'IPLoLim', + 'ip_hi_time' => 'IPHi', + 'ip_hi_time_limit' => 'IPHiLim', + 'lifetime' => 'Life'); + + $pg .= "

\n"; + $pg .= ''; + $pg .= ''; + $pg .= ''; + foreach ($flds as $row => $nam) + $pg .= ""; + $pg .= "\n"; + + if ($ans['STATUS'] == 'ok') + { + $pg .= ''; + $names = array(); + foreach ($ans as $name => $value) + { + $ex = explode('_', $name, 2); + if (count($ex) == 2 && isset($flds[$ex[1]])) + $names[$ex[0]] = 1; + } + $i = 0; + foreach ($names as $name => $one) + { + if (($i % 2) == 0) + $row = 'even'; + else + $row = 'odd'; + + $i++; + $pg .= ""; + $pg .= ""; + $pg .= ""; + foreach ($flds as $fld => $nam) + $pg .= ''; + $pg .= "\n"; + } + $pg .= ''; + } + $pg .= "
#Name$nam
$i$name'.$ans[$name.'_'.$fld].'
\n"; + } + + if ($wh == 'all' || $wh == 'user' || $wh == 'ip' || $wh == 'ipc' || $wh == 'hash') + { + $ans = eventCmd($user, array('action' => 'events', 'list' => $wh)); + + $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'; + + $j = $i+1; + $pg .= ""; + $pg .= ""; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= ''; + $pg .= "\n"; + } + $pg .= ''; + } + } + + return $pg; +} +# +function show_events($info, $page, $menu, $name, $user) +{ + gopage($info, NULL, 'doevents', $page, $menu, $name, $user); +} +# +?> diff --git a/pool/page_ips.php b/pool/page_ips.php index e0e6d9c4..a81ad811 100644 --- a/pool/page_ips.php +++ b/pool/page_ips.php @@ -4,7 +4,7 @@ function doips($data, $user) { $pg = '

Event IP Information

'; - $ans = eventIPs($user); + $ans = eventCmd($user, array('action' => 'ips')); $pg .= "
#ListIDUserIPIPcHashUTC
$j'.$ans['list:'.$i].''.$ans['id:'.$i].''.$ans['user:'.$i].''.isans($ans, 'ip:'.$i).''.isans($ans, 'ipc:'.$i).''.isans($ans, 'hash:'.$i).''.gmdate('j/M H:i:s',$ans['createdate:'.$i]).'
\n"; $pg .= ''; @@ -16,7 +16,7 @@ function doips($data, $user) $pg .= ''; $pg .= ''; $pg .= ''; - $pg .= ''; + $pg .= ''; $pg .= "\n"; if ($ans['STATUS'] == 'ok') { diff --git a/pool/prime.php b/pool/prime.php index af842a1b..dd0c5973 100644 --- a/pool/prime.php +++ b/pool/prime.php @@ -26,6 +26,7 @@ function process($p, $user, $menu) $menu['Admin']['PPLNS'] = 'pplns'; $menu['Admin']['AllWork'] = 'allwork'; $menu['Admin']['IPS'] = 'ips'; + $menu['Admin']['Events'] = 'events'; } bp: $page = '';
LifetimeLogDescCreateDateUTC