public function login() { $account_id = I('em'); $passwd = I('pw'); // 账号表 $account_model = D('Account'); if ($account_model->judge_account_login($account_id, $passwd)) { // login success $user_info['id'] = $account_id; $user_info['id'] = $account_id; session('user_info', $user_info); $test = Response::show('200', '登陆成功!'); } else { Response::show('-100', '登陆失败!'); } }
public function login() { $account_id = I('em'); $passwd = I('pw'); // 账号表 $account_model = D('Account'); $data = $account_model->judge_account_login($account_id, $passwd); if ($data) { // login success $user_info['account_name'] = $data['account_name']; $user_info['account_id'] = $data['account_id']; $user_info['id'] = $data['id']; $user_info['wealth_value'] = $data['wealth_value']; $user_info['notice_num'] = $data['notice_num']; session('user_info', $user_info); cookie('user_info', $user_info); $test = Response::show('200', '登陆成功!'); } else { Response::show('-100', '登陆失败!'); } }
public function j_register() { if (!isset($_POST['mem']) && !isset($_POST['myh']) && !isset($_POST['myz']) && !isset($_POST['mp1']) && !isset($_POST['mp2'])) { Response::show('-100', '注册信息丢失!'); } // 验证码 $checkcode = strtolower($_POST['myz']); // 用户的邮箱 $email = $_POST['mem']; $Memcached = Memcached::getInstance(); // 暂时不加密了。 if ($Memcached->get($email) == $checkcode) { // 验证码正确 // 注册用户信息封装 $account_info = null; $account_info['account_id'] = $_POST['mem']; $account_info['account_name'] = $_POST['myh']; $account_info['password'] = xw_md5($_POST['mp1']); $model = M(); $model->startTrans(); $account_model = D('Account'); if ($account_model->find($account_info['account_id'])) { Response::show('-100', '用户已经存在!'); } if ($account_model->add_account($account_info)) { $model->commit(); Response::show('200', '注册成功!'); } else { $model->rollback(); Response::show('-100', '注册失败!'); } } else { Response::show('-100', '验证码不正确!'); } }