<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller{ 	 

	function __construct(){ 
		parent::__construct();
		$this->data['success_msg']=$this->session->flashdata('success');
		$this->data['error_msg']=$this->session->flashdata('error');
		$this->data['top_title'] = $this->config->item('site_title');
		$this->load->model('User_mdl');
		$this->data['page_name']='';
 	}
	
	public function index(){	
		$this->data['title']='Sign In'; 
		$this->data['page_name']='signin';
		$this->load->view('Frontend/login/view',$this->data);
	}
	
	public function generateRandomString($length = 10) {
		$characters = '123456789ABCDEFGHIJKLMNPQRSTUVWXYZ';
		$charactersLength = strlen($characters);
		$randomString = '';
		for ($i = 0; $i < $length; $i++) {
			$randomString .= $characters[rand(0, $charactersLength - 1)];
		}
		return $randomString;
	}
	
	public function check_db(){
		$auth_code = $this->generateRandomString(6);
		$this->User_mdl->check_login($auth_code);
	}	
	
}