53 lines
1.7 KiB
PHP
Executable File
53 lines
1.7 KiB
PHP
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Parking Lot Database</title>
|
|
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
|
|
<link rel="stylesheet" href="custom.css">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta charset="utf-8">
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1> Parking Lot database</h1>
|
|
<?php
|
|
if($_POST['entrance'] and $_SERVER['REQUEST_METHOD'] == "POST"){
|
|
|
|
$command = escapeshellcmd("sudo ./parking.py 2");
|
|
$output = shell_exec($command);
|
|
echo "$output";
|
|
}
|
|
|
|
if($_POST['space_num'] and $_SERVER['REQUEST_METHOD'] == "POST"){
|
|
$v = $_POST['space_num'];
|
|
$command2 = escapeshellcmd("sudo ./parking.py 1 $v");
|
|
$output2 = shell_exec($command2);
|
|
echo "$output2";
|
|
}
|
|
?>
|
|
<p>Welcome to the parking lot. Make sure to update de database to check if there are any spaces available</p>
|
|
<form action="index.php" method="POST">
|
|
<input type="submit" value="Update database">
|
|
</form>
|
|
|
|
<p>If you want to enter the parking lot, press the button below to know your assigned spot and enter when the entrance opens.</p>
|
|
<form action="index.php" method="POST">
|
|
<input type="submit" value="Access parking lot" name="entrance" id="entrance">
|
|
</form>
|
|
<p>If you want to exit from the parking lot, input your spot number to open the exit.</p>
|
|
<form action="index.php" method="POST" autocomplete="off">
|
|
<input type="number" id="space_num" name="space_num" >
|
|
<input type="submit" value="Exit parking lot">
|
|
</form>
|
|
<?php
|
|
$command = escapeshellcmd("sudo ./database_output.py");
|
|
$output = shell_exec($command);
|
|
|
|
echo "$output <br>";
|
|
|
|
?>
|
|
</main>
|
|
</body>
|
|
</html>
|
|
|