Example #1
0
File: login.php Project: kuell/chat
require_once '../libs/common.php';
require_once '../libs/operator.php';
if (check_login(false)) {
    header("Location: {$mibewroot}/operator/");
    exit;
}
$errors = array();
$page = array('formisRemember' => true, 'version' => $version);
if (isset($_POST['login']) && isset($_POST['password'])) {
    $login = getparam('login');
    $password = getparam('password');
    $remember = isset($_POST['isRemember']) && $_POST['isRemember'] == "on";
    $operator = operator_by_login($login);
    if ($operator && isset($operator['vcpassword']) && check_password_hash($login, $password, $operator['vcpassword'])) {
        $target = $password == '' ? "{$mibewroot}/operator/operator.php?op=" . intval($operator['operatorid']) : (isset($_SESSION['backpath']) ? $_SESSION['backpath'] : "{$mibewroot}/operator/index.php");
        login_operator($operator, $remember, is_secure_request());
        header("Location: {$target}");
        exit;
    } else {
        $errors[] = getlocal("page_login.error");
        $page['formlogin'] = $login;
    }
} else {
    if (isset($_GET['login'])) {
        $login = getgetparam('login');
        if (preg_match("/^(\\w{1,15})\$/", $login)) {
            $page['formlogin'] = $login;
        }
    }
}
$page['localeLinks'] = get_locale_links("{$mibewroot}/operator/login.php");
Example #2
0
 * the provisions of the GPL are applicable instead of those above. If you wish
 * to allow use of your version of this file only under the terms of the GPL, and
 * not to allow others to use your version of this file under the terms of the
 * EPL, indicate your decision by deleting the provisions above and replace them
 * with the notice and other provisions required by the GPL.
 * 
 * Contributors:
 *    Evgeny Gryaznov - initial API and implementation
 */
require_once '../libs/common.php';
require_once '../libs/operator.php';
$errors = array();
$page = array('formisRemember' => true, 'version' => $version);
if (isset($_POST['login']) && isset($_POST['password'])) {
    $login = getparam('login');
    $password = getparam('password');
    $remember = isset($_POST['isRemember']) && $_POST['isRemember'] == "on";
    $operator = operator_by_login($login);
    if ($operator && isset($operator['vcpassword']) && $operator['vcpassword'] == md5($password)) {
        $target = isset($_SESSION['backpath']) ? $_SESSION['backpath'] : "{$webimroot}/operator/index.php";
        login_operator($operator, $remember);
        header("Location: {$target}");
        exit;
    } else {
        $errors[] = getlocal("page_login.error");
        $page['formlogin'] = $login;
    }
}
$page['localeLinks'] = get_locale_links("{$webimroot}/operator/login.php");
start_html_output();
require '../view/login.php';