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
9 changed files
with
493 additions
and
0 deletions.
There are no files selected for viewing
15
connect.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,15 @@ | ||
<?php | ||
$HOSTNAME='localhost'; | ||
$USERNAME='root'; | ||
$PASSWORD=''; | ||
$DATABASE='crudoperation'; | ||
|
||
|
||
$con=mysqli_connect($HOSTNAME,$USERNAME,$PASSWORD,$DATABASE); | ||
|
||
if(!$con){ | ||
//echo "Success"; | ||
die(mysqli_error($con)); | ||
} | ||
|
||
?> |
10
connect1.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,10 @@ | ||
<?php | ||
|
||
$con1=new mysqli('localhost','root','','crudoperation'); | ||
|
||
if(!$con1){ | ||
die(mysqli_error($con1)); | ||
} | ||
|
||
|
||
?> |
18
delete.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,18 @@ | ||
<?php | ||
include 'connect1.php'; | ||
if(isset($_GET['deleteid'])){ | ||
$id=$_GET['deleteid']; | ||
|
||
$sql="delete from `crud` where id=$id"; | ||
$result=mysqli_query($con,$sql); | ||
if($result){ | ||
//echo "Deleted success"; | ||
header('location:display.php'); | ||
}else{ | ||
die(mysqli_error($con)); | ||
} | ||
|
||
} | ||
|
||
|
||
?> |
87
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,87 @@ | ||
<?php | ||
include 'connect1.php'; | ||
?> | ||
<?php | ||
session_start(); | ||
if(!isset($_SESSION['username'])){ | ||
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> |
79
login.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,79 @@ | ||
<?php | ||
$login=0; | ||
$invalid=0; | ||
|
||
if($_SERVER['REQUEST_METHOD']=='POST'){ | ||
include 'connect.php'; | ||
$username=$_POST['username']; | ||
$password=$_POST['password']; | ||
$epassword = md5($password); | ||
|
||
$sql="Select * from `registration` where username='$username' and password='$epassword'"; | ||
|
||
$result=mysqli_query($con,$sql); | ||
if($result){ | ||
$num=mysqli_num_rows($result); | ||
if($num>0){ | ||
$login=1; | ||
session_start(); | ||
$_SESSION['username']=$username; | ||
header('location:display.php'); | ||
|
||
}else{ | ||
$invalid=1; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
|
||
|
||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
|
||
<title>ABC Air Login</title> | ||
|
||
</head> | ||
<body background="https://images.hdqwalls.com/download/passenger-airplanes-clouds-5k-m7-1920x1080.jpg" no-repeat center center fixed;> | ||
<?php | ||
if($login){ | ||
echo '<div class="alert alert-success alert-dismissible fade show" role="alert"> | ||
<strong>Great!</strong> You have logged in successfully!!!<button type="button" class="btn-close" | ||
data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div>'; | ||
} | ||
?> | ||
<?php | ||
if($invalid){ | ||
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert"> | ||
<strong>Error!</strong> Invalid Credentials!!If not registered, please sign up<button type="button" class="btn-close" | ||
data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div>'; | ||
} | ||
?> | ||
<br> | ||
<h1 class="text-center mt-5" style="color:black;">ABC Air Login</h1><br> | ||
<div class="container mt-5"> | ||
<form action="login.php" method="post"> | ||
<div class="mb-3"> | ||
<label for="exampleInputEmail1" class="form-label" style="color:black;"><b>Name</b></label> | ||
<input type="text" class="form-control" placeholder="Enter name" name="username"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="exampleInputPassword1" class="form-label" style="color:black;"><b>Password</b></label> | ||
<input type="password" class="form-control" placeholder="Enter password" name="password"> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-danger w-100">Login</button> | ||
</form> | ||
</div><br> | ||
<center><b>Not Registered? </b><button class="btn btn-dark"><a href="sign.php" class="text-light" style="text-decoration: none;"> | ||
Sign up here</a></button></center> | ||
</body> | ||
</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,8 @@ | ||
<?php | ||
|
||
|
||
session_start(); | ||
session_destroy(); | ||
$_SESSION['block'] = true; | ||
header('location:login.php'); | ||
?> |
106
sign.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,106 @@ | ||
<?php | ||
$success=0; | ||
$user=0; | ||
$invalid=0; | ||
|
||
if($_SERVER['REQUEST_METHOD']=='POST'){ | ||
include 'connect.php'; | ||
$username=$_POST['username']; | ||
$password=$_POST['password']; | ||
$cpassword=$_POST['cpassword']; | ||
$epassword = md5($password); | ||
|
||
|
||
$sql="Select * from `registration` where username='$username'"; | ||
|
||
$result=mysqli_query($con,$sql); | ||
if($result){ | ||
$num=mysqli_num_rows($result); | ||
if($num>0){ | ||
$user=1; | ||
|
||
}else{ | ||
if($password===$cpassword){ | ||
|
||
$sql="insert into `registration`(username,password) values('$username','$epassword')"; | ||
$result=mysqli_query($con,$sql); | ||
if($result){ | ||
$success=1; | ||
header('location:display.php'); | ||
} | ||
}else{ | ||
$invalid=1; | ||
//die(mysqli_error($con)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
?> | ||
|
||
|
||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
|
||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
|
||
<title>ABC Air Sign up</title> | ||
</head> | ||
<body background="https://images.hdqwalls.com/download/passenger-airplanes-clouds-5k-m7-1920x1080.jpg" no-repeat center center fixed;> | ||
|
||
<?php | ||
if($user){ | ||
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert"> | ||
<strong>Oops!</strong> User Already Exists! Please Login!<button type="button" class="btn-close" | ||
data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div>'; | ||
} | ||
?> | ||
<?php | ||
if($invalid){ | ||
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert"> | ||
<strong>Error!</strong> Passwords do not match!!<button type="button" class="btn-close" | ||
data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div>'; | ||
} | ||
?> | ||
<?php | ||
if($success){ | ||
echo '<div class="alert alert-success alert-dismissible fade show" role="alert"> | ||
<strong>Great!</strong> You have signed in successfully!!!<button type="button" class="btn-close" | ||
data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div>'; | ||
} | ||
?> | ||
|
||
<br> | ||
<h1 class="text-center mt-5">ABC Air Sign Up</h1><br> | ||
<div class="container mt-5"> | ||
<form action="sign.php" method="post"> | ||
<div class="mb-3"> | ||
<label for="exampleInputEmail1" class="form-label" style="color:black;"><b>Name</b></label> | ||
<input type="text" class="form-control" placeholder="Enter name" name="username"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="exampleInputPassword1" class="form-label" style="color:black;"><b>Password</b></label> | ||
<input type="password" class="form-control" placeholder="Enter password" name="password"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="exampleInputPassword1" class="form-label" style="color:black;"><b>Confirm Password</b></label> | ||
<input type="password" class="form-control" placeholder="Confirm password" name="cpassword"> | ||
</div> | ||
|
||
|
||
<button type="submit" class="btn btn-danger w-100">Sign up</button> | ||
</form> | ||
</div><br> | ||
<center><b>Already Registered? </b><button class="btn btn-dark"><a href="login.php" class="text-light" style="text-decoration: none;"> | ||
Login here</a></button></center> | ||
</body> | ||
</html> |
Oops, something went wrong.