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

class Header extends CI_Controller {
	public function __construct(){
		parent::__construct();
		$this->load->library('layouts');
		
		checkDashboard();
		
	}
	
	public function index(){
	}
	
	
	public function saveProfile(){
		
		$this->load->model('header_model');
		$this->load->model('Gallery_profile');
		
		$fldid = element('userID', $this->session->userdata('logged_in'));
		
		$email = $this->input->post('emailprofile');
		$userid = $this->input->post('usernameprofile');
		$password = $this->input->post('passwordprofile');
			
		if($password != "" && !empty($password) && $password != NULL){	
			$data = array(
				'email' => $email,
				'userid' => $userid,
				'password' => md5($password),
			);
		}
		else{
			$data = array(
				'email' => $email,
				'userid' => $userid,
			);
		}
			
		$updateProfile = $this->header_model->update('tbl_usermaster', $fldid, $data);
		$image_name = $this->Gallery_profile->do_upload($fldid);
		
		
		redirect('dashboard', 'refresh');
		

	}
	
	
	
	
	
	
}

?>