Skip to content

Commit

Permalink
implemented the logput concept
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulRehmanGHub committed Apr 12, 2024
1 parent 8bcf0b6 commit 4f9dfe2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
34 changes: 29 additions & 5 deletions display.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

session_start();
if(isset($_SESSION['email'])) {
echo "Welcome ".$_SESSION['email'];
} else {
echo "Welcome Guest!";
}
// if(isset($_SESSION['email'])) {
// echo "Welcome ".$_SESSION['email'];
// } else {
// echo "Welcome Guest!";
// }
?>

<html>
Expand Down Expand Up @@ -48,6 +48,17 @@
.delete_btn {
background: red;
}

.logout_btn input{
background: purple;
color: #fff;
width: 80px;
height: 25px;
border-radius: 7px;
cursor: pointer;
margin-top: 20px;
margin-left: 45%;
}
</style>
</head>

Expand All @@ -56,6 +67,14 @@
include ("connection.php");
error_reporting(0);

$userprofile = $_SESSION['email'];

if($userprofile == true) {

}else {
header('location:login.php');
}

$query = "SELECT * FROM form";
$data = mysqli_query($conn, $query);

Expand Down Expand Up @@ -133,6 +152,11 @@
?>

</table>

<div class="logout_btn">
<a href="logout.php"><input type="submit" value="Logout" name="logout_btn"></a>
</div>

</html>

<script>
Expand Down
6 changes: 6 additions & 0 deletions logout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
session_start();

session_unset();
header('location:login.php');
?>
10 changes: 10 additions & 0 deletions update.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
<?php
session_start();

include ("connection.php");
error_reporting(0);

$id = $_GET['id'];

$userprofile = $_SESSION['email'];

if($userprofile == true) {

}else {
header('location:login.php');
}

$query = "SELECT * FROM form WHERE id= '$id'";
$data = mysqli_query($conn, $query);

Expand Down

0 comments on commit 4f9dfe2

Please sign in to comment.