74 lines
2.4 KiB
PHP
Executable File
74 lines
2.4 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|
require "$root/database/credentials.php";
|
|
// Connect the database
|
|
try {
|
|
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
|
|
$user,
|
|
$password,
|
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
|
));
|
|
} catch (Exception $e) {
|
|
die("Error : ".$e->getMessage());
|
|
}
|
|
if (isset($_GET['record'])) {
|
|
$req = $db->prepare('SELECT * FROM records WHERE id=:id');
|
|
$req->execute(array(
|
|
"id"=>$_GET['record']
|
|
));
|
|
} else {
|
|
$req = $db->prepare('SELECT * FROM records ORDER BY date DESC LIMIT 1');
|
|
$req->execute();
|
|
}
|
|
if ($data = $req->fetch()) {
|
|
|
|
} else {
|
|
$_SESSION['error_msg'] = "Can't fetch data.";
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>GUANO | Chiro-Canto</title>
|
|
<link rel="stylesheet" type="text/css" href="/styles/style.css">
|
|
</head>
|
|
<?php
|
|
include("$root/analytics/matomo.php");
|
|
?>
|
|
<body>
|
|
<?php include("$root/menu.php"); ?>
|
|
<?php include("$root/header.php"); ?>
|
|
<section>
|
|
<h2>GUANO v1.0</h2>
|
|
<?=isset($_SESSION['error_msg']) and $_SESSION['error_msg'] != "" ? '<div class="error">'.$_SESSION['error_msg'].'</div>' : "";?>
|
|
<a href="/articles">about GUANO</a>
|
|
<article id="guano">
|
|
GUANO|Version: 1.0<br><br>
|
|
|
|
Original Filename: <?=$data['file_name']?><br>
|
|
Timestamp: <?=$data['date']?> <?=$data['time']?><br>
|
|
Species Auto ID: None <br>
|
|
Species Manual ID: <em><?=$data['species']?> <?=$data['subspecies']?></em><br>
|
|
Tags: None <br>
|
|
Note: <?=(isset($data['remarks']) and $data['remarks'] != "") ? $data['remarks'] : "None"?><br>
|
|
TE: <?=(isset($data['time_expansion']) and $data['time_expansion'] != 0) ? $data['time_expansion'] : "Not defined"?><br>
|
|
Samplerate: <?=(isset($data['sample_rate']) and $data['sample_rate'] != 0) ? $data['sample_rate'] : "Not defined"?><br>
|
|
Length: <?=(isset($data['duration']) and $data['duration'] != "") ? $data['duration'] : "Not defined"?><br>
|
|
</article>
|
|
<button title="Copy to clipboard" onclick="clipboard_copy()">
|
|
<img src="/media/icons/copy.png" alt="clipboard copy">
|
|
</button>
|
|
</section>
|
|
<?php include("$root/footer.php"); ?>
|
|
</body>
|
|
<script src="/scripts/script.js"></script>
|
|
</html>
|
|
|