function checkTimers() { $ts = Database::Get("timers", array()); foreach ($ts as $array) { if ($array['time'] <= time()) { eval($array['code']); Database::Remove('timers', array("id" => $array['id'])); } } }
<?php if (isset($_GET['delete'])) { Database::Remove("chat", array("_id" => toId($_GET['delete']))); ob_flush(); echo "Chat message deleted"; } ?> <script> function timeConverter(timestamp) { var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds yyyy = d.getFullYear(), mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0. dd = ('0' + d.getDate()).slice(-2), // Add leading 0. hh = d.getHours(), h = hh, min = ('0' + d.getMinutes()).slice(-2), // Add leading 0. ampm = 'AM', time; if (hh > 12) { h = hh - 12; ampm = 'PM'; } else if (hh === 12) { h = 12; ampm = 'PM'; } else if (hh == 0) { h = 12; }
public function gc($maxlifetime) { Database::Remove("sessions", array("time" => array('$lt' => time() - 3600))); return true; }
if (isset($_POST['add'])) { if ($_POST['type'] == true) { $type = 'main'; } else { $type = 'default'; } Database::Insert('wiki_pages', array('content' => $_POST['add'], 'type' => 'default', 'title' => $_POST['title'], 'alias' => $_POST['alias'], 'type' => $type)); } if (isset($_GET['edit'])) { $content = Database::GetOne('wiki_pages', array('alias' => $_GET['edit'])); echo "<form action='' method='POST'>\n <input type='hidden' name='file' value='" . $_GET['edit'] . "'>\n\t\t<label for='page_type'>Тип страницы</label>\n\t\t<input id='page_type' type='radio' name='type'>\n <textarea rows=15 cols=105 name='edit'>" . $content['content'] . "</textarea> <br>\n <button type='submit' class='btn btn-default'>Сохранить</button>\n </form>\n <hr>"; } else { echo ""; } if (isset($_GET['remove'])) { $content = Database::Remove('wiki_pages', array('alias' => $_GET['remove'])); } else { echo ""; } if (isset($_GET['add'])) { echo "<form action='' method='POST'>\n <label for='title'>Название страницы</label>\n\t\t<input id='title' type='text' style='width:635px;' name='title'><br>\n\t\t<label for='page_type'>Избранное</label>\n\t\t<input id='page_type' type='radio' name='type'><br>\n <label for='title'>Алиас (только английские буквы)</label>\n <input id='title' type='text' style='width:513px;' name='alias'><br>\n <textarea rows=15 cols=105 name='add'></textarea> <br>\n <button type='submit' class='btn btn-success'>Добавить</button>\n </form>\n <hr>"; } else { echo ""; } ?> <h2>Страницы</h2> <h5>Страницы справочника: на данной странице их можно создавать, редактировать, читать и удалять<br> <br> <hr> <a href="?add=1" style="margin-top: -20px;">Новая страница</a> <div class="table-responsive">
public static function delete($name, $check = true) { if ($check === true) { array("name" => $name, "player" => $_SESSION['id']); } else { array("name" => $name); } if (Database::Remove("characters", $array)) { return true; } else { return 0; } }