0% found this document useful (0 votes)
14 views63 pages

Canteen Management System

Uploaded by

gaura751
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views63 pages

Canteen Management System

Uploaded by

gaura751
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Fig.

7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Code of the Project
<?php
session_start();
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>The Perfect Food at Your Door!</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>


<!-- <meta http-equiv="refresh" content="1"> -->

<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Pacifico&display=swap"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Bree+Serif&display=swap"
rel="stylesheet">

<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php require('chunks/login-modal.php'); ?>

<?php require('chunks/register-modal.php'); ?>

<?php require('chunks/info-modal.php'); ?>

<?php require('chunks/navbar.php'); ?>

<?php require('chunks/banner-slider.php'); ?>

<?php require('chunks/description.php'); ?>


<?php require('chunks/cards.php'); ?>

<?php require('chunks/carousel.php'); ?>

<?php require('chunks/about.php'); ?>

<?php require('chunks/services.php'); ?>

<?php require('chunks/reviews.php'); ?>

<?php require('chunks/footer.php'); ?>

<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>

<!-- Compiled and minified JavaScript -->


<script
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></sc
ript>

<script src="js/loaders.js"></script>
<script src="js/ajax.js"></script>
</body>
</html>

<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>About!</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>


<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Pacifico&display=swap"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Bree+Serif&display=swap"
rel="stylesheet">

<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php require('chunks/login-modal.php'); ?>

<?php require('chunks/register-modal.php'); ?>

<?php require('chunks/info-modal.php'); ?>

<?php require('chunks/navbar.php'); ?>

<?php require('chunks/carousel.php'); ?>

<?php require('chunks/about-us.php'); ?>

<?php require('chunks/description.php'); ?>

<?php require('chunks/footer.php'); ?>

<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<!-- Compiled and minified JavaScript -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></sc
ript>

<script src="js/loaders.js"></script>
<script src="js/ajax.js"></script>
</body>
</html>
<?php
session_start();
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RestroGirls - Categories!</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>


<!-- <meta http-equiv="refresh" content="1"> -->

<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Pacifico&display=swap"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Bree+Serif&display=swap"
rel="stylesheet">

<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php require('chunks/login-modal.php'); ?>

<?php require('chunks/register-modal.php'); ?>

<?php require('chunks/info-modal.php'); ?>


<?php require('chunks/navbar.php'); ?>

<?php require('chunks/banner-slider.php'); ?>

<?php require('chunks/categories.php'); ?>

<?php require('chunks/footer.php'); ?>

<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>

<!-- Compiled and minified JavaScript -->


<script
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></sc
ript>

<script src="js/loaders.js"></script>
<script src="js/ajax.js"></script>
</body>
</html>
<?php
session_start();
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Categories!</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>


<!-- <meta http-equiv="refresh" content="1"> -->

<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Pacifico&display=swap"
rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Bree+Serif&display=swap"
rel="stylesheet">

<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php require('chunks/login-modal.php'); ?>

<?php require('chunks/register-modal.php'); ?>

<?php require('chunks/info-modal.php'); ?>

<?php require('chunks/navbar.php'); ?>

<?php require('chunks/banner-slider.php'); ?>

<?php require('chunks/foods.php'); ?>

<?php require('chunks/footer.php'); ?>

<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>

<!-- Compiled and minified JavaScript -->


<script
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></sc
ript>

<script src="js/loaders.js"></script>
<script src="js/ajax.js"></script>
</body>
</html>
-- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 03, 2019 at 09:15 PM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 7.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";


SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `mishtidb`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (


`id` int(11) NOT NULL,
`name` varchar(250) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `name`, `email`, `password`) VALUES


(1, 'Admin', '[email protected]', '12345');

-- --------------------------------------------------------

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (


`id` int(11) NOT NULL,
`name` varchar(250) NOT NULL,
`short_desc` varchar(250) NOT NULL,
`long_desc` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `name`, `short_desc`, `long_desc`) VALUES


(7, 'North Indian', 'This is a popular category in Northern India', 'Indian cuisine
encompasses a wide variety of regional cuisine native to India. Given the range of
diversity in soil type, climate and occupations, these cuisines vary significantly from
each other and use locally available chocolates, herbs, vegetables and fruits. The dishes
are then served according to taste in either mild, medium or hot. Indian food is also
heavily influenced by religious and cultural choices, like Hinduism and traditions.'),
(8, 'Chinese', 'Chinese cuisine is an important part of Chinese culture, which includes
cuisine originating from the diverse regions of China.', 'A number of different styles
contribute to Chinese cuisine but perhaps the best known and most influential are
Cantonese cuisine, Shandong cuisine, Jiangsu cuisine (specifically Huaiyang cuisine) and
Sichuan cuisine.'),
(9, 'South Indian', 'South Indian cuisine includes the cuisines of the five southern
states of India Andhra Pradesh, Karnataka, Kerala, Tamil Nadu and Telangana.', 'The
cuisines of Andhra Pradesh are the spiciest in all of India. Generous use of chili and
tamarind make the dishes tangy and hot. The majority of dishes are vegetable or lentil-
based.'),
(10, 'Snacks', ' A snack is a small portion of food eaten between meals.', 'A snack is a
small portion of food eaten between meals. This may be a snack food, such as potato chips
or baby carrots, but can also simply be a small amount of any food.'),
(11, 'Himalayan Food', 'Nepalese cuisine comprises a variety of cuisines based upon
ethnicity, soil and climate relating to Nepal cultural diversity and geography.', 'Much
of the cuisine is variation on Asian themes. Other foods have hybrid Tibetan, Indian and
Thai origins. They were originally filled with buffalo meat but now also with goat or
chicken, as well as vegetarian preparations. Special foods such as sel roti, finni roti
and patre are eaten during festivals such as Tihar.');

-- --------------------------------------------------------
--
-- Table structure for table `food`
--

CREATE TABLE `food` (


`id` int(11) NOT NULL,
`cat_id` int(10) NOT NULL,
`fname` varchar(50) NOT NULL,
`description` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `food`
--

INSERT INTO `food` (`id`, `cat_id`, `fname`, `description`) VALUES


(1, 9, 'Dosa', 'I love Dosa very much. Its a South Indian Food and Everybody loves it!'),
(7, 7, 'Egg Role', 'This is a North Indian Pop Food. Everybody likes it so damn very
much.'),
(8, 8, 'Chowmin', 'This is a Chinese Pop Food. Everybody likes it so damn very much.'),
(9, 10, 'French Fries', 'This is a Snacks Food. Everybody likes it so damn very much with
Tea or Coffee.'),
(10, 11, 'Momos', 'This is a Himalayan Pop Food. Everybody likes it so damn very much.
Its comes with different flavors!'),
(11, 8, 'Hakka Noodles', 'This food is so much popular even in India. It tastes like
Chowmein but with Gravy. ');

-- --------------------------------------------------------

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (


`id` int(11) NOT NULL,
`order_id` varchar(20) NOT NULL,
`user_id` varchar(10) NOT NULL,
`food_id` varchar(10) NOT NULL,
`user_name` varchar(100) NOT NULL,
`timestamp` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id`, `order_id`, `user_id`, `food_id`, `user_name`, `timestamp`)


VALUES
(3, 'RSTGF384345', '3', '1', 'Samprit', '04:09:2019 12:02:06am');
-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (


`id` int(11) NOT NULL,
`name` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`timestamp` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `name`, `email`, `password`, `timestamp`) VALUES


(3, 'Mishti Chakraborty', '[email protected]', '12345', '06:08:2019 01:40:08am');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `food`
--
ALTER TABLE `food`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `food`
--
ALTER TABLE `food`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;

/*!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 */;

<?php require('layout/header.php'); ?>


<?php require('layout/left-sidebar-long.php'); ?>
<?php require('layout/topnav.php'); ?>
<?php require('layout/left-sidebar-short.php'); ?>
<div class="section white-text" style="background: #B35458;">

<div class="section">
<h3>Add Categories</h3>
</div>

<div class="section center" style="padding: 40px;">

<form action="../backends/admin/cat-add.php" method="post">

<?php

if (isset($_SESSION['msg'])) {
echo '<div class="row" style="background: red; color: white;">
<div class="col s12">
<h6>'.$_SESSION['msg'].'</h6>
</div>
</div>';
unset($_SESSION['msg']);
}

?>

<div class="row">
<div class="col s6" style="">
<div class="input-field">
<input id="name" name="name" type="text" class="validate"
style="color: white; width: 70%">
<label for="name" style="color: white;"><b>Category Name
:</b></label>
</div>
</div>
<div class="col s6" style="">
<div class="input-field">
<input id="short_desc" name="short_desc" type="text"
class="validate" style="color: white; width: 70%">
<label for="short_desc" style="color: white;"><b>Short
Description :</b></label>
</div>
</div>
</div>

<div class="row">
<div class="col s12">

<div class="input-field">
<input id="long_desc" name="long_desc" type="text" class="validate"
style="color: white; width: 70%">
<label for="long_desc" style="color: white;"><b>Long Description
:</b></label>
</div>

</div>

</div>

<div class="row">
<div class="col s12">
<div class="section right" style="padding: 15px 10px;">
<a href="category-list.php" class="waves-effect waves-light
btn">Dismiss</a>
</div>
<div class="section right" style="padding: 15px 20px;">
<button type="submit" class="waves-effect waves-light btn">Add
New</button>
</div>
</div>
</div>

</form>

</div>

</div>

<?php require('layout/about-modal.php'); ?>


<?php require('layout/footer.php'); ?>
<?php require('layout/header.php'); ?>
<?php require('layout/left-sidebar-long.php'); ?>
<?php require('layout/topnav.php'); ?>
<?php require('layout/left-sidebar-short.php'); ?>

<?php

require('../backends/connection-pdo.php');

$sql = 'SELECT * FROM categories';

$query = $pdoconn->prepare($sql);
$query->execute();
$arr_all = $query->fetchAll(PDO::FETCH_ASSOC);

?>
<div class="section white-text" style="background: #B35458;">

<div class="section">
<h3>Categories</h3>
</div>

<?php

if (isset($_SESSION['msg'])) {
echo '<div class="section center" style="margin: 5px 35px;"><div class="row"
style="background: red; color: white;">
<div class="col s12">
<h6>'.$_SESSION['msg'].'</h6>
</div>
</div></div>';
unset($_SESSION['msg']);
}

?>

<div class="section right" style="padding: 15px 25px;">


<a href="category-add.php" class="waves-effect waves-light btn">Add New</a>
</div>

<div class="section center" style="padding: 20px;">


<table class="centered responsive-table">
<thead>
<tr>
<th>Name</th>
<th>Short Description</th>
<th>Long Description</th>
<th>Action</th>
</tr>
</thead>

<tbody>
<?php

foreach ($arr_all as $key) {

?>
<tr>
<td><?php echo $key['name']; ?></td>
<td><?php echo $key['short_desc']; ?></td>
<td><?php echo $key['long_desc']; ?></td>
<td><a href="../backends/admin/cat-delete.php?id=<?php echo $key['id'];
?>"><span class="new badge" data-badge-caption="">Delete</span></a></td>
</tr>
<?php } ?>

</tbody>
</table>
</div>
</div>

<?php require('layout/about-modal.php'); ?>


<?php require('layout/footer.php'); ?>
<?php require('layout/header.php'); ?>
<?php require('layout/left-sidebar-long.php'); ?>
<?php require('layout/topnav.php'); ?>
<?php require('layout/left-sidebar-short.php'); ?>

<?php
if (isset($_SESSION['msg'])) {
echo '<div class="section white-text" style="background:
#B35458;">'.$_SESSION['msg'].'</div>';
unset($_SESSION['msg']);
}
?>

<div class="section white-text center" style="background: #B35458; margin-top: 20px;">

<h4>Dashboard</h4>

<div class="row" style="padding: 50px;">


<div class="col s12">

<a class="dash-btn" href="food-list.php"><div class="sec white white-text"


style="margin: 15px; padding: 40px;border: 2px solid white; border-radius: 20px; font-
size: 20px; background: linear-gradient(to right, #AF6568, #FA797F);">Foods</div></a>
<a class="dash-btn" href="category-list.php"><div class="sec white white-
text" style="margin: 15px; padding: 40px;border: 2px solid white; border-radius: 20px;
font-size: 20px; background: linear-gradient(to right, #AF6568,
#FA797F);">Categories</div></a>
<a class="dash-btn" href="order-list.php"><div class="sec white white-text"
style="margin: 15px; padding: 40px;border: 2px solid white; border-radius: 20px; font-
size: 20px; background: linear-gradient(to right, #AF6568, #FA797F);">Orders</div></a>

</div>

</div>

</div>

<?php require('layout/about-modal.php'); ?>


<?php require('layout/footer.php'); ?>
<?php require('layout/header.php'); ?>
<?php require('layout/left-sidebar-long.php'); ?>
<?php require('layout/topnav.php'); ?>
<?php require('layout/left-sidebar-short.php'); ?>

<?php

require('../backends/connection-pdo.php');

$sql = 'SELECT id,name FROM categories';

$query = $pdoconn->prepare($sql);
$query->execute();
$arr_all = $query->fetchAll(PDO::FETCH_ASSOC);

?>

<div class="section white-text" style="background: #B35458;">

<div class="section">
<h3>Add Food Item</h3>
</div>

<div class="section center" style="padding: 40px;">

<form action="../backends/admin/food-add.php" method="post">

<?php

if (isset($_SESSION['msg'])) {
echo '<div class="row" style="background: red; color: white;">
<div class="col s12">
<h6>'.$_SESSION['msg'].'</h6>
</div>
</div>';
unset($_SESSION['msg']);
}

?>

<div class="row">
<div class="col s6" style="">
<div class="input-field">
<input id="name" name="name" type="text" class="validate"
style="color: white; width: 70%">
<label for="name" style="color: white;"><b>Food Name
:</b></label>
</div>
</div>
<div class="col s6" style="">
<div class="input-field" style="color: white !important;
width: 90%">
<select name='category'>
<?php

foreach ($arr_all as $key) {


echo '<option
value="'.$key['id'].'">'.$key['name'].'</option>';
}
?>
</select>
<label style="color: white;">Categories</label>
</div>
</div>
</div>

<div class="row">
<div class="col s12">

<div class="input-field">
<input id="desc" name="desc" type="text" class="validate" style="color:
white; width: 70%">
<label for="desc" style="color: white;"><b>Description :</b></label>
</div>

</div>

</div>

<div class="row">
<div class="col s12">
<div class="section right" style="padding: 15px 10px;">
<a href="food-list.php" class="waves-effect waves-light
btn">Dismiss</a>
</div>
<div class="section right" style="padding: 15px 20px;">
<button type="submit" class="waves-effect waves-light btn">Add
New</button>
</div>
</div>
</div>

</form>

</div>
</div>

<?php require('layout/about-modal.php'); ?>


<?php require('layout/footer.php'); ?>
<?php require('layout/header.php'); ?>
<?php require('layout/left-sidebar-long.php'); ?>
<?php require('layout/topnav.php'); ?>
<?php require('layout/left-sidebar-short.php'); ?>

<?php

require('../backends/connection-pdo.php');

$sql = 'SELECT food.id, food.fname, food.description, categories.name


FROM food
LEFT JOIN categories
ON food.cat_id = categories.id';

$query = $pdoconn->prepare($sql);
$query->execute();
$arr_all = $query->fetchAll(PDO::FETCH_ASSOC);

?>

<div class="section white-text" style="background: #B35458;">

<div class="section">
<h3>Foods</h3>
</div>

<?php

if (isset($_SESSION['msg'])) {
echo '<div class="section center" style="margin: 5px 35px;"><div class="row"
style="background: red; color: white;">
<div class="col s12">
<h6>'.$_SESSION['msg'].'</h6>
</div>
</div></div>';
unset($_SESSION['msg']);
}

?>

<div class="section right" style="padding: 15px 25px;">


<a href="food-add.php" class="waves-effect waves-light btn">Add New</a>
</div>

<div class="section center" style="padding: 20px;">


<table class="centered responsive-table">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Category</th>
<th>Action</th>
</tr>
</thead>

<tbody>
<?php

foreach ($arr_all as $key) {

?>
<tr>
<td><?php echo $key['fname']; ?></td>
<td><?php echo $key['description']; ?></td>
<td><?php echo $key['name']; ?></td>
<td><a href="../backends/admin/food-delete.php?id=<?php echo $key['id'];
?>"><span class="new badge" data-badge-caption="">Delete</span></a></td>
</tr>

<?php } ?>

</tbody>
</table>
</div>
</div>

<?php require('layout/about-modal.php'); ?>


<?php require('layout/footer.php'); ?>
<?php
session_start();
$msg_error='';
if(isset($_SESSION['msg']))
{
$msg_error=$_SESSION['msg'];
unset($_SESSION['msg']);
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="../css/form-style.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.css">
<title>Document</title>
</head>
<body>

<div class="login-page section">


<div class="center-align">
<div class="row">

<div class="col s12">

<div class="container">
<div class="container">
<div class="container">
<div class="card horizontal hoverable">

<div class="card-stacked">
<form class="card-content" action="login-admin.php"
method="post">
<h4 class="header">Admin Login</h4>

<?php

if(!empty($msg_error)){
echo '<div class="row error-msg">
<div class="col">
<b>'.$msg_error.'</b>
</div>
</div>';

}
?>

<div class="row">
<div class="input-field col s12">
<span for="email"><b>Email</b></span>
<input name="email" id="email"
type="email" class="validate">
</div>
</div>

<div class="row">
<div class="input-field col s12">
<span for="email"><b>Password</b></span>
<input id="password" name="password"
type="password" class="validate">
</div>
</div>

<div class="row">
<div class="col s12">
<button type="submit" class="waves-
effect waves-light btn"><b>Log In</b></button>
</div>
</div>

</form>
</div>
</div>

</div>
</div>
</div>

</div>

</div>
</div>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.js">
</script>
</body>
</html>
<?php
include_once("../backends/connection-pdo.php");

if (!isset($_POST['email']) || !isset($_POST['password'])) {

$_SESSION['msg'] = 'Invalid POST variable keys! Refresh the page!';

header('location: index.php');

exit();
}
$email=$_POST['email'];
$password=$_POST['password'];

$sql = "SELECT * FROM admin WHERE email='$email' AND password='$password'";

$query = $pdoconn->prepare($sql);
$query->execute();
$arr_login=$query->fetchAll(PDO::FETCH_ASSOC);

if (count($arr_login) > 0) {

foreach($arr_login as $val)
{
$tmp_name= $val['name'];

session_start();
$_SESSION['username']=$tmp_name;
$_SESSION['msg']="You have successfully Logged In!";
header('location: dashboard.php');

} else {
session_start();
$_SESSION['msg']="Invalid Credentials!";
header('location: index.php');
}

?>
<?php require('layout/header.php'); ?>
<?php require('layout/left-sidebar-long.php'); ?>
<?php require('layout/topnav.php'); ?>
<?php require('layout/left-sidebar-short.php'); ?>

<?php

require('../backends/connection-pdo.php');

$sql = 'SELECT orders.order_id, orders.user_name, orders.timestamp, food.fname FROM


orders LEFT JOIN food ON orders.food_id = food.id';

$query = $pdoconn->prepare($sql);
$query->execute();
$arr_all = $query->fetchAll(PDO::FETCH_ASSOC);

?>

<div class="section white-text" style="background: #B35458;">

<div class="section">
<h3>Orders</h3>
</div>

<?php

if (isset($_SESSION['msg'])) {
echo '<div class="section center" style="margin: 5px 35px;"><div class="row"
style="background: red; color: white;">
<div class="col s12">
<h6>'.$_SESSION['msg'].'</h6>
</div>
</div></div>';
unset($_SESSION['msg']);
}

?>

<div class="section center" style="padding: 20px;">


<table class="centered responsive-table">
<thead>
<tr>
<th>Order ID</th>
<th>User Name</th>
<th>Food Name</th>
<th>Timestamp</th>
</tr>
</thead>

<tbody>
<?php

foreach ($arr_all as $key) {

?>
<tr>
<td><?php echo $key['order_id']; ?></td>
<td><?php echo $key['user_name']; ?></td>
<td><?php echo $key['fname']; ?></td>
<td><?php echo $key['timestamp']; ?></td>
</tr>

<?php } ?>

</tbody>
</table>
</div>
</div>

<?php require('layout/about-modal.php'); ?>


<?php require('layout/footer.php'); ?>

You might also like