Location: PHPKode > projects > Ajax File Manager - AjaxExplorer > ajaxexplorer/script/core.php
<?php

/*
AjaxExplorer Copyright (C) 2007-2008 Syed Mohammad Sidque Tahir Al-Habshi

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Head to
GNU site http://www.gnu.org/licenses/ for license copy.
*/

session_start();
error_reporting(0);

if(file_exists(($main=isset($main)? '':'../').'install.php'))
{
  header('location: '.$main.'install.php');
  exit;
}

$flag=0;
$userid=isset($_SESSION['userid'])? $_SESSION['userid']:0;

$tbl=file($main.'user/config.php');
$arr=array('recycle', 'replace', 'thumbs', 'log1', 'log2', 'maxsize', 'root');
foreach(explode("\t", $tbl[0]) as $id=>$value)
{
  $$arr[$id]=$value;
}

$tbl=file($main.'user/record.php');
$arr=array('username', 'password', 'path', 'perm');
foreach(explode("\t", $tbl[$userid]) as $id=>$value)
{
  $$arr[$id]=$value;
}

if($access=='0001' && !($perm & 0x0001)) $flag=1;
if($access=='0002' && !($perm & 0x0002)) $flag=1;
if($access=='0004' && !($perm & 0x0004)) $flag=1;
if($access=='0008' && !($perm & 0x0008)) $flag=1;
if($access=='0016' && $perm<16) $flag=1;
if($access=='0108' && (!($perm & 0x0001) || !($perm & 0x0008))) $flag=1;

if($flag || (!$userid && $access!='0000'))
{
  echo $main? ($flag? '!':'?'):'You do not have the permission!';
  exit;
}

function Post($name)
{
  return isset($_POST[$name])? str_replace('*', '&', $_POST[$name]):'';
}

function FName($name)
{
  $name=substr('wwwwroot'.$name, 0, -1);
  return substr($name, strrpos($name, '/')+1);
}

?>
Return current item: Ajax File Manager - AjaxExplorer