<?php
defined('BASEPATH') or exit('No direct script access allowed');
class MyAuth extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('auth/MyAuthentication', 'Authentication');
}
public function signin_process()
{
if ($this->input->is_ajax_request()) {
$this->form_validation->set_rules('email', 'Email', 'required|trim');
$this->form_validation->set_rules('password', 'Password', 'required|md5|trim');
if ($this->form_validation->run()) {
$email = $this->input->post('email', TRUE);
$pwd = $this->input->post('password', TRUE);
if ($this->Authentication->login_authentication($email, $pwd)) {
$data['response'] = base_url() . "backend?login_successfully=yes";
echo json_encode($data);
} else {
$data['response'] = 'Email and passsword missmatch';
echo json_encode($data);
}
} else {
$data['response'] = 'Problem with Email and Password';
echo json_encode($data);
}
}
}
public function signOutUser()
{
$company_reg_no = $this->session->userdata('company_reg_no', TRUE);
$this->session->sess_destroy();
redirect(base_url(''));
}
} |