Skip to content

Commit

Permalink
Update 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cmxmunna committed Aug 18, 2021
0 parents commit c79e28d
Show file tree
Hide file tree
Showing 60 changed files with 3,156 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Online Food Ordering Syatem
## Instructions
```bash
==============================================================
1.Download the project folder.
2.Move project folder into C:\xampp\htdocs
3.Open phpmyadmin and create a database named 'ticket'.
4.Import 'ticket.sql' into your database.
5.Run project at Apache localhost.
6.Enjoy
==============================================================
```


##Admin Login
```bash
username -> cmxmunna
password -> 12345
```

##User Login
```bash
-> Register your account and login
```

Looking for other Projects?
https://github.com/cmxmunna?tab=repositories

## Developer Inentity
```bash
==============================================================
----------------------
| MUNNA, SHIHAB |
| ID: 18-36025-1 |
----------------------
American International University Bangladesh
==============================================================
```
70 changes: 70 additions & 0 deletions control/Add-ticket-control.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
include "header.php";
require_once ('../model/model.php');

session_start();
$id = "";
$user ="";
$type ="";
if(isset($_SESSION['id']))
{
$id = $_SESSION['id'];
}
if(isset($_SESSION['name']))
{
$user = $_SESSION['name'];
}
if(isset($_SESSION['type']))
{
$type = $_SESSION['type'];
}
else
{
header("location: ../view/login-form.php");
}

$moviename = $category = $date = $time = $price = $image = "";
$successfulMessage = '';
$errorMessage = '';

if(isset($_POST['submit']))
{
$moviename = $_POST['moviename'];
$category = $_POST['category'];
$date = $_POST['date'];
$time = $_POST['time'];
$price = $_POST['price'];


$target_dir = "../resources/movie_img/";
$target_file = $target_dir . basename($_FILES["image"]["name"]);

if (move_uploaded_file($_FILES["image"]["tmp_name"], $target_file))
{
$image = $_FILES["image"]["name"];
}
else
{
$errorMessage = "error occurred while Inserting New Record";
}

$connection = new db();
$conn=$connection->OpenCon();
$userQuery=$connection->InsertItem($conn,"ticketlist",$moviename ,$category ,$date,$time ,$price ,$image);

$flag=1;
if($flag==1)
{
$successfulMessage = "New Record Inserted by $user";
}
else
{
$errorMessage = "error occurred while Inserting New Record";
}
$conn->close();

}



?>
46 changes: 46 additions & 0 deletions control/changePasswordControl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
include "header.php";
require_once ('../model/model.php');

session_start();
$username ="";
$successfulMessage = $errorMessage = "";
if(isset($_SESSION['username']))
{
$username = $_SESSION['username'];
}
else
{
header("location: ../view/login-form.php");
}

$connection = new db();
$conn=$connection->OpenCon();
$userQuery=$connection->viewProfile($conn,"userinfo",$username);

if($userQuery->num_rows > 0)
{
while($row=$userQuery->fetch_assoc())
{
$name = $row['name'];
$username = $row['username'];
$password = $row['password'];
}
}
if(isset($_POST['submit']))
{
$update_password = $_POST['newpassword'];

$userQuery2=$connection->UpdatePassword($conn,"userinfo",$update_password,$username);
$flag=1;
if($flag==1)
{
$successfulMessage = "Password Updated ";
}
else
{
$errorMessage = "error occurred while updating";
}
$conn->close();
}
?>
65 changes: 65 additions & 0 deletions control/create-orderControl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
include "header.php";
require_once '../model/model.php';
$successfulMessage = $errorMessage = $getwayErr= "";

$id= $_GET['movie_id'];
$connection = new db();
$conn=$connection->OpenCon();
$Query=$connection->viewTicketProfile($conn,"ticketlist",$id);

if($Query->num_rows > 0)
{
while($row=$Query->fetch_assoc())
{
$moviename = $row['moviename'];
$category = $row['category'];
$date = $row['date'];
$time = $row['time'];
$price = $row['price'];
$image = $row['image'];
}
}
if(isset($_POST['confirm']))
{
if(empty($_POST['payment_method']))
{
$getwayErr = "Choose a payment Method!!!";
}
else
{
$order_id = (time()* 36025);
$username = $_POST['username'];
$movie_id = $_POST['movie_id'];
$movie_name = $_POST['moviename'];
$category = $_POST['category'];
$date = $_POST['date'];
$time = $_POST['time'];
$amount = $_POST['price'];
$payment_method = $_POST['payment_method'];
$number = $_POST['number'];
$status = "New Order Placed";
$order_date = $_POST['order_date'];

$userQuery=$connection->CreateOrder($conn,"orders",$order_id,$username,$movie_id, $movie_name,$category,$date,$time,$amount,$payment_method,$number,$status,$order_date);
$flag=1;
if($flag==1)
{
$successfulMessage = "ORDER PLACED SUCCESFULLY , <br>see order <a href='../view/view-customer-order-history.php'>History</a>";
}
else
{
$errorMessage = "error occurred";
}
$conn->close();
}

}







?>
19 changes: 19 additions & 0 deletions control/delete-ticketControl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
require_once '../model/model.php';
$movie_id = $_GET['movie_id'];

$connection = new db();
$conn=$connection->OpenCon();
$userQuery=$connection->DeleteItem($conn,"ticketlist",$movie_id);
$flag=1;
if($flag==1)
{
header("location: ../view/view-all-tickets.php");
$successfulMessage = "Delete Success";
}
else
{
$errorMessage = "error occurred while Deleting";
}
$conn->close();
?>
19 changes: 19 additions & 0 deletions control/delete-userControl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
require_once '../model/model.php';
$user_id = $_GET['user_id'];

$connection = new db();
$conn=$connection->OpenCon();
$userQuery=$connection->DeleteUser($conn,"userinfo",$user_id);
$flag=1;
if($flag==1)
{
header("location: ../view/view-users.php");
$successfulMessage = "Delete Success";
}
else
{
$errorMessage = "error occurred while Deleting";
}
$conn->close();
?>
53 changes: 53 additions & 0 deletions control/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

switch ($_SERVER['SCRIPT_NAME']) {
case '/OFOS/view/login-form.php':
$CURRENT_PAGE = "Login";
$PAGE_TITLE = "Login Page";
break;

case '/OFOS/view/registration-form.php':
$CURRENT_PAGE = "Registration ";
$PAGE_TITLE = "Registration Page";
break;

case '/OFOS/view/home-page.php':
$CURRENT_PAGE = "Home";
$PAGE_TITLE = "Home Page";
break;

case '/OFOS/view/profile.php':
$CURRENT_PAGE = "Profile ";
$PAGE_TITLE = "Profile Page";
break;

case '/OFOS/view/changepassword.php':
$CURRENT_PAGE = "Change Password";
$PAGE_TITLE = "Change Password Page";
break;

case '/OFOS/view/View-Menu.php':
$CURRENT_PAGE = "View-Menu";
$PAGE_TITLE = "View-Menu Page";
break;

case '/OFOS/view/View-Order-Details.php':
$CURRENT_PAGE = "View-Order-Details ";
$PAGE_TITLE = "View-Order-Details Page";
break;

case '/OFOS/view/Food-item.php':
$CURRENT_PAGE = "Food Item ";
$PAGE_TITLE = "Food Item Page";
break;

default:
$CURRENT_PAGE = "Home";
$PAGE_TITLE = "Home Page";

break;

}


?>
12 changes: 12 additions & 0 deletions control/isset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
$a = 0;
if (isset($a)) {
echo "Variable 'a' is set";
}

$b = null

if (empty($a)) {
echo "Variable 'b' is empty";
}
?>
49 changes: 49 additions & 0 deletions control/logincontrol.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
include_once('../model/model.php');
session_start();

$error="";
// store session data
if (isset($_POST['login']))
{
$username=$_POST['username'];
$password=$_POST['password'];

$connection = new db();
$conobj=$connection->OpenCon();

$userQuery = $connection -> login($conobj,"userinfo",$username,$password);
$row = mysqli_fetch_array($userQuery);

if ($userQuery->num_rows > 0)
{
$_SESSION["name"] = $row['name'];
$_SESSION["username"] = $row['username'];
$_SESSION["password"] = $row['password'];
$_SESSION["email"] = $row['email'];
$_SESSION["type"] = $row['type'];
$_SESSION["address"] = $row['address'];
$_SESSION["phone"] = $row['phone'];
$_SESSION["dob"] = $row['dob'];
$_SESSION["gender"] = $row['gender'];
header("location: ../view/home-page.php");

if(empty($_POST["remember"]))
{
setcookie("username","");
setcookie("password","");
}
else
{
setcookie ("username",$_POST["username"],time() + 86400);
setcookie ("password",$_POST["password"],time() + 86400);
}
}
else
{
$error = "Username or Password is invalid";
}
$connection->CloseCon($conobj);
}

?>
9 changes: 9 additions & 0 deletions control/logout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

session_start();

session_destroy();

header("Location: ../view/login-form.php");

?>
Loading

0 comments on commit c79e28d

Please sign in to comment.