Esempio n. 1
0
<?php

define('path', '../../../');
$page = "Register";
require path . 'inc/init.php';
$user = new User();
if ($user->hasPermission("Admin")) {
    if (Input::exists()) {
        if (Token::check(Input::get('token'))) {
            $val = new Validation();
            $val->check($_POST, array('name' => array('required' => true), 'username' => array('required' => true, 'min' => 2, 'max' => 50, 'unique' => 'users'), 'password' => array('required' => true, 'min' => 8), 'password_conf' => array('required' => true, 'matches' => 'password')));
            if ($val->passed()) {
                $salt = hash::salt(32);
                $password = hash::make(escape(Input::get('password')), $salt);
                try {
                    $user->create(array('username' => escape(Input::get('username')), 'password' => Hash::make(escape(Input::get('password')), $salt), 'salt' => $salt, 'name' => escape(Input::get('name')), 'joined' => date('Y-m-d- H:i:s'), 'group' => 1));
                } catch (Exception $e) {
                    die($e->getMessage());
                }
            }
        }
    }
} else {
    session::flash("error", "You don't have admin permission! If you think this is an error contact your administrator or owner");
    Redirect::to(path . "index.php");
}
?>
<html>
	<head>
		<?php 
include path . 'assets/php/css.php';