34 lines
845 B
PHP
34 lines
845 B
PHP
<?php
|
|
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";
|
|
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());
|
|
}
|
|
$req = $db->prepare('SELECT * FROM images');
|
|
$req->execute();
|
|
$result = $req->fetchAll();
|
|
|
|
?>
|
|
<ul class="images">
|
|
<?php
|
|
foreach ($result as $row) {
|
|
?>
|
|
<li>
|
|
<div><img src="/storage/images/<?=$row['file_name']?>" alt="<?=$row['species']?>"></div>
|
|
</li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
<a href="?option=upload">Upload Image</a>
|
|
<script src="scripts/gallery.js"></script>
|
|
<?php
|