Warning: Cannot modify header information - headers already sent by (output started at /var/www/jonas-eriksen.dk/pic/private/index.php:1) in /var/www/jonas-eriksen.dk/pic/private/index.php on line 215
var/www/jonas-eriksen.dk/log/Class.log.php 0000644 00000003251 15233473352 0014454 0 ustar 00 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();
}
}
}