Example #1
0
function doNewUser()
{
    $username = $_REQUEST["UserName"];
    $user = new User();
    if ($user->selectByName($username)) {
        fehlerausgabe("Fehler: User existiert schon");
        die;
    }
}
Example #2
0
function doLogin($username)
{
    $usr = new User();
    if ($usr->selectByName($username) == false) {
        die("No such user in DB");
    }
    if ($usr->password != crypt($_SERVER["PHP_AUTH_PW"], $usr->password)) {
        die("Wrong password");
    }
    $_SESSION["user"] = $usr;
}
Example #3
0
     if (trim($eintragen[0]) == "{$groupname}:") {
         // Benutzer-Name zu Gruppe
         $zeile = trim($fc_htgroup[$i]) . " " . $username;
         // hinzufuegen
     } else {
         $zeile = trim($fc_htgroup[$i]);
     }
     if ($zeile != "") {
         fwrite($f_htgroup, "{$zeile}\n");
     }
 }
 fclose($f_htgroup);
 $user = new User();
 $user->loginname = $username;
 $group = new User();
 $group->selectByName($groupname);
 $user->user_id_parent = $group->user_id;
 if ($user->insert()) {
     $acl = new ACL();
     $acl->user_id = $user->user_id;
     $acl->path_id = $group->path_id;
     if (isset($_POST["admin"]) && $_POST["admin"] == "true") {
         $acl->{$delete_path} = 1;
         $acl->{$write_path} = 1;
         $acl->{$read_path} = 1;
         $acl->{$rename_path} = 1;
     } else {
         $acl->{$delete_path} = 0;
         $acl->{$write_path} = 0;
         $acl->{$read_path} = 0;
         $acl->{$rename_path} = 0;
Example #4
0
require_once "inc/models/user.php";
$action = 'login-prepare';
$again = true;
$username = $_POST['username'];
$passwort = $_POST['password'];
$incorrectUsername = false;
$incorrectPassword = false;
if ($username == '') {
    $incorrectUsername = true;
}
if ($passwort == '') {
    $incorrectPassword = true;
}
if ($username != '' && $passwort != '' && User::userExists($username)) {
    if (User::checkHashedPassword($username, $passwort)) {
        $user = User::selectByName($username);
        $_SESSION['loggedIn'] = true;
        $_SESSION['loggedInUser'] = $username;
        $_SESSION['loggedInAdmin'] = false;
        $_SESSION['loginTime'] = time();
        if ($user['admin_rights'] == 1) {
            $_SESSION['loggedInAdmin'] = true;
        }
        $action = 'start-prepare';
        $hostname = $_SERVER['HTTP_HOST'];
        $path = dirname($_SERVER['PHP_SELF']);
        if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
            if (php_sapi_name() == 'cgi') {
                header('Status: 303 See Other');
            } else {
                header('HTTP/1.1 303 See Other');