2012-12-26 14:02:27 +01:00
< ? php
/**
* Creates a log entry .
* @ param $nick Username
* @ param $message Log Message
*/
function LogEntry_create ( $nick , $message ) {
2012-12-26 20:36:31 +01:00
$timestamp = time ();
2012-12-26 14:02:27 +01:00
sql_query ( " INSERT INTO `LogEntries` SET `timestamp`= " . sql_escape ( $timestamp ) . " , `nick`=' " . sql_escape ( $nick ) . " ', `message`=' " . sql_escape ( $message ) . " ' " );
}
2012-12-27 02:18:56 +01:00
/**
* Returns log entries of the last 24 hours with maximum count of 1000.
*/
2012-12-26 20:36:31 +01:00
function LogEntries () {
2012-12-27 02:18:02 +01:00
$log_entries_source = sql_select ( " SELECT * FROM `LogEntries` WHERE `timestamp` > " . ( time () - 24 * 60 * 60 ) . " ORDER BY `timestamp` DESC LIMIT 1000 " );
2012-12-26 20:36:31 +01:00
return $log_entries_source ;
}
2012-12-26 14:02:27 +01:00
?>