<?php



namespace app\controller;



use think\Controller;



use think\Db; 



 



 



class Login extends Controller



{



   public function out(){
   
     session('admin',NULL);
     $this->success('退出登录！','/index.php/admin');
   }

	

	

	public function index(){

	

	

   if(input('action')=='save'){

   

   $admin=input('admin');

   $pass=input('password');

   

  $rs=db('config')->where("admin_user='".trim($admin)."' and admin_pass='".md5(trim($pass))."'")->find();

  

  if($rs){

  session('admin',$rs);

  $this->success('登录成功！','/index.php/admin');

  }else{

  $this->error('帐号或密码错误！','/index.php/admin/login');

  }

   

 

   }

	

	

	

	

return view('login');

	

	

	

	

	

	}

	

	

	

	

	



}



