30 lines
823 B
PHP
30 lines
823 B
PHP
<?php
|
|
session_start();
|
|
require_once 'config.php';
|
|
header('Content-Type: application/json');
|
|
|
|
if (isset($_SESSION["username"]) && isset($_SESSION["admin"]))
|
|
{
|
|
$conn = dbConn();
|
|
$amount = $_POST["amount"];
|
|
$points = $_POST["points"];
|
|
$incident = $_POST["incident"];
|
|
|
|
$stmt = $conn->prepare("INSERT INTO Fines (Fine_amount, Fine_points, Incident_ID) VALUES (:amount, :points, :incident)");
|
|
$stmt->bindParam(":amount", $amount);
|
|
$stmt->bindParam(":points", $points);
|
|
$stmt->bindParam(":incident", $incident);
|
|
$stmt->execute();
|
|
|
|
echo json_encode(array("message" => "ok"));
|
|
}
|
|
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 "));
|
|
}
|
|
{
|
|
} |