Commit 690f9496 authored by Daniel Messer's avatar Daniel Messer

Initial commit for GitLab.

parents
# Signbrary
## A digital signage and content distribution system
This project aims to be a solution for libraries that want to set up a digital signage system that also allows for content distribution. For example, a library could set up a stand alone digital sign at an event that displays events and notices and enables patrons to connect to the device and download eBooks, music, video, and more.
The software itself is aimed at running as a standalone system on a Raspberry Pi, or as an online system connected to the internet.
---
#### Special Thanks
Signbrary utilizes the [Javascript Date Picker](https://github.com/chrishulbert/datepicker) by [Chris Hulbert](http://www.splinter.com.au/). Thank you, Chris!
---
** Signbrary is currently under active development. Some features are not yet available.**
<!DOCTYPE html>
<html>
<head>
<title>Signbrary - Add Slide</title>
<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<script type="text/javascript" src="js/datepicker.js"></script>
<script type="text/javascript" src="js/timepicker.js"></script>
</head>
<body>
<div id="pagewidth">
<div id="header"><h1>Signbrary &ndash; Digital Signage. Digital Content.</h1></div>
<div id="wrapper" class="clearfix">
<div id="maincol"><h1>Add Slide</h1>
<p>Accepted formats include: JPG, JPEG, PNG, GIF, MP4</p>
<p style = "color:#ff0000;">All fields are required.</p>
<hr>
<form action="slide-add.php" method="post" enctype="multipart/form-data">
Image Title:<br />
<input type="text" name="img_title" placeholder="Name your slide" /><br /><br />
Start Date / Time:<br />
<input id="start_dt" name="start_dt" class='datepicker' size='11' title='D-MMM-YYYY' placeholder="Use date picker ->" />
<input id="start_tm" name="start_tm" class='timepicker' size='5' title='HH:MM' placeholder="HH:MM" /><br /><br />
End Date / Time:<br />
<input id="end_dt" name="end_dt" class='datepicker' size='11' title='D-MMM-YYYY' placeholder="Use date picker ->" />
<input id="end_tm" name="end_tm" class='timepicker' size='5' title='HH:MM' placeholder="HH:MM" /><br /><br />
Set Slide to Active/Inactive<br />
<input type="radio" name="activeslide" value="active" checked="checked">Active<br />
<input type="radio" name="activeslide" value="inactive">Inactive<br /><br />
Select media for upload (Max size = 10 MB):
<input type="file" name="fileToUpload" id="fileToUpload"><br /><br />
<input type="submit" value="Add Slide" name="submit">
</form>
</div> <!-- End maincol -->
<div id="leftcol"><h2>Navigation</h2>
<hr>
<ul>
<li><a href="addslide.html">Add Slide</a></li>
<li><a href="slide-manage.php">Manage Slides</a></li>
</ul>
</div> <!-- End leftcol -->
</div> <!-- End wrapper -->
</div> <!-- End pagewidth -->
</body>
</html>
<?php
// Place these where you want and call them as an include in your .php files.
// Credentials - sooper seekrit
$servername = "localhost";
$username = "signbrary";
$password = "!SignageAndStuff2018!";
$database = "signbrary";
// Create a database connection
$conn = new mysqli($servername, $username, $password, $database);
?>
.datepickerdropdown {
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD6CAIAAADvIroEAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwQAADsEBuJFr7QAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjM2qefiJQAAAIhJREFUOE99w4cRgDAQBLHtvzKyyWByhjKo4E8z4vs+3vc1P8+Det836nVdqOd5oh7HgXXfd9Rt21DXdUVdlgV1nmes0zShjuOIOgwDqvcete97rF3XobZti9o0DWpd16hVVaGWZYm1KArUPM9RnXOoWZahpmmKNUkS1DiOUaMoQg3DEDUIAow/RjJ3qB92TU4AAAAASUVORK5CYII=);
border:1px solid #888;
border-radius:5px;
padding:10px;
position:absolute;
text-align:center;
}
.datepickerdropdown table {
border-collapse:collapse;
margin:auto;
}
.datepickerdropdown input {
font-family:monospace;
border:1px solid #888;
border-radius:3px;
margin:1px;
padding:2px 5px;
text-align:center;
}
.datepickerdropdown table input[type=button] {
width:2em;
}
.datepickerdropdown input[type=button] {
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAIAAABi9+OQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjM2qefiJQAAAElJREFUGFeNwwEGACEQQNF//6MlSRSRSMMkY86wdk+wj4e78zaz772Xcw6qioiw92atxZyTMQa9d1pr1FoppZBzJqVEjJEQwt8PXeRLuM/peRgAAAAASUVORK5CYII=);
}
.datepickerdropdown input[type=button]:hover {
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAIAAABi9+OQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjM2qefiJQAAAFpJREFUGFdjePfuAgMIv3lzCoxfvTrK8OLFAYbnz/cyPHmyleHx480MDx+uY7h3bxnDnTsLGW7enMVw7dpkhqtXJzJcutTFcOFCG8O5c00MZ87UMZw6VUksBgDwaURPl4Jv2AAAAABJRU5ErkJggg==);
}
.datepickerdropdown input[type=button]:active {
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAIAAABi9+OQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjM2qefiJQAAAFhJREFUGFdjOHWqkuHMmTqGc+eaGC5caGO4dKmL4erViQzXrk1muHlzFsOdOwsZ7t1bxvDw4TqGx483Mzx5spXh+fO9DC9eHGB49eoow5s3p8D43bsLpGAAr0NKhZpZNgcAAAAASUVORK5CYII=);
padding:2px 4px 2px 6px;
}
.datepickerdropdown input.selected {
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAIAAABi9+OQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjM2qefiJQAAAEBJREFUGFdj+P//P8P//5+A+CkQXwfiU0C8B4jXA/EiIJ4CxO1AXAnEOUAcB8SBQOwCxGZArAnE0kDMB8QMxGIAwnRFxCnPkL8AAAAASUVORK5CYII=);
}
.datepickerdropdown input[type=text] {
background:#fff;
color:#000;
}
.datepickerdropdown input.today {
border:1px solid red;
}
.datepickerdropdown input.othermonth {
color:#aaa;
border:1px solid #bbb;
}
.datepickershow img {
border:0;
}
.monthDsp
{
width:80px;
font-size:9px;
}
.daysRow
{
font-family:sans-serif;
font-size:11px;
}
html,body{
margin:0;
padding:0
}
#pagewidth{
}
#header{
position:relative;
height:100px;
background-color:#53df00;
padding-left:20px;
width:100%;
display:block;
overflow:auto;
}
#leftcol{
width:20%;
float:left;
position:relative;
background-color:#057d9f;
padding-left:15px;
height:700px;
}
#leftcol a:link {
color:#ffffff;
}
#leftcol a:visited {
color:#ffffff;
}
#maincol{
background-color:#fff;
position:relative;
width:75%;
float:right}
.clearfix:after{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden
}
.clearfix{
display:inline-block
}
* html .clearfix{
height:1%
}
.clearfix{
display:block
}
@media print{#leftcol{display:none}
#twocols,#maincol{
width:100%;
float:none;
}
/* Table presentation and layout */
#slides {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#slides td, #slides th {
border: 1px solid #ddd;
padding: 8px;
}
#slides tr:nth-child(even){background-color: #f2f2f2;}
#slides tr:hover {background-color: #ddd;}
#slides th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #0000ff;
color: white;
}
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: May 30, 2018 at 09:15 PM
-- Server version: 10.1.30-MariaDB-0ubuntu0.17.10.1
-- PHP Version: 7.1.17-0ubuntu0.17.10.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `signbrary`
--
-- --------------------------------------------------------
--
-- Table structure for table `slides`
--
CREATE TABLE `slides` (
`SlideID` int(11) NOT NULL,
`SlideName` text NOT NULL,
`SlideUp` datetime NOT NULL,
`SlideDown` datetime NOT NULL,
`SlideActive` tinytext NOT NULL,
`SlideFile` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `slides`
--
INSERT INTO `slides` (`SlideID`, `SlideName`, `SlideUp`, `SlideDown`, `SlideActive`, `SlideFile`) VALUES
(2, 'Raspberry Pi 3', '2018-05-22 10:00:00', '2018-06-30 11:00:00', 'active', 'uploads/RaspPi.jpg'),
(3, 'Library', '2018-05-17 09:00:00', '2018-06-01 10:00:00', 'active', 'uploads/hangzhou-2194105_1920.jpg'),
(9, 'Castle', '2018-05-22 08:00:00', '2018-06-22 09:00:00', 'active', 'uploads/nature-3352062_1920.jpg'),
(10, 'Earbuds Three', '2018-05-30 09:00:00', '2018-06-30 10:00:00', 'active', 'uploads/earbuds2.jpeg'),
(11, 'Code', '2018-05-21 10:00:00', '2018-06-30 12:00:00', 'active', 'uploads/code-944499_1280.jpg'),
(12, 'Lights', '2018-05-21 18:00:00', '2018-06-20 17:00:00', 'active', 'uploads/pexels-photo-573298.jpeg'),
(13, 'MP4 Test File', '2018-05-21 00:00:00', '2018-06-27 00:00:00', 'active', 'uploads/test.mp4'),
(20, 'Fingers Typing', '2018-05-30 08:00:00', '2018-06-30 08:00:00', 'active', 'uploads/Keyboard - 10822.mp4');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `slides`
--
ALTER TABLE `slides`
ADD PRIMARY KEY (`SlideID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `slides`
--
ALTER TABLE `slides`
MODIFY `SlideID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Date Picker Example</title>
<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
<script type="text/javascript" src="js/datepicker.js"></script>
<script type="text/javascript" src="js/timepicker.js"></script>
<style>
input {
font-family:monospace;
}
</style>
</head>
<body>
<h1>Date Picker Example</h1>
<p>Start Date / Time:<br />
<input id="start_dt" class='datepicker' size='11' title='D-MMM-YYYY' />
<input id="start_tm" class='timepicker' size='5' title='HH:MM' />
</p>
<p>End Date:<br />
<input id="end_dt" class='datepicker' size='11' title='D-MMM-YYYY' />
<input id="end_tm" class='timepicker' size='5' title='HH:MM' />
</p>
<h2>How to use these pickers in your app:</h2>
<p>Put the following 2 or 3 lines in your page's &lt;head&gt; section:</p>
<pre>&lt;link rel="stylesheet" type="text/css" href="datepicker.css" /&gt;
&lt;script type="text/javascript" src="datepicker.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="timepicker.js"&gt;&lt;/script&gt;</pre>
<p>On any &lt;input&gt; that you want to have a date picker for, set/add the 'datepicker' class:</p>
<pre>&lt;input id='start_dt' class='datepicker'&gt;
&lt;input id='another_dt' class='myclass datepicker'&gt;</pre>
<p>On any &lt;input&gt; that you want to have a time picker for, set/add the 'timepicker' class:</p>
<pre>&lt;input id='start_dt' class='timepicker'&gt;
&lt;input id='another_dt' class='myclass timepicker'&gt;</pre>
<p>I hope you enjoy these pickers as much as I enjoyed getting it working cross-browser :)</p>
</body>
</html>
<?php
include 'creds.php';
?>
<head>
<meta http-equiv="refresh" content="900"> <!-- Refreshes page every 15 minutes to check for new content -->
<style>
body {overflow:hidden; background-color: #000;}
.mySlides {display:none;max-width: 100%;max-height: 100vh;margin: auto;}
</style>
</head>
<body>
<?php
// Get the latest slides from the database
$result = mysqli_query($conn,"SELECT SlideFile from slides WHERE NOW() BETWEEN SlideUp AND SlideDown AND SlideActive = 'active'");
while($row = mysqli_fetch_array($result))
{
$row_file = $row['SlideFile'];
$info = pathinfo($row_file);
//if ($info["extension"] == "jpg" || $info["extension"] == "jpeg") {
if ($info["extension"] == "jpeg") {
echo '<img src="' . $row_file . '" class="mySlides">';
}
elseif ($info["extension"] == "mp4") {
echo '<video class="mySlides" autoplay loop>';
echo '<source src="'.$row_file.'" type="video/mp4">';
echo '</video>';
}
}
?>
<!-- JavaScript to change images -->
<script>
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 10000); // Change slide every 10 seconds
}
</script>
</body>
This diff is collapsed.
// Returns true if a string is an integer
function isInteger(s) {
for (i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (c<"0" || c>"9") return false;
}
return true;
}
// Make the time into a nice format as they type eg HHMM goes to HH:MM
function timePickerKeyup(e) {
var targ; // Crossbrowser way to find the target (http://www.quirksmode.org/js/events_properties.html)
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) targ = targ.parentNode; // defeat Safari bug
if (targ.value.length==4 && isInteger(targ.value)) {
targ.value = targ.value.substr(0,2) + ':' + targ.value.substr(2,2);
}
}
// Gets called if they tab out of a time picker, to neaten it up
function timePickerBlur(e) {
var targ; // Crossbrowser way to find the target (http://www.quirksmode.org/js/events_properties.html)
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) targ = targ.parentNode; // defeat Safari bug
if (targ.value.length==1 && isInteger(targ.value)) {
targ.value = '0' + targ.value + ':00';
}
if (targ.value.length==2 && isInteger(targ.value)) {
targ.value = targ.value + ':00';
}
if (targ.value.length==3 && isInteger(targ.value)) {
targ.value = '0' + targ.value.substr(0,1) + ':' + targ.value.substr(1,2);
}
if (targ.value.length==4 && isInteger(targ.value)) {
targ.value = targ.value.substr(0,2) + ':' + targ.value.substr(2,2);
}
}
// This is called when the page loads, it searches for inputs where the class is 'timepicker'
function timePickerInit() {
// Search for elements by class
var allElements = document.getElementsByTagName("*");
for (i=0; i<allElements.length; i++) {
var className = allElements[i].className;
if (className=='timepicker' || className.indexOf('timepicker ') != -1 || className.indexOf(' timepicker') != -1) {
allElements[i].onkeyup = timePickerKeyup;
allElements[i].onblur = timePickerBlur;
}
}
}
// Hook myself into the page load event
if (window.addEventListener) { // W3C standard
window.addEventListener('load', timePickerInit, false);
} else if (window.attachEvent) { // Microsoft
window.attachEvent('onload', timePickerInit);
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/layout.css" />
</head>
<body>
<div id="pagewidth">
<div id="header"><h1>Signbrary &ndash; Digital Signage. Digital Content.</h1></div>
<div id="wrapper" class="clearfix">
<div id="maincol"><h1>Slide Added</h1>
<?php
include 'creds.php';
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$mp4FileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$img_title = $_POST["img_title"];
$start_dt = $_POST["start_dt"];
$start_tm = $_POST["start_tm"];
$end_dt = $_POST["end_dt"];
$end_tm = $_POST["end_tm"];
$activeslide = $_POST["activeslide"];
// Check file for image or MP4
if(isset($_POST["submit"])) {
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 10000000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" && $imageFileType != "mp4") {
echo "Sorry, only JPG, JPEG, PNG, GIF, MP4 files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "<br /><br /><strong>File uploaded:</strong> ". basename( $_FILES["fileToUpload"]["name"]). "<br /><br />";
echo "<strong>File path:</strong> " . $target_file . "<br /><br />";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
// Converting dates to SQL standards
$date = new DateTime();
$newDisplayDate = $date->createFromFormat('j-M-Y', $start_dt);
$displaydate = $newDisplayDate->format('Y-m-d');
$newExpireDate = $date->createFromFormat('j-M-Y', $end_dt);
$expiredate = $newExpireDate->format('Y-m-d');
//echo "<strong>Date Test</strong><br /><br />";
//echo "Display slide on: " . $displaydate . "<br /><br />";
//echo "Slide expires on: " . $expiredate . "<br /><br />";
$time = new DateTime();
$newDisplayTime = $time->createFromFormat('G:i', $start_tm);
$displaytime = $newDisplayTime->format('H:i:s');
$newExpireTime = $time->createFromFormat('G:i', $end_tm);
$expiretime = $newExpireTime->format('H:i:s');
//echo "<strong>Time Test</strong><br /><br />";
//echo "Slide displays at: " . $displaytime . "<br /><br />";
//echo "Slide expires at: " . $expiretime . "<br /><br />";
echo "<strong>Slide display starts:</strong> " . $SlideUp = $displaydate . " " . $displaytime;
echo "<br /><br />";
echo "<strong>Slide expires on:</strong> " . $SlideDown = $expiredate . " " . $expiretime;
echo "<br /><br />";
if($imageFileType != "mp4") {
echo '<img src="' .$target_file . '" width="250"><br /><br />';
} else {
echo '<video width="250" autoplay loop><source src="' . $target_file . '" type="video/mp4"></video><br /><br />';
}
echo '<hr>';
echo '<a href="addslide.html">Add another slide</a> | <a href="slide-manage.php">Manage slides</a>';
// Updating the database
mysqli_query($conn,"INSERT INTO slides (SlideID,SlideName,SlideUp,SlideDown,SlideActive,SlideFile) VALUES (NULL,'$img_title','$SlideUp','$SlideDown','$activeslide','$target_file')");
// Close database connection
mysqli_close($conn);
?>
</div> <!-- End maincol -->
<div id="leftcol"><h2>Navigation</h2>
<hr>
<ul>
<li><a href="addslide.html">Add Slide</a></li>
<li><a href="slide-manage.php">Manage Slides</a></li>
</ul>
</div> <!-- End leftcol -->
</div> <!-- End wrapper -->
</div> <!-- End pagewidth -->
</body>
</html>
<?php
include 'creds.php';
$deleteid = htmlspecialchars($_GET["id"]);
// Updating the database
$result = mysqli_query($conn,"SELECT SlideFile FROM slides WHERE SlideID = '$deleteid'");
while($row = mysqli_fetch_array($result))
{
$filedelete = $row['SlideFile'];
}
unlink($filedelete);
mysqli_query($conn,"DELETE FROM slides WHERE SlideID = '$deleteid'");
// Close database connection
mysqli_close($conn);
header("Location: slide-manage.php"); // Slide deleted - return to management
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<script type="text/javascript" src="js/datepicker.js"></script>
<script type="text/javascript" src="js/timepicker.js"></script>
</head>
<body>
<div id="pagewidth">
<div id="header"><h2>Signbrary &ndash; Digital Signage. Digital Content.</h2></div>
<div id="wrapper" class="clearfix">
<div id="maincol"><h1>Edit Slide</h1>
<p>Accepted formats include: JPG, JPEG, PNG, GIF, MP4</p>
<p style = "color:#ff0000;">All fields are required.</p>
<hr>
<?php
$editid = htmlspecialchars($_GET["id"]);
include 'creds.php';
$result = mysqli_query($conn,"SELECT * from slides WHERE SlideID = '$editid'");
while($row = mysqli_fetch_array($result))
{
?>
<form action="slide-update.php" method="post" enctype="multipart/form-data">
Image Title:<br />
<input type="text" name="img_title" value="<?php echo(htmlspecialchars($row['SlideName'])); ?>" /><br /><br />
Start Date / Time:<br />
<input id="start_dt" name="start_dt" class='datepicker' size='11' title='D-MMM-YYYY' placeholder="Use date picker" />
<input id="start_tm" name="start_tm" class='timepicker' size='5' title='HH:MM' placeholder="HH:MM" /><br /><br />
End Date / Time:<br />
<input id="end_dt" name="end_dt" class='datepicker' size='11' title='D-MMM-YYYY' placeholder="Use date picker" />
<input id="end_tm" name="end_tm" class='timepicker' size='5' title='HH:MM' placeholder="HH:MM" /><br /><br />
Set Slide to Active/Inactive<br />
<input type="radio" name="activeslide" value="active" checked="checked">Active<br />
<input type="radio" name="activeslide" value="inactive">Inactive<br /><br />
Current Slide<br />
<?php
$checkMP4 = new SplFileInfo($row['SlideFile']);
$fileExt = ($checkMP4->getExtension());
if($fileExt != "mp4") {
echo '<img src="'.($row['SlideFile']).'" width="250"><br /><br />';
} else {
echo '<video width="250" autoplay loop><source src="'.($row['SlideFile']).'" type="video/mp4"></video><br /><br />';
}
?>
<input type="hidden" name="slidenumber" value="<?php echo $editid; ?>" />
Select media for upload (Max size = 10 MB):
<input type="file" name="fileToUpload" id="fileToUpload"><br /><br />
<input type="submit" value="Edit Slide" name="submit">
</form>
<?php
}
?>
</div> <!-- End maincol -->
<div id="leftcol"><h2>Navigation</h2>
<hr>
<ul>
<li><a href="addslide.html">Add Slide</a></li>
<li><a href="slide-manage.php">Manage Slides</a></li>
</ul>
</div> <!-- End leftcol -->
</div> <!-- End wrapper -->
</div> <!-- End pagewidth -->
</body>
</html>
<html>
<head>
<title>Signbrary - Manage Slides</title>
<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<script type="text/javascript" src="js/datepicker.js"></script>
<script type="text/javascript" src="js/timepicker.js"></script>
<style>
#slides {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 90%;
}