Example #1
0
function authorized($username, $service, $mode = AUTH_VERIFY)
{
    if ($service == 'http') {
        if ($mode != AUTH_PROBE) {
            u_syslog("Gave {$service} access to {$username}");
        }
        return TRUE;
    } elseif ($service == 'postcomment' and is_logged_in()) {
        if ($mode != AUTH_PROBE) {
            u_syslog("Gave {$service} access to {$username}");
        }
        return TRUE;
    } elseif (is_logged_in() and $service == 'updatejournal' and $username == JOURNAL_USERNAME) {
        if ($mode != AUTH_PROBE) {
            u_syslog("Gave {$service} access to {$username}");
        }
        return TRUE;
    } else {
        if ($mode != AUTH_PROBE) {
            u_syslog("Denied {$service} access to {$username}");
        }
        return FALSE;
    }
}
function authenticate($username, $password, $mode = AUTH_VERIFY)
{
    $authenticators = split('\\s+,\\s+', LOGIN_AUTHENTICATORS);
    while (count($authenticators) > 0) {
        $af = 'authenticate_' . array_shift($authenticators);
        if (($authstat = $af($username, $password)) != AUTH_SERVFAIL) {
            if ($mode != AUTH_PROBE) {
                u_syslog("Authenticated {$username}");
            }
            return $authstat;
        }
    }
    if ($mode != AUTH_PROBE) {
        u_syslog("Failed to authenticate {$username}");
    }
    return AUTH_DENY;
    // Obsolete:
    if (LOGIN_AUTHENTICATOR == 'imap') {
        return authenticate_imap($username, $password);
    } elseif (LOGIN_AUTHENTICATOR == 'passwd') {
        return authenticate_passwd($username, $password);
    } else {
        return FALSE;
    }
    // Obsolete:
    if (USERNAME == 'aredridel') {
        if ($username == 'aredridel' and $password == 'arcanixdesire') {
            return true;
        } else {
            return false;
        }
    } elseif (USERNAME == 'toodamnperky') {
        if (($username == 'toodamnperky' or $username == 'marina') and $password == 'perkyisgood') {
            return true;
        } else {
            return false;
        }
    } elseif (USERNAME == 'jadzia') {
        $crypted = '16BeVr1SnBnrQ';
        if ($username == 'jadzia' and crypt($password, $crypted) == $crypted) {
            return true;
        } else {
            return false;
        }
    } elseif (USERNAME == 'ryland') {
        $crypted = '$1$Ne2wTZ2g$ykyhHrAD1fXAAvSSHCOSQ0';
        if ($username == 'ryland' and crypt($password, $crypted) == $crypted) {
            return true;
        } else {
            return false;
        }
    } elseif (USERNAME == 'carrie') {
        if ($username = '******' and $password = '******') {
            return TRUE;
        } else {
            return FALSE;
        }
    } elseif (USERNAME == 'thelhf') {
        if ($username == 'thelhf' and $password == 'smart') {
            return true;
        } else {
            return false;
        }
    }
}
Example #3
0
<?php

require "syslog.php";
u_openlog("hmm");
u_syslog("test");