Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //File will check if user is logged in.
- //If user is not logged in, will be redirected to the login page with an error.
- //Logged in users will be allowed access to the page.
- //Copyright 2012 Cas Eliëns and Dennis Koeter.
- $q=$_GET['q'];
- //$a is authentication level required.
- //if $a is 'u', regular user authentication is required.
- //if $a is 'a', administrative authentication is required.
- if($q=='u') {
- if(isset($_SESSION['uid'])) {
- $uid = $_SESSION['uid'];
- }
- else {
- header("location:index.php?q=noauth"); }
- }
- elseif($q=='a') {
- if(isset($_SESSION['perm'])) {
- $perm = $_SESSION['perm'];
- $uid = $_SESSION['uid'];
- if($perm=='a') {
- $authenticate = true;
- }
- elseif($perm=='u') {
- header("location:noauth.php?q=u");
- }
- else {
- header("location:noauth.php?q=e");
- }
- }
- }
- else {
- header("location:index.php?q=noauth");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement