21 lines
614 B
PHP
21 lines
614 B
PHP
|
<?php
|
||
|
session_start();
|
||
|
require_once 'config.php';
|
||
|
header('Content-Type: application/json');
|
||
|
|
||
|
if (isset($_SESSION["username"]) && isset($_SESSION["admin"]))
|
||
|
{
|
||
|
$conn = dbConn();
|
||
|
$stmt = $conn->prepare("SELECT Logs_type, Users_username, Logs_date FROM Logs");
|
||
|
$stmt->execute();
|
||
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||
|
echo json_encode(array("message" => "ok", "logs" => $result));
|
||
|
}
|
||
|
else if (isset($_SESSION["username"]) && !isset($_SESSION["admin"]))
|
||
|
{
|
||
|
echo json_encode(array("message" => "not logged in as admin"));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
echo json_encode(array("message" => "Not logged in "));
|
||
|
}
|