Balance Logs

For discussion of the Poker Mavens server module and other administration topics
Post Reply
best2pmc
Posts: 8
Joined: Fri May 04, 2018 5:55 am

Balance Logs

Post by best2pmc »

hi
i use Error and Event Logs sample code from :https://www.briggsoft.com/docs/pmavens/API_Examples.htm
but i want to sho just the balance logs no more! , for example:
exampleplayer +30000
exampleplayer - 120000

how can i filter the logs with php code :

Code: Select all

<!DOCTYPE html>
<html>
<body>
<?php

  include "API.php";

  if (isset($_REQUEST["errors"]))  // retrieve selected error log
  {
    $edate = $_REQUEST["edate"];
    $params = array("Command" => "LogsError", "Date" => $edate);
    $api = Poker_API($params);
    if ($api -> Result == "Error") die($api -> Error);
    echo "<pre>\n";
    for ($i = 0; $i < count($api -> Data); $i++) echo $api -> Data[$i] . "\n";
    echo "</pre>\n"; 
  }
  elseif (isset($_REQUEST["events"]))  // retrieve selected event log
  {
    $edate = $_REQUEST["edate"];
    $params = array("Command" => "LogsEvent", "Date" => $edate);
    $api = Poker_API($params);
    if ($api -> Result == "Error") die($api -> Error);
    echo "<pre>\n";
    for ($i = 0; $i < count($api -> Data); $i++) echo $api -> Data[$i] . "\n";
    echo "</pre>\n"; 
  }
  else  // initial page load - display selection droplists
  {

    // retrieve error log dates

    $params = array("Command" => "LogsError");
    $api = Poker_API($params);
    if ($api -> Result == "Error") die($api -> Error);
    $count = $api -> Files;
    echo "<h3>Error Logs</h3>\n";

    // display droplist of dates

    echo "<form method='post'>\n";
    echo "<select name='edate'>\n";
    for ($i = 0; $i < $count; $i++)
    {
      $e = $api -> Date[$i];
      echo "<option value='" . $e . "'>" . $e . "</option>\n";
    } 

    // submit button reloads page with selected error log date

    echo "</select> &nbsp; <input type='submit' name='errors' value='Submit'>\n";
    echo "</form>\n";
    echo "<p>Files found: " . $count . "</p><br/>\n";


    // retrieve event log dates

    $params = array("Command" => "LogsEvent");
    $api = Poker_API($params);
    if ($api -> Result == "Error") die($api -> Error);
    $count = $api -> Files;
    echo "<h3>Event Logs</h3>\n";

    // display droplist of dates

    echo "<form method='post'>\n";
    echo "<select name='edate'>\n";
    for ($i = 0; $i < $count; $i++)
    {
      $e = $api -> Date[$i];
      echo "<option value='" . $e . "'>" . $e . "</option>\n";
    } 

    // submit button reloads page with selected event log date

    echo "</select> &nbsp; <input type='submit' name='events' value='Submit'>\n";
    echo "</form>\n";
    echo "<p>Files found: " . $count . "</p>\n";
  }

?>
</body>
</html>

thank you
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Balance Logs

Post by Kent Briggs »

This line is where each record is being displayed:

Code: Select all

for ($i = 0; $i < count($api -> Data); $i++) echo $api -> Data[$i] . "\n";
So just insert a test so that only the Account records are shown. Something like this (untested):

Code: Select all

for ($i = 0; $i < count($api -> Data); $i++) if (strpos(Data[$i], "|Account|") !== false) {echo $api -> Data[$i] . "\n"};
best2pmc
Posts: 8
Joined: Fri May 04, 2018 5:55 am

Re: Balance Logs

Post by best2pmc »

i tested but it doesn't work!
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Balance Logs

Post by Kent Briggs »

Here's the corrected line:

Code: Select all

for ($i = 0; $i < count($api -> Data); $i++) if (strpos($api -> Data[$i], "|Account|") !== false) {echo $api -> Data[$i] . "\n";};
Note this replaces the one in the Event Log section, not the Error Log section.
best2pmc
Posts: 8
Joined: Fri May 04, 2018 5:55 am

Re: Balance Logs

Post by best2pmc »

thank you so much ;)
Post Reply