public function login()
 {
     $data = Input::all();
     $data['password'] = md5($data['password']);
     $user = User::checklogin($data)->get();
     if (sizeof($user) > 0) {
         $rule = User::getHakAkses($user[0]['USERS_ID'])->get();
         session(['hak' => 'admin', 'name' => $user[0]['USERS_NAME'], 'id' => $user[0]['USERS_ID']]);
         return redirect::to('usermanagement');
     } else {
         Session::flash('error', "Password dan Username yang anda masukkan salah");
         return redirect::back();
     }
 }
Example #2
0
<?php

$base = "../../";
require_once $base . "users.php";
$returndata = array();
//uname, password
if (!isset($_POST['uname']) || !isset($_POST['password'])) {
    add_return_data(0, 2, "Both Username and Password need to be posted.");
} else {
    $uname = $_POST['uname'];
    $password = $_POST['password'];
    $user = new User($uname);
    if (!$user->checklogin($uname, $password)) {
        //Username password incorrect send that json.
        add_return_data(0, 3, "Incorrect username or password");
    } else {
        //Username and password is correct send json to say username password correct and send cookies
        $userdata = $user->get_user_data();
        $returndata["user"] = $userdata;
        $cookies = array("uid" => $user->get_userid(), "hash" => getCookies($user->get_userid()));
        $returndata["cookies"] = $cookies;
        add_return_data(1, 1, "Logged In!");
    }
}
Example #3
0
            WordFilter($username) && javascript::json('username', 'filter:username');
            iCMS_DB::getValue("SELECT uid FROM `#iCMS@__members` where `username`='{$username}'") && javascript::json('username', 'register:usernameusr');
            $password = md5(trim($_POST['password']));
            $pwdrepeat = md5(trim($_POST['pwdrepeat']));
            $password != $pwdrepeat && javascript::json('pwdrepeat', 'register:different');
            $gender = intval($_POST['gender']);
            $nickname = dhtmlspecialchars($_POST['nickname']);
            cstrlen($nickname) > 12 && javascript::json(0, 'register:nicknamelong');
            $info = array();
            $_POST['icq'] && ($info['icq'] = intval($_POST['icq']));
            $_POST['home'] && ($info['home'] = dhtmlspecialchars(stripslashes($_POST['home'])));
            $_POST['year'] && ($info['year'] = intval($_POST['year']));
            $_POST['month'] && ($info['month'] = intval($_POST['month']));
            $_POST['day'] && ($info['day'] = intval($_POST['day']));
            $_POST['from'] && ($info['from'] = dhtmlspecialchars(stripslashes($_POST['from'])));
            $_POST['signature'] && ($info['signature'] = dhtmlspecialchars(stripslashes($_POST['signature'])));
            $info && ($info = addslashes(serialize($info)));
            iCMS_DB::query("INSERT INTO `#iCMS@__members` (`groupid`,`username`,`password`,`email`,`nickname`,`gender`,`info`,`power`,`cpower`,`lastip`,`lastlogintime`,`logintimes`,`post`) VALUES ('4','{$username}','{$password}', '{$email}','{$nickname}','{$gender}','{$info}','','','" . getip() . "', '" . time() . "','0','0') ");
            //设置为登陆状态
            set_cookie('user', authcode($username . '#=iCMS!=#' . $password, 'ENCODE'));
            set_cookie('username', empty($nickname) ? $username : $nickname);
            javascript::json(1, 'register:finish');
        } elseif ($action == "login") {
            require_once iPATH . "usercp/user.class.php";
            if (User::checklogin($_POST['username'], md5($_POST['password']), true)) {
                javascript::json(1, 'login:success');
            } else {
                javascript::json(0, 'login:failed');
            }
        }
}
Example #4
0
<?php

/**
 * @package iCMS V3.1
 * @copyright 2007-2009, iDreamSoft
 * @license http://www.idreamsoft.cn iDreamSoft
 * @author coolmoo <*****@*****.**>
 */
header('Content-Type: text/html; charset=utf-8');
require_once dirname(__FILE__) . '/../global.php';
require_once iPATH . "admin/function.php";
require_once iPATH . "usercp/function.php";
require_once iPATH . "usercp/user.class.php";
require_once iPATH . 'usercp/usercp.lang.php';
$iCMS->rewrite = false;
unset($_keywords);
$do = $_GET['do'];
$operation = !empty($_GET['operation']) && is_string($_GET['operation']) ? trim($_GET['operation']) : '';
$action = $_POST['action'];
$member = new User();
$_GET['do'] == 'logout' && $member->logout(__SELF__);
if ($action == "login") {
    ckseccode($_POST['seccode']) && alert('验证码错误!');
    $username = $_POST['username'];
    $password = md5($_POST['password']);
}
$member->checklogin($username, $password);
//var_dump($member);
//$Admin->MP("USERCP","USERCP_Permission_Denied");
//$menu_array	= include iPATH.'admin/menu.array.php';