Skip to content

Instantly share code, notes, and snippets.

@codersatx
Created June 17, 2011 19:36
Show Gist options
  • Save codersatx/1032134 to your computer and use it in GitHub Desktop.
Save codersatx/1032134 to your computer and use it in GitHub Desktop.
A login helper to use in conjunction with the login class.
<?php
define("BASEPATH","pathname");
//To use this include it in the top of all pages you need to protect:
//<?php include_once('login_helper.php');?>
function authenticate($url = 'login.php')
{
session_start();
if( $_SESSION['authenticated'] == FALSE)
{
header('Location:login.php');
}
}
authenticate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment