engelsystem/includes/model/LogEntries_model.php

21 lines
575 B
PHP
Raw Normal View History

2012-12-26 14:02:27 +01:00
<?php
/**
* Creates a log entry.
2013-10-13 00:52:44 +02:00
*
2012-12-26 14:02:27 +01:00
* @param $nick Username
2013-10-13 00:52:44 +02:00
* @param $message Log
* Message
2012-12-26 14:02:27 +01:00
*/
function LogEntry_create($nick, $message) {
return sql_query("INSERT INTO `LogEntries` SET `timestamp`=" . sql_escape(time()) . ", `nick`='" . sql_escape($nick) . "', `message`='" . sql_escape($message) . "'");
2012-12-26 14:02:27 +01:00
}
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() {
2013-10-13 00:52:44 +02:00
return 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
}
2012-12-26 14:02:27 +01:00
?>