McGansWebsite/admin/application/controllers/Welcome.php
dotwingssoftware e71c4c7872 20230111
20230111
2023-01-11 12:47:57 +05:30

60 lines
1.2 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');
}
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();
$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');
}
}
public function logout()
{
$admin_id=$this->session->userdata('id');
$data = array('id' => '', 'username' => '');
$this->session->unset_userdata($data);
$this->session->sess_destroy();
redirect('');
}
}