<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

	class ProfileModel extends CI_Model
	{
		function __construct() 
		{
        // Call the Model constructor
			parent::__construct();
			$this->load->database();
			$this->load->library('session');
		}

    public function getProfile() 
	{
		if(!isset($_SESSION["login_type"]) && !isset($_SESSION["login_id"]))
		{
			echo  header('location:'.base_url().'index.php/Login/logout');	
		}
		else
		{
			$login_type = $this->session->userdata('login_type');
			$login_id = $this->session->userdata('login_id');
			$login_type = $this->session->userdata('login_type');
			if ($login_type == 'super_admin') {				
				$sql = 'select * from tblSuperAdmin where superID='.$login_id;
			}			
			$query = $this->db->query($sql);
			return $query->result_array();
		}
    }
     public function save_update_profile($super_name,$super_email_id,$super_contact,$userName,$password,$login_id)
	{
				
		  	$sql = "update  tblSuperAdmin set username='".$userName."', password='".$password."',superName='".$super_name."', superEmail='".$super_email_id."' , superContact='".$super_contact."'  where superID=".$login_id;
      	
				$result = $this->db->query($sql);
				$_SESSION['success']='Prifle  Updated Successfully';


       redirect(base_url() . 'index.php/admin_dashboard'); 
    }
}

?>				