Skip to content

Instantly share code, notes, and snippets.

@pcfreak30
Created March 30, 2014 13:18
Show Gist options
  • Save pcfreak30/9872689 to your computer and use it in GitHub Desktop.
Save pcfreak30/9872689 to your computer and use it in GitHub Desktop.
Simple Login System
<?php
require "session.php";
if(empty($_SESSION['loggedin']))
{
include('templates/index.php');
die();
}
else
{
include('templates/login.php');
die();
}
<?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');
}
<?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