Exemplo n.º 1
0
    public static function output($namespace, $vars = array())
    {
        $segments = explode('/', $namespace);
        $view = array_shift($segments);
        $path = implode('/', $segments);
        $class = Lib::view($view);
        $class->set($vars);
        return $class->output($path);
    }
    public static function hash($password)
    {
        return hash('sha256', $password);
    }
    public static function generateHash($length = 64)
    {
        $random = hash('sha256', rand());
        $maxLength = strlen($random);
        $length = min($maxLength, max(0, $length));
        $start = rand(0, $maxLength - $length);
        return substr($random, $start, $length);
    }
}
$base = dirname(__FILE__);
// Load config
require_once $base . '/../config.php';
// Initiate session first
Lib::session();
// Load constant
Lib::load('constant');
// Load additional libraries
Lib::load('req');