You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
799 B
PHP
29 lines
799 B
PHP
<?php
|
|
|
|
/**
|
|
* Creates a log entry.
|
|
*
|
|
* @param $nick Username
|
|
* @param $message Log
|
|
* Message
|
|
*/
|
|
function LogEntry_create($nick, $message) {
|
|
return sql_query("INSERT INTO `LogEntries` SET `timestamp`=" . sql_escape(time()) . ", `nick`='" . sql_escape($nick) . "', `message`='" . sql_escape($message) . "'");
|
|
}
|
|
|
|
/**
|
|
* Returns log entries of the last 24 hours with maximum count of 1000.
|
|
*/
|
|
function LogEntries() {
|
|
return sql_select("SELECT * FROM `LogEntries` ORDER BY `timestamp` DESC LIMIT 10000");
|
|
}
|
|
|
|
/**
|
|
* Returns log entries filtered by a keyword
|
|
*/
|
|
function LogEntries_filter($keyword) {
|
|
return sql_select("SELECT * FROM `LogEntries` WHERE `nick` LIKE '%" . sql_escape($keyword) . "%' OR `message` LIKE '%" . sql_escape($keyword) . "%' ORDER BY `timestamp` DESC");
|
|
}
|
|
|
|
?>
|