17 lines
456 B
PHP
17 lines
456 B
PHP
|
<?php
|
||
|
session_start();
|
||
|
require_once 'config.php';
|
||
|
header('Content-Type: application/json');
|
||
|
|
||
|
if (isset($_SESSION["username"]))
|
||
|
{
|
||
|
$conn = dbConn();
|
||
|
$stmt = $conn->prepare("SELECT Vehicle_ID, Vehicle_type, Vehicle_licence FROM Vehicle");
|
||
|
$stmt->execute();
|
||
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||
|
echo json_encode(array("message" => "ok", "vehicles" => $result));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
echo json_encode(array("message" => "Not logged in "));
|
||
|
}
|