Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

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

class Authorize extends MY_Controller {

public $layoutName ='';
        
        function __construct() {

                // Call the CI_controller constructor
                parent::__construct();
                $admin = $this->session->userdata('admin');
                if(isset($admin) && $admin == 'shop2020'){
                        redirect(base_url());
                }
                $this->layout->setlayout('layout/layout_main');
                //$this->load->model('oauth_model');
                $this->layoutName= $this->layout->getLayout();
                $this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';
                
                

        }
        public function index()
        {
                if(!isset($_POST['submit'])){
                        $this->lessphp->object()->ccompile('assets/css/authorize.less','assets/css/authorize.css');
                        $data['stylesheet'] = 'authorize.css';
                        $this->layout->view(strtolower(__CLASS__).'/login',$data);
                }
                if(isset($_POST['submit'])){
                        $email = $_POST['email'];
                        $password = $_POST['password'];
                        if(in_array($email, $this->config->item('username')) && in_array($password, $this->config->item('password'))){
                                $this->session->set_userdata('admin',$_POST['email']);
                                redirect(base_url());
                        }
                        else{
                                redirect(base_url().'authorize');
                        }
                }
                
        }
        
}

/***** FOR LOGIN AUTHENTICATION *****
*    AUTHORIZE ARRAY + AUTHORIZE[AUTHORITY]=SUCCESS
*        FOR SIGN UP - 
*
*

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */