zoukankan      html  css  js  c++  java
  • Thinkphp3.2 cms之登陆模块

    <?php
    /**
     * Created by dreamcms.
     * User: Administrator
     * Date: 2016/9/5
     * Time: 17:15
     */
    
    namespace AdminController;
    use ThinkController;
    
    class LoginController extends  CommonController{
    
        //视图显示
        public function Login(){
            $this->display();
        }
    
        /**
         * 登录验证
         */
        public  function Check_Login(){
            //验证码检测
           $names=$_POST['Captcha'];
            if($this->check_verify($names)==false){
                $data['error']=1;
                $data['msg']="验证码错误";
                $this->ajaxReturn($data);
            }
            //用户检测
            $uname=I('post.username');
            $upasswd=I('post.password');
            $map['uname']=$uname;
            $map['state']=1;
            $logins=M('login')->where($map)->find();
            if($logins)
            {
                if($logins['upasswd']!=$upasswd)
                {
                    $data['error']=1;
                    $data['msg']="密码错误";
                    $this->ajaxReturn($data);
                }
                session("admin",$logins);
    
                var_dump($logins);
               redirect(U('Index/index'));
            }
    
    
    
        }
    
        /**
         * 验证码生成
         */
        public  function Verifys()
        {
            $config=array(
                'fontSzie'=>30, //验证码字体大小
                'length'=>4,//验证码位数
                'useImgBg'=>true
    
            );
    
            $verify=new ThinkVerify($config);
            $verify->useZh=true;
    
            $verify->zhSet="梦起软件工作室";
            $verify->fontttf='simhei.ttf';
            $verify->entry();
    
        }
    
        /**
         * 验证码检测
         */
        public  function check_verify($code,$id="")
        {
            $verify=new ThinkVerify();
            return $verify->check($code,$id);
        }
        /**
         * 退出登录
         */
        public  function out_login(){
            session("admin",null);
            redirect(U('Login/login'));
        }
    }
  • 相关阅读:
    【AtCoder】ARC097 (C
    【51nod】1123 X^A Mod B (任意模数的K次剩余)
    【洛谷】P4207 [NOI2005]月下柠檬树
    【POJ】2454.Jersey Politics
    【POJ】2069.Super Star
    【POJ】2420.A Star not a Tree?(模拟退火)
    【POJ】1026.Cipher
    【POJ】3270.Cow Sorting
    【POJ】1286.Necklace of Beads
    【POJ】1067.取石子游戏
  • 原文地址:https://www.cnblogs.com/mengluo/p/8858519.html
Copyright © 2011-2022 走看看