Beispiel #1
0
function get_cache_defeater()
{
    global $cache_defeater, $devel_mode;
    if (($val = @$cache_defeater) == NULL) {
        if (($val = @file_get_contents("commit")) == NULL) {
            $val = generate_urandom_string(8);
        }
        $cache_defeater = $val;
    }
    return $val;
}
Beispiel #2
0
}
if ($createuser == 1) {
    echo "<form action='login.php' method='post'>\n";
    echo "<input name='username' size='40' />\n";
    echo "<br />";
    echo "<input type='password' name='password' size='40' />\n";
    echo "<br />";
    echo "<input type='hidden' name='createuser' value='2' />\n";
    echo "<input type='submit' value='Create' />\n";
    echo "</form>\n";
} else {
    if ($createuser == 2) {
        $stmt = sprintf("select username from users where username='******'", $username);
        $q = query($stmt);
        if (($r = fetch($q)) != NULL) {
            $t = "index.php?createduser=2";
            redirect($t);
        }
        $q = query("select nextval('seq') as seq");
        $r = fetch($q);
        $id = 0 + $r->seq;
        $salt = generate_urandom_string(10);
        $hash = $password . $salt;
        $hash = md5($hash);
        $stmt = sprintf("insert into users (username, hash, salt, id)" . " values ('%s', '%s', '%s', '%d')", $username, $hash, $salt, $id);
        query($stmt);
        $t = "index.php?createduser=1";
        redirect($t);
    }
}
pfinish();