<?php

class root{
	var $key;

	function __construct(){
		$this->key=key($_GET);
		$this->handler();
	}

	private function handler(){
		$auth=(int)Auth();
		if($auth!==1 and $this->key!=='login'){
			include('./inc/forms/login.php');
			return false;
		}

		if(!$this->check()){
			ban_acc();
			include('./inc/disabled.php');
			return false;
		}

		if(is_file('./file/disabled')){
			include('./inc/disabled.php');
			return false;
		}

        $path='./kernel/'.$this->key.'.class.php';
        if(!is_file($path) or preg_match('#[^a-z]#s',$this->key)){
            include('./inc/404.php');
        	return false;
        }

        if($auth==1){
        	include('./inc/menu.php');
        }
        //include($path); 
        require_once $path;
        new $this->key;
    }

    private function check(){
    	$search=array('"',"'",'`','(',')');

    	for($c=0;$c<5;$c++){
    		if(strstr($this->key,$search[$c])){
    			return false;
    		}
    	}
    	return true;
    }
}

?>