Created
March 30, 2014 13:18
-
-
Save pcfreak30/9872689 to your computer and use it in GitHub Desktop.
Simple Login System
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
<?php | |
require "session.php"; | |
if(empty($_SESSION['loggedin'])) | |
{ | |
include('templates/index.php'); | |
die(); | |
} | |
else | |
{ | |
include('templates/login.php'); | |
die(); | |
} |
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
<?php | |
require "session.php"; | |
if(!empty($_SESSION['loggedin']) | |
{ | |
header("Location: index.php"); | |
} | |
if($_POST['username'] == 'admin' && $_POST['password'] = 'password') | |
{ | |
$_SESSION['loggedin'] = true; | |
header("Location: index.php"); | |
} | |
else | |
{ | |
include('template/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
<?php | |
session_start(); | |
//Put anything else here to be shared between all pages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment