summaryrefslogtreecommitdiff
path: root/includes/model/LogEntries_model.php
blob: 1fa9735692af7f11529ddcae789f846c9e52b372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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` WHERE `timestamp` > " . (time() - 24*60*60) . " ORDER BY `timestamp` DESC LIMIT 1000");
}


?>