diff --git a/Project/addairframe.php b/Project/addairframe.php new file mode 100644 index 0000000..c335efa --- /dev/null +++ b/Project/addairframe.php @@ -0,0 +1,33 @@ +prepare("select * from users where email=?"); + $stmt->execute([$email]); + + if ($stmt->rowCount() === 1) + { + $user = $stmt->fetch(); + + $user_id = $user['id']; + $user_full_name = $user['full_name']; + $user_email = $user['email']; + $user_password = $user['password']; + + if ($email === $user_email) + { + if (password_verify($password, $user_password)) + { + $_SESSION['user_id'] = $user_id; + $_SESSION['user_email'] = $user_email; + $_SESSION['user_full_name'] = $user_full_name; + + header("Location: index.php"); + }else + { + header("Location: login.php?error=Incorrect Username or Password&email=$email"); + } + }else + { + header("Location: login.php?error=Incorrect Username or Password&email=$email"); + } + }else + { + header("Location: login.php?error=Incorrect Username or Password&email=$email"); + } + } +} \ No newline at end of file diff --git a/Project/db_conn.php b/Project/db_conn.php new file mode 100644 index 0000000..8b403c7 --- /dev/null +++ b/Project/db_conn.php @@ -0,0 +1,14 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +}catch(PDOException $e){ + echo "Connection failed : ". $e->getMessage(); +} \ No newline at end of file diff --git a/Project/home.php b/Project/home.php new file mode 100644 index 0000000..ca6afa9 --- /dev/null +++ b/Project/home.php @@ -0,0 +1,186 @@ +query("select af_name, af_id from airframe"); + $eng_list = $mysqli->query("select full_name from users where role='eng'"); + $task_list = $mysqli->query("select task_name from task"); + $log_hr = $mysqli->query("select af_name, af_num, af_flight_hr from airframe"); +?> + + + + + + + + ABC | LOG + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ Log Flight Hours + +
+ + +
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+ + + + + + +
+
+
+ + +
+
+
+ +
+ ".$_SESSION['status'].""; + unset($_SESSION['status']); + } + ?> +
+ + + + + + \ No newline at end of file diff --git a/Project/index.php b/Project/index.php new file mode 100644 index 0000000..ba67503 --- /dev/null +++ b/Project/index.php @@ -0,0 +1,78 @@ + + + + + + + + + ABC | HOME + + + + + + + + + + + + + + + + + + + + +
+ +

+

+
+ + + + \ No newline at end of file diff --git a/Project/instrction/Instruction.docx b/Project/instrction/Instruction.docx new file mode 100644 index 0000000..1e33eb8 Binary files /dev/null and b/Project/instrction/Instruction.docx differ diff --git a/Project/instrction/test_db.sql b/Project/instrction/test_db.sql new file mode 100644 index 0000000..334eef0 --- /dev/null +++ b/Project/instrction/test_db.sql @@ -0,0 +1,175 @@ +-- phpMyAdmin SQL Dump +-- version 5.1.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: Jan 03, 2022 at 06:29 PM +-- Server version: 10.4.22-MariaDB +-- PHP Version: 8.1.0 + +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: `test_db` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `airframe` +-- + +CREATE TABLE `airframe` ( + `af_id` int(50) NOT NULL, + `af_name` varchar(100) NOT NULL, + `af_num` varchar(100) NOT NULL, + `af_flight_hr` int(50) NOT NULL, + `af_log` int(50) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Dumping data for table `airframe` +-- + +INSERT INTO `airframe` (`af_id`, `af_name`, `af_num`, `af_flight_hr`, `af_log`) VALUES +(1, 'Air India', 'AI001', 600, 0), +(2, 'British Airways', 'BA201', 320, 0), +(3, 'Etihad Airways', 'ET301', 220, 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sedmain` +-- + +CREATE TABLE `sedmain` ( + `sm_id` int(50) NOT NULL, + `sm_eng_name` varchar(100) NOT NULL, + `sm_date` date NOT NULL, + `sm_af_name` varchar(100) NOT NULL, + `sm_category` varchar(100) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Dumping data for table `sedmain` +-- + +INSERT INTO `sedmain` (`sm_id`, `sm_eng_name`, `sm_date`, `sm_af_name`, `sm_category`) VALUES +(1, 'Test Two', '2022-01-08', 'Air India', 'A Check'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `task` +-- + +CREATE TABLE `task` ( + `task_id` int(50) NOT NULL, + `task_name` varchar(100) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Dumping data for table `task` +-- + +INSERT INTO `task` (`task_id`, `task_name`) VALUES +(1, 'ABC Check'), +(2, 'A Check'), +(3, 'B Check'), +(4, 'C Check'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +CREATE TABLE `users` ( + `id` int(11) NOT NULL, + `full_name` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `role` varchar(50) NOT NULL, + `password` varchar(1000) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Dumping data for table `users` +-- + +INSERT INTO `users` (`id`, `full_name`, `email`, `role`, `password`) VALUES +(1, 'Test One', 'test@one.com', 'sup', '$2y$10$LdDUueQiee34EM9uPCCnWeohxby3nC.I2/Ban3lKJ3pFv0QFFfIry'), +(2, 'Test Two', 'test@two.com', 'eng', '$2y$10$tcVE2AeukPcpXRkg4M9nIOlCbtPtYTLlxQH3zVPZjdD4GQQZ09aFq'), +(3, 'Arjun Yadla', 'arjun@yadla', 'eng', 'arjun'), +(5, 'Abhi Patil', 'abhi@patil.com', 'sup', '$2y$10$VSSTFTiMcSbiKUwXsoD0BOcQqSsar7Z1P7eWI0e1i8Lg1iAmUeWDu'), +(6, 'Akhi Patil', 'akhi@patil.com', 'eng', '$2y$10$oMNWqc9UcEcLmPkzsoJPYuWJxb0pvbBfmLIqlRXzGPFf5JlHkSiTy'), +(7, 'Karan Patel', 'karan@patel.com', 'sup', '$2y$10$96qvb0Tu6qlOBP6g/yn.Bev6Wf4xRY7aCVNbwF7WGJmOxB7B9sSfG'); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `airframe` +-- +ALTER TABLE `airframe` + ADD PRIMARY KEY (`af_id`); + +-- +-- Indexes for table `sedmain` +-- +ALTER TABLE `sedmain` + ADD PRIMARY KEY (`sm_id`); + +-- +-- Indexes for table `task` +-- +ALTER TABLE `task` + ADD PRIMARY KEY (`task_id`); + +-- +-- Indexes for table `users` +-- +ALTER TABLE `users` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `email` (`email`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `airframe` +-- +ALTER TABLE `airframe` + MODIFY `af_id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + +-- +-- AUTO_INCREMENT for table `sedmain` +-- +ALTER TABLE `sedmain` + MODIFY `sm_id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `task` +-- +ALTER TABLE `task` + MODIFY `task_id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + +-- +-- AUTO_INCREMENT for table `users` +-- +ALTER TABLE `users` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; +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 */; diff --git a/Project/login.php b/Project/login.php new file mode 100644 index 0000000..5394abc --- /dev/null +++ b/Project/login.php @@ -0,0 +1,53 @@ + + + + + + + + + ABC | LOGIN + + + + +
+
+

LOGIN

+ + + + + + +
+ + +
+
+ + +
+ + +
+
+ + + \ No newline at end of file diff --git a/Project/logout.php b/Project/logout.php new file mode 100644 index 0000000..c968746 --- /dev/null +++ b/Project/logout.php @@ -0,0 +1,8 @@ +query("select af_name, af_id from airframe"); + + +if (isset($_POST['update'])) +{ + + $query = "UPDATE airframe SET af_flight_hr='$_POST[af_flight_hr]' WHERE af_name='$_POST[airframe]'" ; + + $query_run = mysqli_query($db,$query); + + if ($query_run) + { + $_SESSION['status'] = "Flight Hours Logged Successfully"; + header("Location: home.php"); + }else { + $_SESSION['status'] = "Fail to Log Flight Hours Logged"; + header("Location: home.php"); + } +}elseif (isset($_POST['upd'])) +{ + $date = date('Y-m-d', strtotime($_POST['dat'])); + $query = "UPDATE sedmain SET sm_eng_name='$_POST[users]', sm_category='$_POST[task]', sm_date='$date' WHERE sm_af_name='$_POST[airframe]'" ; + + $query_run = mysqli_query($db,$query); + + if ($query_run) + { + $_SESSION['status'] = "Task Assign Successfully"; + header("Location: home.php"); + }else { + $_SESSION['status'] = "Task Assign Fail"; + header("Location: home.php"); + } +} \ No newline at end of file diff --git a/Project/manage.php b/Project/manage.php new file mode 100644 index 0000000..0ba9dfa --- /dev/null +++ b/Project/manage.php @@ -0,0 +1,121 @@ + + + + + + + + + ABC | MANAGE + + + + + + + + + + + + + + + + + +
+
+
+ +
+ +
+ Full Name + +
+ +
+ Email + +
+ +
+ Password + +
+ +
+ + +
+ + + +
+
+ +
+
+
+ +
+ +
+ Air Frame Name + +
+ +
+ Air Frame Number + +
+ + +
+
+ + + + \ No newline at end of file diff --git a/Project/totloghr.php b/Project/totloghr.php new file mode 100644 index 0000000..e865dfc --- /dev/null +++ b/Project/totloghr.php @@ -0,0 +1,23 @@ +query("select af_name, af_num, af_flight_hr from airframe"); + + + if ($run) + { + echo "Air Frame Added"; + }else { + echo "Fail to add Air Frame"; + } +} \ No newline at end of file