• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_client_ip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_client_ip函数的典型用法代码示例。如果您正苦于以下问题:PHP get_client_ip函数的具体用法?PHP get_client_ip怎么用?PHP get_client_ip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_client_ip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addUser

 public function addUser()
 {
     $username = I('post.username', 0);
     $password = I('post.password', 0);
     ($username === 0 || $password === 0) && $this->error("大哥别瞎搞!");
     $username = checkUsername($username);
     if (!$username) {
         $this->ajaxReturn("大哥别瞎注册!");
         exit;
     }
     $user = M('user');
     $queryResult = $user->where("username = '%s'", $username)->find();
     if ($queryResult) {
         $this->ajaxReturn("user_exist");
         exit;
     }
     $data = array('id' => "", 'username' => $username, 'password' => pwEncrypt($username, $password), 'lasttime' => time(), 'lastip' => get_client_ip());
     $result = $user->add($data);
     if ($result) {
         $this->ajaxReturn("ok");
         exit;
     } else {
         $this->ajaxReturn("注册失败!");
         exit;
     }
 }
开发者ID:Lingdu0,项目名称:thinkphp_blog,代码行数:26,代码来源:LoginController.class.php


示例2: index

 public function index()
 {
     $sysinfo = M('sys')->order('id asc')->find();
     $this->assign('sys', $sysinfo);
     $appid = $sysinfo['web_appid'];
     $appsecret = $sysinfo['web_appsecret'];
     if (!defined('VIRIFY')) {
         virifylocal();
     }
     $_scene = M('scene');
     $where['scenecode_varchar'] = I('get.id', 0);
     $where['delete_int'] = 0;
     $_scene_list = $_scene->where($where)->select();
     // print_r($_scene_list); exit('dddd');
     $sysinfo = M('sys')->order('id asc')->find();
     if ($sysinfo['is_user_anli_shenghe'] && !isset($_GET['preview'])) {
         if ($_scene_list[0]["shenhe"] != 1) {
             $this->error('抱歉,您的场景还没通过管理员审核', '/#/main');
         }
     }
     $argu2 = array();
     $argu2['title'] = $_scene_list[0]["scenename_varchar"];
     $argu2['url'] = C('IS_OPEN_STATIC') ? 'v-' . $_scene_list[0]["scenecode_varchar"] : 'index.php?c=view&id=' . $_scene_list[0]["scenecode_varchar"];
     $argu2['desc'] = $_scene_list[0]["desc_varchar"];
     $argu2['imgsrc'] = $_scene_list[0]["thumbnail_varchar"];
     $this->assign("confinfo2", $argu2);
     $mydd = get_client_ip();
     if ($mydd !== '127.0.0.1') {
         $confinfo = $this->get_js_sdk($appid, $appsecret);
     }
     $this->assign("confinfo", $confinfo);
     $this->display(HTML_VESION);
 }
开发者ID:sdgdsffdsfff,项目名称:html5Editor,代码行数:33,代码来源:ViewController.class.php


示例3: login

 public function login()
 {
     #是否显示验证码
     $msg = '';
     if (IS_POST) {
         $name = I('name');
         $password = I('password');
         if (!empty($name) && !empty($password)) {
             #验证用户信息
             $user_info = D('Common/Admin')->loginCheck($name, $password);
             #记录登录日志
             $log_data = array('admin_id' => isset($user_info['id']) ? $user_info['id'] : 0, 'login_time' => date('Y-m-d H:i:s'), 'login_ip' => get_client_ip());
             $log_result = D('Common/Adminlog')->log_add($log_data);
             #跳转
             if (isset($user_info['id'])) {
                 session('user', $user_info['id']);
                 redirect(U('admin/Index/index'));
             } else {
                 $this->error('登录失败,用户名或密码错误。');
             }
         } else {
             $this->error('登录失败,用户名或密码错误。');
         }
     }
     $this->display();
 }
开发者ID:cassileShu,项目名称:ebxzj,代码行数:26,代码来源:IndexController.class.php


示例4: login

 /**
  * 后台登陆控制器
  */
 public function login()
 {
     $arr = array('user_login' => I('user_login'), 'user_pass' => encrypt(I('user_pass'), C('ENCRYPTION_KEY')), 'remember-me' => I('remember-me'));
     //处理下次自动登录
     if ($arr['remember-me'] == 1) {
         $account = $arr['user_login'];
         $ip = get_client_ip(0, true);
         $value = $account . '|' . $ip;
         $value = encrypt($value, C('ENCRYPTION_KEY'));
         @setcookie('remember-me', $value, time() + 7 * 24 * 3600, "/");
     }
     $user = M('user')->where(array('user_login' => $arr['user_login']))->find();
     $userinfo = D('user')->getInfo($user['id']);
     if ($user['user_status'] == 0) {
         $this->error('账号被禁用,请联系管理员...');
     }
     if ($user['user_type'] != '管理员') {
         $this->error('无权限登录...');
     }
     if (!$user || $user['user_pass'] != $arr['user_pass']) {
         $this->error('账号密码错误,请重试...');
     }
     $data = array('id' => $user['id'], 'last_login_ip' => get_client_ip(0, true), 'last_login_time' => date("Y-m-d H:i:s"));
     $result = M('user')->save($data);
     if (!$result) {
         $this->error('登录失败,请重试...');
     }
     session('uid', $user['id']);
     session('username', $userinfo['username']);
     session('last_login_time', $data['last_login_time']);
     session('last_login_ip', $data['last_login_ip']);
     $this->success('登陆成功', U('Index/index'));
 }
开发者ID:lizhi0610,项目名称:hgnu,代码行数:36,代码来源:LoginController.class.php


示例5: index

 public function index()
 {
     if (IS_POST) {
         $User = M("User");
         $username = I('post.username');
         $password = I('post.password');
         $where['username'] = $username;
         $result = $User->where($where)->find();
         if ($result != NULL && $result != false) {
             if (md5($result['salt'] . $password) == $result['password']) {
                 $data['lastlogin'] = date('Y-m-d H:i:s');
                 $data['ip'] = get_client_ip();
                 $User->where($result)->data($data)->save();
                 $result['msg'] = 'succeed';
                 $this->ajaxReturn($result);
             } else {
                 $error['msg'] = 'password error';
                 $this->ajaxReturn($error);
             }
         } else {
             $error['msg'] = 'username error';
             $this->ajaxReturn($error);
         }
     }
 }
开发者ID:Rlilyyyy,项目名称:nansnan,代码行数:25,代码来源:WebapiController.class.php


示例6: publish

 public function publish($content, $uid, $reid = 0)
 {
     if (mb_strlen($content) > 255) {
         $data = array('content' => mb_substr($content, 0, 255, 'utf8'), 'content_over' => mb_substr($content, 255, 25, 'utf8'));
     } else {
         $data = array('content' => $content);
     }
     $data['ip'] = get_client_ip(1);
     $data['uid'] = $uid;
     if ($reid > 0) {
         $data['reid'] = $reid;
     }
     if ($this->create($data)) {
         $tid = $this->add();
         if ($tid) {
             if ($reid > 0) {
                 $this->setRecount($reid);
             }
             return $tid;
         } else {
             return 0;
         }
     } else {
         return $this->getError();
     }
 }
开发者ID:xqx930807,项目名称:weibo,代码行数:26,代码来源:TopicModel.class.php


示例7: login

 public function login()
 {
     if (!IS_POST) {
         E('无效的页面');
     }
     $Verify = new \Think\Verify();
     //if(!$Verify->check($code)) $this->error('验证码错误');
     $db = M('login');
     $user = $db->where(array('username' => I('username')))->find();
     if (!$user || $user['password'] != I('password', '', md5)) {
         $this->error('账号或密码错误');
     }
     //更新最后一次登录时间及IP
     $data = array('id' => $user['id'], 'logintime' => time(), 'loginip' => get_client_ip());
     $db->save($data);
     session('uid', $user['id']);
     session('username', $user['username']);
     session('name', $user['name']);
     session('logintime', date('Y-m-d H:i:s', $user['logintime']));
     session('loginip', $user['loginip']);
     if ($user['jd'] == '1') {
         session('admin', '1');
     } else {
         session('admin', '0');
     }
     if (I('username') == 'admin') {
         session('iadmin', 1);
     } else {
         session('iadmin', 0);
     }
     $this->redirect('/Home/Index/index');
 }
开发者ID:omusico,项目名称:SmallCrm,代码行数:32,代码来源:LoginController.class.php


示例8: login

 public function login()
 {
     if (!IS_POST) {
         halt('页面不存在3');
     }
     // 		if(I('code','','md5')!=session('verify')){
     // 			$this->error('验证码错误');
     // 		}
     $username = I('username');
     $pwd = I('password', '', 'md5');
     $user = M('user')->where(array('username' => $username))->find();
     if (!$user || $user['password'] != $pwd) {
         $this->error('账号或密码错误!');
     }
     if ($user['lock']) {
         $this->error('用户被锁了');
     }
     $data = array('id' => $user['id'], 'logintime' => time(), 'loginip' => get_client_ip());
     M('user')->save($data);
     session('uid', $user['id']);
     session('username', $user['username']);
     session('logintime', date('Y-m-d H:i:s', $user['logintime']));
     session('loginip', $user['loginip']);
     $this->redirect('Admin/Index/index');
 }
开发者ID:highestgoodlikewater,项目名称:Thinkphp-Wishing-Wall,代码行数:25,代码来源:LoginAction.class.php


示例9: grade_login

 public function grade_login()
 {
     if (!check_verify(I('code', ''))) {
         $this->error('验证码错误');
     }
     $username = I('username');
     $user = M('user')->where(array('username' => $username))->find();
     $pwd = I('password', '', 'md5');
     if (!$user | $user['password'] != $pwd) {
         $this->error('用户名或密码错误');
     }
     if ($user['lock']) {
         $this->error('用户被锁定,请联系管理员解锁');
     }
     $data = array('id' => $user['id'], 'logintime' => time(), 'loginip' => get_client_ip());
     M('user')->save($data);
     session(C('USER_AUTH_KEY'), $user['id']);
     session('username', $user['username']);
     session('lastlogintime', date('Y-m-d H:i', $user['logintime']));
     session('lastloginip', $user['loginip']);
     if ($user['username'] == C('RBAC_SUPERADMIN')) {
         session(C('ADMIN_AUTH_KEY'), true);
     }
     import('Org.Util.Rbac');
     Rbac::saveAccessList();
     //        dump($_SESSION);die;
     $this->redirect('Grade/Grade/grade_index');
 }
开发者ID:RqHe,项目名称:aunet1,代码行数:28,代码来源:IndexController.class.php


示例10: login

 public function login()
 {
     if (!IS_POST) {
         $this->error('页面不存在');
     }
     //p($_POST);
     if (!isset($_POST['submit'])) {
         return false;
     }
     //安全一点再判断一下
     //验证码对比
     $code = I('verify');
     //if(!check_verify($code))$this->error('验证码错误');//测试系统,忽略认证
     $name = I('uname');
     $pwd = md5(I('pwd'));
     $db = M('admin');
     $user = $db->where(array('username' => $name))->find();
     if (!$user || $user['password'] != $pwd) {
         $this->error('账号或密码错误');
     }
     if ($user['lock']) {
         $this->error('账号被锁定');
     }
     $data = array('id' => $user['id'], 'logintime' => time(), 'loginip' => get_client_ip());
     $db->save($data);
     session('uid', $user['id']);
     session('username', $user['username']);
     session('logintime', date('Y-m-d H:i', $user['logintime']));
     session('now', date('Y-m-d H:i', time()));
     session('loginip', $user['loginip']);
     session('admin', $user['admin']);
     $this->success('正在登陆...', __APP__);
 }
开发者ID:omusico,项目名称:Thinkphp3.2.3-weibo,代码行数:33,代码来源:LoginController.class.php


示例11: index

 public function index()
 {
     if (IS_POST) {
         $ip = get_client_ip();
         $time = time();
         $map['ip'] = array('eq', $ip);
         //留言间隔
         $Set = D('Set')->find();
         $model = D('Message');
         $Message = $model->where($map)->order('id desc')->find();
         if ($time - $Message['create_time'] < $Set['messageinterval']) {
             $this->error('每条留言需间隔' . $Set['messageinterval'] / 60 . '分钟!');
         }
         if ($vo = $model->create()) {
             //保存当前数据对象
             //  $list = $model->add();
             // if ($list !== false){
             if ($model->add()) {
                 //	 $this->ajaxReturn(0,"留言成功!",1);
                 $this->success('留言成功!');
             } else {
                 //失败提示
                 //  $this->ajaxReturn('添加失败',0);
                 $this->error('提交失败!');
             }
         } else {
             $this->error($model->getError());
         }
     } else {
         $this->display();
     }
 }
开发者ID:zhezhisama,项目名称:zz,代码行数:32,代码来源:MessageAction.class.php


示例12: _initialize

 /**
  * 后台控制器初始化
  */
 protected function _initialize()
 {
     // 获取当前用户ID
     if (defined('UID')) {
         return;
     }
     define('UID', is_login());
     if (!UID) {
         // 还没登录 跳转到登录页面
         $this->redirect('Public/login');
     }
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = D('Config')->lists();
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     // 是否是超级管理员
     define('IS_ROOT', is_administrator());
     if (!IS_ROOT && C('ADMIN_ALLOW_IP')) {
         // 检查IP地址访问
         if (!in_array(get_client_ip(), explode(',', C('ADMIN_ALLOW_IP')))) {
             $this->error('403:禁止访问');
         }
     }
 }
开发者ID:xingluxin,项目名称:jianshen,代码行数:31,代码来源:AdminController.class.php


示例13: init_follow

 function init_follow($openid, $token = '', $has_subscribe = false)
 {
     empty($token) && ($token = get_token());
     addWeixinLog($openid . '::_' . $token, 'init_follow_in');
     if (empty($openid) || $openid == -1 || empty($token) || $token == -1) {
         return false;
     }
     $data['token'] = $token;
     $data['openid'] = $openid;
     $datas = $data;
     $uid = M('public_follow')->where($data)->getField('uid');
     addWeixinLog($uid, 'init_follow_check_uid');
     if ($uid) {
         return $uid;
     }
     // 自动注册
     $config = getAddonConfig('UserCenter', $token);
     $user = array('experience' => intval($config['experience']), 'score' => intval($config['score']), 'reg_ip' => get_client_ip(1), 'reg_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1), 'last_login_time' => NOW_TIME, 'status' => 1, 'is_init' => 1, 'is_audit' => 1, 'come_from' => 1);
     $user2 = getWeixinUserInfo($openid);
     $user = array_merge($user, $user2);
     $data['uid'] = $uid = D('Common/User')->add($user);
     if ($has_subscribe !== false) {
         $data['has_subscribe'] = $has_subscribe;
     }
     M('public_follow')->add($data);
     return $uid;
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:27,代码来源:FollowModel.class.php


示例14: save

 static function save($type = '', $destination = '', $extra = '')
 {
     if (empty(self::$log)) {
         return;
     }
     $type = $type ? $type : C('LOG_TYPE');
     if (self::FILE == $type) {
         // 文件方式记录日志信息
         if (empty($destination)) {
             $destination = C('LOG_PATH') . date('y_m_d') . '.log';
         }
         //检测日志文件大小,超过配置大小则备份日志文件重新生成
         if (is_file($destination) && floor(C('LOG_FILE_SIZE')) <= filesize($destination)) {
             rename($destination, dirname($destination) . '/' . time() . '-' . basename($destination));
         }
     } else {
         $destination = $destination ? $destination : C('LOG_DEST');
         $extra = $extra ? $extra : C('LOG_EXTRA');
     }
     $now = date(self::$format);
     error_log($now . ' ' . get_client_ip() . ' ' . $_SERVER['REQUEST_URI'] . "\r\n" . implode('', self::$log) . "\r\n", $type, $destination, $extra);
     // 保存后清空日志缓存
     self::$log = array();
     //clearstatcache();
 }
开发者ID:kumfo,项目名称:YYphp,代码行数:25,代码来源:Log.class.php


示例15: signin

 /**
  * 帐号注册
  */
 function signin()
 {
     if (IS_POST) {
         $post = I('post.');
         if ($post['email'] == '') {
             $this->error('邮件地址不能为空!');
         }
         if ($post['verification_code'] != $_SESSION['verification_code']) {
             $this->error('你输入的验证码不正确!');
         }
         $this->_check_email($post['email']);
         $data['email'] = $post['email'];
         $data['register_time'] = NOW_TIME;
         $data['register_ip'] = get_client_ip(1);
         if ($this->user->add($data) !== false) {
             $link = PDM_URL . '?c=account&a=authentication&sign=' . pdm_code($post['email']);
             $tpl = file_get_contents(PDM_INC_PATH . 'ThirdParty/PHPMailer/templates/register_success.htm');
             $tpl = str_replace('#EMAIL#', $data['email'], $tpl);
             $tpl = str_replace('#SYSTEM_NAME#', PDM_NAME, $tpl);
             $tpl = str_replace('#DATE#', date('Y年m月d日'), $tpl);
             $tpl = str_replace('#LINK#', $link, $tpl);
             pdm_sendmail($data['email'], '密码管理系统注册确认', $tpl);
             $this->success('帐号注册成功,请到你的邮件中确认激活!', '', 5);
         } else {
             $this->error('帐号注册失败!');
         }
     } else {
         $this->display();
     }
 }
开发者ID:wsunxa,项目名称:pdm,代码行数:33,代码来源:AccountAction.class.php


示例16: praise

 public function praise()
 {
     $arr = array('s' => 0, 'error' => '');
     $ip = get_client_ip();
     $praise_model = M('praise');
     $goods_model = M('goods');
     //if(IS_AJAX){
     $gid = I('gid');
     $type = I('type');
     $data = array('uid' => is_login(), 'gid' => $gid, 'type' => $type, 'ip' => $ip);
     if ($praise_model->add($data)) {
         if ($type == 1) {
             $goods_model->where('gid=' . $gid)->setInc('praise', 1);
             cookie('like' . $gid, $gid, 24 * 60 * 60 * 5);
         } else {
             $goods_model->where('gid=' . $gid)->setInc('dislike', 1);
             cookie('dislike' . $gid, $gid, 24 * 60 * 60 * 5);
         }
         $this->ajaxReturn($arr);
     } else {
         $arr['s'] = 1;
         $arr['error'] = 'Sorry 数据错误';
         $this->ajaxReturn($arr);
     }
     //}else{
     //$this->error('非法访问!');
     //}
 }
开发者ID:hehuping,项目名称:qqyiyazhe,代码行数:28,代码来源:IndexController.class.php


示例17: verify

 public function verify($login_info)
 {
     $password = $login_info['password'];
     $AdminUser = M('admin_user');
     $field = "id,account,password,name,login_count,lock_time,error_count,role_id";
     $account_info = $AdminUser->field($field)->where("status=1 and (account='{$login_info['account']}')")->find();
     if (empty($account_info)) {
         return false;
     }
     $account = $account_info['account'];
     if (empty($account_info['role_id'])) {
         return array('status' => 0, 'info' => '账户未分配角色,请联系管理员');
     } elseif ($account_info['lock_time'] - time() > 0) {
         return array('status' => 0, 'info' => '账户被锁');
     } elseif (isset($password) && md5($password) !== $account_info['password']) {
         if (($error_count = 5 - $account_info['error_count'] % 6) > 0) {
             $AdminUser->where("id={$account_info['id']}")->setInc('error_count');
             return array('status' => 0, 'info' => '密码错误,剩余次数' . $error_count);
         } else {
             $AdminUser->where("id={$account_info['id']}")->save(array('lock_time' => time() + 1800));
             return array('status' => 0, 'info' => '账户锁定');
         }
     }
     //登陆成功
     $data_update = array('login_count' => $account_info['login_count'] + 1, 'last_login_time' => time(), 'last_login_ip' => get_client_ip(), 'error_count' => 0);
     $AdminUser->where("id={$account_info['id']}")->save($data_update);
     return $account_info;
 }
开发者ID:canwonson,项目名称:web,代码行数:28,代码来源:LoginController.class.php


示例18: index

 public function index()
 {
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
         //短信未开启
         output($root);
     }
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     $root['user_id'] = $user_id;
     if ($user_id > 0) {
         $mobile = $user['mobile'];
         $code = intval($user['bind_verify']);
         if ($mobile == '') {
             $root['response_code'] = 0;
             $root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
             output($root);
         }
         if (!check_mobile($mobile)) {
             $root['response_code'] = 0;
             $root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
             output($root);
         }
         if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
             $root['response_code'] = 0;
             $root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
             //短信发送太快
             output($root);
         }
         //开始生成手机验证
         if ($code == 0) {
             //已经生成过了,则使用旧的验证码;反之生成一个新的
             $code = rand(1111, 9999);
             $GLOBALS['db']->query("update " . DB_PREFIX . "user set bind_verify = '" . $code . "',verify_create_time = '" . TIME_UTC . "' where id = " . $user_id);
         }
         //使用立即发送方式
         $result = send_verify_sms($mobile, $code, $user, true);
         //
         $root['response_code'] = $result['status'];
         if ($root['response_code'] == 1) {
             $root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
         } else {
             $root['show_err'] = $result['msg'];
             if ($root['show_err'] == null || $root['show_err'] == '') {
                 $root['show_err'] = "验证码发送失败";
             }
         }
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
开发者ID:norain2050,项目名称:fanwei_xindai_3.2,代码行数:60,代码来源:send_reset_pay_code.action.php


示例19: login

 /**
  * ------------------------------
  * what to do
  * ------------------------------
  * @param  unkonw_type
  * @return unknow_type
  */
 function login($userName, $userPass, $authCode)
 {
     if (!isset($userName)) {
         $userName = $_POST['userName'];
     }
     if (!isset($userPass)) {
         $userPass = $_POST['userPass'];
     }
     if (!isset($authCode)) {
         $authCode = $_POST['authCode'];
     }
     $userInfo = self::chk_user($userName, $userPass, $authCode);
     $_SESSION['userID'] = $userInfo['user_id'];
     $_SESSION['nickName'] = $userInfo['nick_name'];
     $_SESSION['userType'] = $userInfo['user_type'];
     $loginTime = time();
     if (!function_exists('get_client_ip')) {
         include_once '../common/function.php';
     }
     $loginIP = get_client_ip();
     global $db;
     $arr = array('login_time' => $loginTime, 'login_ip' => $loginIP);
     $db->row_insert('users', $arr, "user_id={$userInfo['user_id']}");
     return $userInfo;
 }
开发者ID:BGCX261,项目名称:zhwphp-svn-to-git,代码行数:32,代码来源:User.class.php


示例20: login

 public function login()
 {
     if (IS_POST) {
         $username = $this->_post('username', 'trim');
         $password = $this->_post('password', 'trim');
         if (!$username || !$password) {
             $this->error(L('input_empty'));
         }
         $verify_code = $this->_post('verify_code', 'trim');
         if (session('verify') != md5($verify_code)) {
             $this->error(L('verify_code_error'));
         }
         $admin = M('admin')->where(array('username' => $username, 'status' => 1))->find();
         if (!$admin) {
             $this->error(L('admin_not_exist'));
         }
         if ($admin['password'] != md5($password)) {
             $this->error(L('password_error'));
         }
         $admin_role = M('admin_role')->where(array('id' => $admin['role_id']))->find();
         session('admin', array('id' => $admin['id'], 'role_id' => $admin['role_id'], 'role_name' => $admin_role['name'], 'username' => $admin['username']));
         M('admin')->where(array('id' => $admin['id']))->save(array('last_time' => time(), 'last_ip' => get_client_ip()));
         $this->success(L('login_success'), U('index/index'));
     } else {
         $this->display();
     }
 }
开发者ID:leamiko,项目名称:58bitao,代码行数:27,代码来源:indexAction.class.php



注:本文中的get_client_ip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_club_id函数代码示例发布时间:2022-05-15
下一篇:
PHP get_clean_basedomain函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap