Location: PHPKode > projects > SHOUTcast Management Interface > smi-0.3.4/eventviewer.php
<?
////////////////////////////////////////////////////////////////////////
/*SMI - SHOUTcast Management Interface
A web based shoutcast server management program
Founding Author: Scott D. Harvanek <hide@address.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.*/
////////////////////////////////////////////////////////////////////////
if(useraccess($_SESSION['username']) < "4"){
echo "ACCESS DENIED - INCIDENT REPORTED";
$event = " Attempted to access the restricted user management section.";
addevent($_SESSION['username'], $event);
}else{
require('include/config.php');
?>
<table border="0" width="400px">
        <tr>
                <td align="left">
                <b>Event Log</b><br>
                </td>
        </tr>
</table>
<table border="0"cellspacing="0">
<tr bgcolor="#828282">
                <td align="left">
                <b>ID</b>
                </td>
		<td align="left">
                <b>Timestamp</b>
                </td>
		<td align="left">
                <b>Event</b>
                </td>
	</tr>
<?
$i = "0";
	if (isset($_GET['page'])) { $page  = $_GET['page']; 
	} else { $page=0; };
	
$start_from = ($page) * 50;

	////////////////////////////////////////////////////////////
	//
	// If user is not a mod or higher only show them their own
	// events.
	//
	////////////////////////////////////////////////////////////

	if(useraccess($_SESSION['username']) < "4"){
		$query = mysql_query('SELECT * from events WHERE event_user='.$_SESSION['username'].' ORDER BY id DESC LIMIT '.$start_from.', 50');
	}else{
		$query = mysql_query('SELECT * from events ORDER BY id DESC LIMIT '.$start_from.', 50');
	}

while($row = mysql_fetch_row($query)){
	$bgcolor = ($i++ & 1) ? '#FFFFFF' : '#cfcfcf';
	echo "<tr bgcolor='$bgcolor'>\n";
	?>
                <td align="left" valign="top">
                <i>
                <?echo $row[0];?> -
                </i>
                </td>
                <td align="left" valign="top">
                <i>
                <?echo $row[4];?> -
                </i>
                </td>
                <td align="left">
                <i>
                <?echo $row[2];?>
                </i>
                </td>
        </tr>
	<?


	}

echo "</table>";
echo "Pages - <a href=\"eventlog.php?page=0\">0</a> ";
$sql = "SELECT COUNT(id) FROM events";
$rs_result = mysql_query($sql);
$row = mysql_fetch_row($rs_result);
$total_records = $row[0];
$total_pages = ceil($total_records / 50);
	for ($d=1; $d<=$total_pages; $d++) {
            echo "<a href=\"eventlog.php?page=".$d."\">".$d."</a> ";
	};
}
?>
Return current item: SHOUTcast Management Interface