Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
858 additions
and
0 deletions.
There are no files selected for viewing
BIN
+39.2 KB
air.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
session_start(); | ||
// Change this to your connection info. | ||
$DATABASE_HOST = 'localhost'; | ||
$DATABASE_USER = 'root'; | ||
$DATABASE_PASS = ''; | ||
$DATABASE_NAME = 'phplogin'; | ||
// Try and connect using the info above. | ||
$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); | ||
if ( mysqli_connect_errno() ) { | ||
// If there is an error with the connection, stop the script and display the error. | ||
exit('Failed to connect to MySQL: ' . mysqli_connect_error()); | ||
} | ||
|
||
// Now we check if the data from the login form was submitted, isset() will check if the data exists. | ||
if ( !isset($_POST['username'], $_POST['password']) ) { | ||
// Could not get the data that should have been sent. | ||
exit('Please fill both the username and password fields!'); | ||
} | ||
|
||
// Prepare our SQL, preparing the SQL statement will prevent SQL injection. | ||
if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) { | ||
// Bind parameters (s = string, i = int, b = blob, etc), in our case the username is a string so we use "s" | ||
$stmt->bind_param('s', $_POST['username']); | ||
$stmt->execute(); | ||
// Store the result so we can check if the account exists in the database. | ||
$stmt->store_result(); | ||
if ($stmt->num_rows > 0) { | ||
$stmt->bind_result($id, $password); | ||
$stmt->fetch(); | ||
// Account exists, now we verify the password. | ||
// Note: remember to use password_hash in your registration file to store the hashed passwords. | ||
if (password_verify($_POST['password'], $password)) { | ||
// Verification success! User has logged-in! | ||
// Create sessions, so we know the user is logged in, they basically act like cookies but remember the data on the server. | ||
session_regenerate_id(); | ||
$_SESSION['loggedin'] = TRUE; | ||
$_SESSION['name'] = $_POST['username']; | ||
$_SESSION['id'] = $id; | ||
header('Location: home.php'); | ||
} else { | ||
// Incorrect password | ||
echo 'Incorrect username and/or password!'; | ||
} | ||
} else { | ||
// Incorrect username | ||
echo 'Incorrect username and/or password!'; | ||
} | ||
|
||
$stmt->close(); | ||
} | ||
?> | ||
|
88
display.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
session_start(); | ||
if(!isset($_SESSION['username'])){ | ||
header('location:login.php'); | ||
} | ||
if(isset($_SESSION['block'])) | ||
{ | ||
header('location: login.php'); | ||
} | ||
|
||
|
||
?> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>ABC Air</title> | ||
|
||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
|
||
|
||
</head> | ||
<body background="https://images.hdqwalls.com/download/airplane-wings-1920x1080.jpg" background-size="no-repeat center center fixed;"> | ||
<br> | ||
<h3 class="text-center mt-5" style="color:black;"><b>AirFrames ABC Air Services</b></h3> | ||
<h4 class="text-center mt-5" style="color:black;"><b>This is the common dashboard where Airframes created will be displayed and can be updated if necessary</b></h4> | ||
<h4 class="text-center mt-3" style="color:black;"><b>The Airframes created are displayed below</b></h4> | ||
<div class="container"> | ||
|
||
<table class="table table-secondary table-striped table-hover table-border"> | ||
<thead class="table-light"> | ||
<tr> | ||
<th scope="col">Sno.</th> | ||
<th scope="col">Maintenance Type</th> | ||
<th scope="col">Engineer Assigned</th> | ||
<th scope="col">Flight Hours</th> | ||
<th scope="col">Flight Number</th> | ||
<th scope="col">Maintenance Schedule Date</th> | ||
<th scope="col">Options</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
<?php | ||
//For printing data from the database in a loop | ||
$sql="Select * from `crud`"; | ||
$result=mysqli_query($con,$sql); | ||
if($result){ | ||
while($row=mysqli_fetch_assoc($result)){ | ||
$id=$row['id']; | ||
$name=$row['name']; | ||
$engg=$row['engg']; | ||
$fhr=$row['fhr']; | ||
$fno=$row['fno']; | ||
$date=$row['date']; | ||
echo '<tr> | ||
<th scope="row">'.$id.'</th> | ||
<td>'.$name.'</td> | ||
<td>'.$engg.'</td> | ||
<td>'.$fhr.'</td> | ||
<td>'.$fno.'</td> | ||
<td>'.$date.'</td> | ||
<td> | ||
<button class="btn btn-dark"><a href="update.php?updateid='.$id.'" class="text-light" style="text-decoration: none;">Update</a></button> | ||
<button class="btn btn-danger"><a href="delete.php?deleteid='.$id.'" class="text-light" style="text-decoration: none;">Delete</a></button> | ||
</td> | ||
</tr>'; | ||
|
||
} | ||
} | ||
|
||
?> | ||
|
||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<div class="container"> | ||
|
||
<!--<button class="btn btn-dark w-100"><a href="login.php" class="text-light" style="text-decoration: none;">Logout</a></button>--> | ||
<center><button class="btn btn-dark my-3"><a href="user.php" class="text-light" style="text-decoration: none;">Add Air Frame</a> | ||
</button> <button class="btn btn-dark"><a href="logout.php" class="text-light" style="text-decoration: none;">Logout | ||
</a></button></center> | ||
</div> | ||
</body> | ||
</html> |
52
home.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
// We need to use sessions, so you should always start sessions using the below code. | ||
session_start(); | ||
// If the user is not logged in redirect to the login page... | ||
if (!isset($_SESSION['loggedin'])) { | ||
header('Location: index.html'); | ||
exit; | ||
} | ||
?> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>ABC</title> | ||
<link href="style.css" rel="stylesheet" type="text/css"> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"> | ||
</head> | ||
<body class="loggedin"> | ||
<nav class="navtop"> | ||
<div> | ||
<h1>ABC Air</h1> | ||
<a href="profile.php"><i class="fas fa-user-circle"></i>Profile</a> | ||
<a href="logout.php"><i class="fas fa-sign-out-alt"></i>Logout</a> | ||
</div> | ||
</nav> | ||
|
||
<div class="content"> | ||
<h2>Home Page</h2> | ||
</div> | ||
<br> | ||
<div style="text-align:center"> | ||
<img src="air.jpg" style="width:35%; height:25%"> | ||
</div> | ||
|
||
<div class="content"> | ||
<p>Welcome to ABC Air Official Website!<br><br>ABC Air is a small aircraft service company that carry out the aircraft maintenance for the civil operators. The | ||
company records the total number of flying hours for each aircraft, servicing time, man-hours of the engineers | ||
and related maintenance.</p> | ||
</div> | ||
|
||
<div class="content"> | ||
<h2>List of Engineers</h2> | ||
<p>Aeronautical Engineer ; ID : 100002 | ||
<br>Aerospace Engineer ; ID : 100003 | ||
<br>Astronautical Engineer ; ID : 100004 | ||
<br>Avionics Engineer ; ID : 100005 | ||
<br>Mechanical Engineer ; ID : 100006</p> | ||
</div> | ||
</body> | ||
</html> | ||
|
25
index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Login</title> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"> | ||
<link href="style.css" rel="stylesheet" type="text/css"> | ||
</head> | ||
<body> | ||
<div class="login"> | ||
<h1>Login</h1> | ||
<form action="authenticate.php" method="post"> | ||
<label for="username"> | ||
<i class="fas fa-user"></i> | ||
</label> | ||
<input type="text" name="username" placeholder="Username" id="username" required> | ||
<label for="password"> | ||
<i class="fas fa-lock"></i> | ||
</label> | ||
<input type="password" name="password" placeholder="Password" id="password" required> | ||
<input type="submit" value="Login"> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
37
insert.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
$DATABASE_HOST = 'localhost'; | ||
$DATABASE_USER = 'root'; | ||
$DATABASE_PASS = ''; | ||
$DATABASE_NAME = 'phplogin'; | ||
|
||
$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); | ||
|
||
if(isset($_POST['submit'])) | ||
{ | ||
if(!empty($_POST['airframe']) && !empty($_POST['engineer']) && !empty($_POST['fhr'])) | ||
{ | ||
$airframe = $_POST['airframe'] ; | ||
$engineer = $_POST['engineer'] ; | ||
$fhr = $_POST['fhr'] ; | ||
|
||
$query = "insert into logs(airframe,engineer,fhr) values('$airframe' , '$engineer' , '$fhr')" ; | ||
|
||
$run = mysqli_query($con,$query) ; | ||
|
||
if($run) | ||
{ | ||
echo "Form Submitted" ; | ||
} | ||
else | ||
{ | ||
echo "Form Submitted" ; | ||
} | ||
} | ||
else | ||
{ | ||
echo "All Fields Required" ; | ||
} | ||
} | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
session_start(); | ||
session_destroy(); | ||
// Redirect to the login page: | ||
header('Location: index.html'); | ||
?> |
9
logs.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE IF NOT EXISTS `logs5` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`fhr5` varchar(50) NOT NULL, | ||
`mt5` varchar(255) NOT NULL, | ||
`eng5` varchar(100) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; | ||
|
||
INSERT INTO `logs5` (`id`, `fhr5`, `mt5`, `eng5`) VALUES (1, '750 - 900 Hours', '07/01/2022 : 12 PM - 8 PM', 'Avionic & Aerospace Engineer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test | ||
$2y$10$SfhYIDtn.iOuCW7zfoFLuuZHX6lja4lF4XA4JqNmpiH/.P3zB8JCa |
Oops, something went wrong.