Файловый менеджер - Редактировать - /var/www/jonas-eriksen.dk/log/Class.log.php
Назад
<?php class log { private $db; function __construct($DB_con) { $this->db = $DB_con; } public function addLog($userId, $comment, $type, $link) { try { $stmt = $this->db->prepare("INSERT INTO result_log(userId, type, comment, link) VALUES (:userId, :type, :comment, :link)"); $stmt->execute(array(":userId" => $userId, ":comment" => $comment, ":type" => $type, ":link" => $link)); } catch (PDOException $e) { echo $e->getMessage(); } } public function getLog($type = null) { try { if ($type == null) { $stmt = $this->db->prepare("SELECT result_internaluser.username, type, link, comment, date, result_internaluser.name FROM result_log JOIN result_internaluser ON result_internaluser.id = result_log.userId ORDER BY date DESC"); $stmt->execute(); return $stmt; } else { $stmt = $this->db->prepare("SELECT result_internaluser.username, type, link, comment, date, result_internaluser.name FROM result_log JOIN result_internaluser ON result_internaluser.id = result_log.userId WHERE type = :type ORDER BY date DESC"); $stmt->execute(array(":type" => $type)); return $stmt; } } catch (PDOException $e) { echo $e->getMessage(); } } public function getLogTypes() { try { $stmt = $this->db->prepare("SELECT type FROM result_log GROUP BY type ORDER BY type;"); $stmt->execute(); return $stmt; } catch (PDOException $e) { echo $e->getMessage(); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка