Ejemplo n.º 1
0
            } else {
                if (preg_match("/(?:REAL|FLOA|DOUB)/i", $type)) {
                    return "REAL";
                } else {
                    return "NUMERIC";
                }
            }
        }
    }
}
//- Check user authentication, login and logout
$auth = new Authorization();
//create authorization object
// check if user has attempted to log out
if (isset($_POST['logout'])) {
    $auth->revoke();
} else {
    if (isset($_POST['login']) && isset($_POST['password'])) {
        $auth->attemptGrant($_POST['password'], isset($_POST['remember']));
    }
}
//- Actions on database files and bulk data
if ($auth->isAuthorized()) {
    //- Create a new database
    if (isset($_POST['new_dbname'])) {
        if ($_POST['new_dbname'] == '') {
            // TODO: Display an error message (do NOT echo here. echo below in the html-body!)
        } else {
            $str = preg_replace('@[^\\w-.]@', '', $_POST['new_dbname']);
            $dbname = $str;
            $dbpath = $str;