コード例 #1
0
ファイル: prefs.php プロジェクト: RomanSixty/Feed-on-Feeds
}
if (!defined('FOF_AUTH_EXTERNAL_ONLY')) {
    if (isset($_POST['changepassword'])) {
        if ($_POST['password'] != $_POST['password2']) {
            $message = "Passwords do not match!";
        } else {
            $username = $_POST['username'];
            $password = $_POST['password'];
            fof_db_change_password($username, $password);
            $message = "Changed password for {$username}.";
        }
    }
    if (fof_is_admin() && isset($_POST['adduser']) && $_POST['username'] && $_POST['password']) {
        $username = $_POST['username'];
        $password = $_POST['password'];
        fof_db_add_user($username, $password);
        $message = "User '{$username}' added.";
    }
    if (fof_is_admin() && isset($_POST['deleteuser']) && $_POST['username']) {
        $username = $_POST['username'];
        fof_db_delete_user($username);
        $message = "User '{$username}' deleted.";
    }
}
include "header.php";
if (!empty($message)) {
    echo "<br><span style=\"color:red\">{$message}</span><br>\n";
}
?>
<br>
<h1 id="basic">Feed on Feeds - Preferences</h1>
コード例 #2
0
ファイル: fof-main.php プロジェクト: RomanSixty/Feed-on-Feeds
function require_user()
{
    global $fof_user_id, $fof_user_name, $fof_user_level;
    if (defined('FOF_AUTH_EXTERNAL') && !empty($_SERVER['REMOTE_USER'])) {
        $user_row = fof_db_get_user($_SERVER['REMOTE_USER']);
        if (empty($user_row)) {
            fof_log('user \'' . $_SERVER['REMOTE_USER'] . '\' not indexed', 'auth');
            if (defined('FOF_AUTH_EXTERNAL_ADD')) {
                $result = fof_db_add_user($_SERVER['REMOTE_USER'], 'unused password' . $_SERVER['UNIQUE_ID']);
                $user_row = fof_db_get_user($_SERVER['REMOTE_USER']);
                fof_log('added new index for user \'' . $_SERVER['REMOTE_USER'] . '\'', 'auth');
            }
        }
        if (!empty($user_row)) {
            $fof_user_id = $user_row['user_id'];
            $fof_user_name = $user_row['user_name'];
            $fof_user_level = $user_row['user_level'];
            fof_log('user \'' . $_SERVER['REMOTE_USER'] . '\' established', 'auth');
            return true;
        }
        if (defined('FOF_AUTH_EXTERNAL_ONLY')) {
            return false;
        }
    }
    if (!isset($_COOKIE['user_name']) || !isset($_COOKIE['user_password_hash'])) {
        header('Location: login.php');
        exit;
    }
    $user_name = $_COOKIE['user_name'];
    $user_password_hash = $_COOKIE['user_password_hash'];
    if (!fof_authenticate($user_name, $user_password_hash)) {
        header('Location: login.php');
        exit;
    }
}