Location: PHPKode > projects > CMSmelborp > CMSmelborp/admin/includes/checkpermissions.php
<?php
/*******************************************************************************
License:
	Copyright 2005 Ryan Morehart
	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at
	
	http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
	
Filename: /admin/includes/checkpermissions.php

Purpose: Checks if the user has permission to perform the requested action.

Processed parameters: (TYPE - NAME - DESCRIPTION - DEFAULT)
	None
*******************************************************************************/

// Figure out the "name" of the current action
$self = $_SERVER['PHP_SELF'];

// Directory name
$dirEndPos = strrpos($self, '/');
$actionCat = substr($self, 0, $dirEndPos);
$dirEndPos = strrpos($actionCat, '/');
$actionCat = substr($actionCat, $dirEndPos + 1);

// Actual script name (list, edit, delete, etc.)
$dirEndPos = strrpos($self, '/');
$actionType = substr($self, $dirEndPos + 1, strlen($self) - $dirEndPos - 5);

if(checkPermissions($connection, $_SESSION['permissions'], $actionCat, $actionType) == false)
{
	header('Location: ../misc/notallowed.php');
	die('No permissions');
}
?>
Return current item: CMSmelborp