65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
|
<?php
|
||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||
|
|
||
|
class Welcome extends CI_Controller {
|
||
|
public function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
$this->load->model('Common_model');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Index Page for this controller.
|
||
|
*
|
||
|
* Maps to the following URL
|
||
|
* http://example.com/index.php/welcome
|
||
|
* - or -
|
||
|
* http://example.com/index.php/welcome/index
|
||
|
* - or -
|
||
|
* Since this controller is set as the default controller in
|
||
|
* config/routes.php, it's displayed at http://example.com/
|
||
|
*
|
||
|
* So any other public methods not prefixed with an underscore will
|
||
|
* map to /index.php/welcome/<method_name>
|
||
|
* @see https://codeigniter.com/user_guide/general/urls.html
|
||
|
*/
|
||
|
public function index()
|
||
|
{
|
||
|
$this->load->view('login');
|
||
|
}
|
||
|
public function dashboard()
|
||
|
{
|
||
|
$this->load->view('dashboard');
|
||
|
}
|
||
|
public function admin_login()
|
||
|
{
|
||
|
|
||
|
$username=$this->input->post('username');
|
||
|
$password=$this->input->post('password');
|
||
|
|
||
|
$check=$this->Common_model->get_login_detail($username,$password);
|
||
|
|
||
|
if($check->num_rows()>0)
|
||
|
{
|
||
|
|
||
|
$ch =$check->row();
|
||
|
//$usertype=$ch->user_type;
|
||
|
//$this->session->set_userdata('user_type',$ch->user_type);
|
||
|
$this->session->set_userdata('username',$ch->username);
|
||
|
$this->session->set_userdata('id',$ch->id);
|
||
|
$this->session->set_userdata('suc',' Successfully Logged in..!');
|
||
|
if($usertype!=2){
|
||
|
redirect('dashboard');}
|
||
|
else{
|
||
|
redirect('dashboard');}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$this->session->set_userdata('err','The username or password is incorrect.');
|
||
|
redirect('dashboard');
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|