コード例 #1
0
ファイル: userlogin.php プロジェクト: CDFLS/CWOJ
function login($user, $is_cookie, $pwd = '')
{
    require __DIR__ . '/../conf/database.php';
    if (!function_exists('my_rsa')) {
        require __DIR__ . '/checkpwd.php';
    }
    $user = mysqli_real_escape_string($con, $user);
    $res = mysqli_query($con, "select password,user_id,language,defunct,email,privilege from users where user_id='{$user}' or email='{$user}' limit 1");
    $r = mysqli_fetch_row($res);
    if (!$r) {
        return _('There\'s no such user...');
    }
    if ($r[3] != 'N') {
        return _('Your account is still being reviewed...');
    }
    if (!$is_cookie && !password_right($user, $pwd)) {
        return _('Wrong Username/Password...');
    }
    //Clear guest session.
    session_unset();
    if (!function_exists('clear_cookie')) {
        require __DIR__ . '/cookie.php';
    }
    clear_cookie('SID');
    //Create new session.
    $_SESSION['user'] = $r[1];
    $_SESSION['lang'] = $r[2];
    $_SESSION['email'] = $r[4];
    $_SESSION['priv'] = $r[5];
    //Initialize user preference.
    if (!class_exists('preferences')) {
        require __DIR__ . '/preferences.php';
    }
    global $pref;
    $pref = new preferences();
    $res = mysqli_query($con, "select property,value from preferences where user_id='{$user}'");
    while ($r = mysqli_fetch_row($res)) {
        $property = $r[0];
        $pref->{$property} = $r[1];
    }
    $_SESSION['pref'] = serialize($pref);
    require __DIR__ . '/userinfo.php';
    $ip = mysqli_escape_string($con, get_ip());
    mysqli_query($con, "update users set accesstime=NOW(),ip='{$ip}' where user_id='{$user}'");
    return TRUE;
}
コード例 #2
0
ファイル: ajax_logoff.php プロジェクト: CDFLS/CWOJ
<?php

session_start();
session_unset();
session_destroy();
require __DIR__ . '/../func/cookie.php';
clear_cookie('SID');
コード例 #3
0
ファイル: home.php プロジェクト: CalvinZhu/boinc
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/util.inc";
require_once "../inc/user.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/forum.inc";
check_get_args(array());
// show the home page of logged-in user
$user = get_logged_in_user();
BoincForumPrefs::lookup($user);
$user = get_other_projects($user);
$init = isset($_COOKIE['init']);
$via_web = isset($_COOKIE['via_web']);
if ($via_web) {
    clear_cookie('via_web');
}
$cache_control_extra = "no-store,";
if ($init) {
    clear_cookie('init');
    page_head(tra("Welcome to %1", PROJECT));
    echo "<p>" . tra("View and edit your account preferences using the links below.") . "</p>\n";
    if ($via_web) {
        echo "<p> " . tra("If you have not already done so, %1download BOINC client software%2.", "<a href=\"http://boinc.berkeley.edu/download.php\">", "</a>") . "</p>";
    }
} else {
    page_head(tra("Your account"));
}
show_account_private($user);
page_tail();
コード例 #4
0
ファイル: logout.php プロジェクト: dimhotepus/boinc
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
include_once "../inc/db.inc";
include_once "../inc/util.inc";
check_get_args(array("tnow", "ttok"));
$user = get_logged_in_user();
if ($user) {
    check_tokens($user->authenticator);
    clear_cookie('auth');
    $g_logged_in_user = null;
    header("Location: index.php");
    page_head("Logged out");
    echo "You are now logged out";
    page_tail();
} else {
    error_page("not logged in");
}
コード例 #5
0
ファイル: logout.php プロジェクト: nicolas17/boincgit-test
<?php

require_once "../inc/util_ops.inc";
$user = get_logged_in_user_ops();
if ($user) {
    clear_cookie('auth', true);
    admin_page_head("Logged out");
    admin_page_tail();
} else {
    admin_error_page("not logged in");
}