Easy log viewing?

Help
2002-12-13
2013-04-25
  • Wesley Reitzfeld

    Is there a nice php script that formats the logs nicely?

     
    • tanoshimi

      tanoshimi - 2005-09-25

      <?php

      /** The general preferences and database details. **/
      require_once "dbprefs.php";

      // test connection to database
      if ($connection = mysql_connect($DB_HOST,$DB_UNAME,$DB_PWORD))
      {
          $query = "SELECT * FROM conversationlog";
          $result = mysql_db_query($DB_DB, $query, $connection);
          echo "<table><th>input</th><th>response</th><th>sessionid</th><th>time</th>";
          while ($row = mysql_fetch_array($result)) {
              echo "<tr nowrap><td nowrap>" . $row[2] . "</td><td nowrap>" . $row[3] . "</td><td nowrap>" . $row[4] . "</td><td nowrap>" . $row[5] . "</td></tr>";        } ;
          echo "</table>";

      // clean up
      mysql_close($connection);
      }
      else
      {
      echo "couldn't connect to database";
      }

      ?>

       
      • Anne Kootstra

        Anne Kootstra - 2006-08-18

        Guys. It's a nice piece of script for some basic log viewing. Good work. Not sure if the next version of Program E will contain log viewing abilities, but it does have a high priority on my development list.

        At present I'm finishing up rewriting the database layer; implementing adoDB for database independence. This is something that needs to be done in order for me to add the easier installation functionalty that has been missing for so long.

        Regards,

        Anne.

         
    • Brian Chabot

      Brian Chabot - 2006-08-17

      Slight variation on the above: (Note:  Put it in src/admin)

      <?php
      echo "<html><head><title>Wintermute's logs</title></head>
      <body>";

      /** The general preferences and database details. **/
      require_once "dbprefs.php";

      // test connection to database
      if ($connection = mysql_connect($DB_HOST,$DB_UNAME,$DB_PWORD))
      {
      $query = "SELECT * FROM conversationlog";
      $result = mysql_db_query($DB_DB, $query, $connection);
      echo "<table style=\&quot;width: 100%; text-align: left;\&quot; border=\&quot;1\&quot; cellpadding=\&quot;2\&quot; cellspacing=\&quot;2\&quot;><th>input</th><th>response</th><th>sessionid</th><th>time</th>";
      while ($row = mysql_fetch_array($result)) {
      echo "<tr><td>" . $row[2] . "</td><td>" . $row[3] . "</td><td>" . $row[4] . "</td><td>" . $row[5] . "</td></tr>"; } ;
      echo "</table>";

      // clean up
      mysql_close($connection);
      echo "</body></html>";
      }
      else
               {
               echo "couldn't connect to database";
               }

      ?>

       

Log in to post a comment.