Skip to content

Commit

Permalink
Fix session php website
Browse files Browse the repository at this point in the history
  • Loading branch information
r4ulcl committed Oct 13, 2024
1 parent 05b21b8 commit 6241e56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 4 additions & 1 deletion APs/config/html/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php session_start(); /* Starts the session */
<?php
// Start the session
session_start();

if (!isset($_SESSION['UserData']['Username'])) {
header("location:login.php");
exit;
Expand Down
5 changes: 4 additions & 1 deletion APs/config/html/lab.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php session_start(); /* Starts the session */
<?php
// Start the session
session_start();

if (!isset($_SESSION['UserData']['Username'])) {
header("location:login.php");
exit;
Expand Down
13 changes: 6 additions & 7 deletions APs/config/html/login.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php
// Start the session
session_start();

// Check if user is already logged in
if (isset($_SESSION['UserData']['Username'])) {
header("Location:index.php"); // Redirect to index.php
exit; // Make sure to exit after redirection
// Check if the user is already logged in
if (isset($_SESSION['Username'])) {
header("Location: index.php");
exit;
}

session_start(); /* Starts the session */


/* Check Login form submitted */
if (isset($_POST['Submit'])) {
/* Define username and associated password array */
Expand Down

0 comments on commit 6241e56

Please sign in to comment.