Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12694 anikendra 1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
 
3
class Authorize extends MY_Controller {
4
 
5
public $layoutName ='';
6
 
7
	function __construct() {
8
 
9
		// Call the CI_controller constructor
10
		parent::__construct();
11
		$admin = $this->session->userdata('admin');
12
		if(isset($admin) && $admin == 'shop2020'){
13
			redirect(base_url());
14
		}
15
		$this->layout->setlayout('layout/layout_main');
16
		//$this->load->model('oauth_model');
17
		$this->layoutName= $this->layout->getLayout();
18
		$this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';
19
 
20
 
21
 
22
	}
23
	public function index()
24
	{
25
		if(!isset($_POST['submit'])){
26
			$this->lessphp->object()->ccompile('assets/css/authorize.less','assets/css/authorize.css');
27
			$data['stylesheet'] = 'authorize.css';
28
			$this->layout->view(strtolower(__CLASS__).'/login',$data);
29
		}
30
		if(isset($_POST['submit'])){
31
			$email = $_POST['email'];
32
			$password = $_POST['password'];
33
			if(in_array($email, $this->config->item('username')) && in_array($password, $this->config->item('password'))){
34
				$this->session->set_userdata('admin',$_POST['email']);
35
				redirect(base_url());
36
			}
37
			else{
38
				redirect(base_url().'authorize');
39
			}
40
		}
41
 
42
	}
43
 
44
}
45
 
46
/***** FOR LOGIN AUTHENTICATION *****
47
*    AUTHORIZE ARRAY + AUTHORIZE[AUTHORITY]=SUCCESS
48
*	 FOR SIGN UP - 
49
*
50
*
51
 
52
/* End of file welcome.php */
53
/* Location: ./application/controllers/welcome.php */