Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
340CT-Resit/index.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50 lines (45 sloc)
1.11 KB
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
<!-- used to log in the user, also checks for any errors --> | |
<?php | |
session_start(); | |
if (!isset($_SESSION['username'])) { | |
$_SESSION['msg'] = "You must log in first"; | |
header('location: login.php'); | |
} | |
if (isset($_GET['logout'])) { | |
session_destroy(); | |
unset($_SESSION['username']); | |
header("location: login.php"); | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Home</title> | |
<link rel="stylesheet" type="text/css" href="inc/css/stylee.css"> | |
</head> | |
<body> | |
<div class="content"> | |
<!-- notification message --> | |
<?php if (isset($_SESSION['success'])) : ?> | |
<div class="error success" > | |
<h3> | |
<?php | |
echo $_SESSION['success']; | |
unset($_SESSION['success']); | |
?> | |
</h3> | |
</div> | |
<?php endif ?> | |
<!-- if user log in is successful, displays the website menu --> | |
<?php if (isset($_SESSION['username'])) : ?> | |
<header> | |
<p>Welcome <strong><?php echo $_SESSION['username']; ?></strong></p> | |
<?php include('inc/menu.nav.php'); ?> | |
<div class="title"> | |
<h1>Gamers Hub</h1> | |
</div> | |
</header> | |
<?php endif ?> | |
</div> | |
</body> | |
</html> |