<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*	
 *	Author 	: Wahyu
 *	Tanggal : 15-09-2014	
 *	Revisi 	: 
 */
 
class Change_password extends CI_Controller {
	// inisialisasi manual
	public $menu_id 	= 260;
	public $menu_model 	= 'm_changepassword';
	
    public function __construct(){
        parent::__construct();
		$this->load->model('m_changepassword');
		if($this->session->userdata("login") !== TRUE) {		
			
			 redirect("login", "refresh");
			 die;
		}		
	}
	
	//update password
	function update_password(){
		$employee_code		= $this->session->userdata('username');
		$old_password		= $this->input->post('txt_oldpassword');
		$new_password		= $this->input->post('txt_newpassword');
		$confirmation		= $this->input->post('txt_confirmation');
		
		$data = array(
			'EmployeePassword' => $new_password
		);

		//$check_exist_password	= $this->m_changepassword->compare_password($old_password, $employee_code);
		//if($check_exist_password != FALSE){
		$data['update']	= $this->m_changepassword->update($data, $employee_code);	
		$this->session->sess_destroy();
		redirect('login', 'refresh');
		//}
	}
}
	