<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Check_If_Admin_Controller extends CI_Controller {
    
	public function Check_Admin()
	{
        $cid=$this->input->post('cid');
        //$this->load->library('../controllers/Login');
		$this->load->model('Fetch_Administrator_Model');
      
        if($this->Fetch_Administrator_Model->Adminstrator_Check($cid))
        {  
             $data=$this->Fetch_Administrator_Model->Adminstrator_Check($cid);

                if($data[0]->type == "super_admin")
                {
                    $datas['data']=$cid;
                    $this->load->view('Admin_Login_View',$datas);
                }

                else if($data[0]->type == "admin")
                {
                    $datas['data']=$cid;
                    $this->load->view('Admin_Login_View',$datas);
                }

                else if($data[0]->type == "client")
                {
                    //echo "client";
                    redirect(base_url().'index.php/Login/otp_generate/'.$cid);
                }

            }
        else
        {
            $this->session->set_flashdata('error',"Member Id Doesn't exist");
            redirect(base_url().'index.php/Login');

        }
    }
    
    
    
}


