Webmeng登录模块login

<?php if ( ! defined('BASEPATH')) exit('Webmeng Warning ! No direct script access allowed.');

//class login extends CI_Controller {
class Login extends My_Controller {
 function __construct()
  {
 parent::__construct();
   
   $this->load->helper('comfun');
   $this->load->helper('cookie');
  // $app_id =  $this->session->userdata('app_id');
   $this->uid = get_cookie('uid');
         //echo $app_id;exit();
        // if(!$this->app_id ){
         //    header("Location:".site_url("/cn/login")); 
     //    }

     }


  public function index()

  {
	  $uid = $this->uid;
	    
	    $settings = array(); 
        $sets = $this->db->fetch("select * from ".WEBMENG_CONMENG."settings  ");
        if(!empty($sets)){
               foreach ($sets as $v) {
                   $webmeng[$v['variable']] = $v;
               }
        }
        $data['webmeng'] = $webmeng;   
         //print_r($data);  
		 
		 
        // $app_id =  $this->session->userdata('app_id');
       
       if($uid){
             header("Location:".site_url("cn/account/")); 
        }

         //$data['base'] =base_info();
        // print_r( $data);
         //$this->load->view('cn/login/index',$data);
		 $this->display('cn/login/index.html',$data); 

  }

  public function forgot()

  {
	  
	  $settings = array(); 
        $sets = $this->db->fetch("select * from ".WEBMENG_CONMENG."settings  ");
        if(!empty($sets)){
               foreach ($sets as $v) {
                   $webmeng[$v['variable']] = $v;
               }
        }
        $data['webmeng'] = $webmeng;   
         //print_r($data);  
		 
		 
         $uid =  $this->session->userdata('uid');
         if($uid){
             header("Location:".site_url("cn/Account/")); 
         }

         //$data['base'] =base_info();
        // print_r( $data);
         $this->load->view('cn/login/forgot',$data);

  }
  
  



  public function check()
  {
         $status =false;
         $mobile = $this->input->post('mobile',true);
         $pwd = $this->input->post('pwd',true);
         $user_info = $this->db->fetch("select * from ".WEBMENG_CONMENG."user where mobile='".$mobile."' and status>0  ",true);
         if(!empty($user_info)){
             if($user_info['password']!==md5($pwd)){
                  $msg = '密码不正确';
             }else{
                  if($user_info['status']>0){
                       if($user_info['status']==3){
                           $msg = '账号异常,请联系管理员';

                       }else{
                            $data = array(
                               'login_num' => $user_info['login_num']+1,
                               'lasttime'  => date('Y-m-d H:i:s'),
                               
                               
                            );
                            $this->db->update('user', $data, array('id' => $user_info['id']));
                            //$this->session->set_userdata('app_id', $user_info['id']);
                            set_cookie("uid",$user_info['id'],86400*365);
                            $msg = '登录成功';
                            $status = true;
                       }
                       
                  }else{
                       $msg = '账号不存在';
                  }
             }

         }else{
            $msg = '账号不存在';
         }

         echo json_encode(array('status'=>$status,'msg'=>$msg));exit();

  }
  

  public function out()
  {
     //  $app_id = $this->app_id;
      
     //  $user_info = $this->db->fetch("select * from ".WEBMENG_CONMENG."user where id='".$app_id."' and status>0  ",true); 
       
    //   $data = array(
        //  'lastlogintime' => date('Y-m-d H:i:s'),
         // 'lastloginip'  =>  $_SERVER[REMOTE_ADDR],
     //                       );
   //  $this->db->update('user', $data, array('id' => $app_id,'lastlogintime' => date('Y-m-d H:i:s'),'lastloginip' => $$_SERVER[REMOTE_ADDR]));
   
   
    unset($_SESSION['uid']);
    delete_cookie("uid");
          
	  returnpage('退出成功',3, site_url('/'));
  }

 
   
}

餐厅介绍

自助餐厅

4.7分
537m | 中航城区冷死你境内呢名
停车 WiFi
  • 热情1
  • 环境好11
  • 服务好12
  • 好极了31
  • 服务热情14

暂时没有看法.. 发表看法请遵守当地法律和制度 (网友评论仅供其表达个人看法,并不表明本站立场。)