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

class Change_Password_Model extends CI_Model {

       var $tableName='tbl_admin';     
  

    function checkOldPassword($passId){
		$this->db->select($this->tableName.'.password');
		$this->db->where('id', $passId);
		$query = $this->db->get($this->tableName);
		$data= $query->row();
		$oldpass= md5($this->input->post('old_pass'));
		if($data->password==$oldpass){
			return true;
		}
		else{
			return false;
		}
	}
        
	function updatePassword(){
		if($this->input->post('new_pass'))
		$this->db->set('password',md5($this->input->post('new_pass')));
		$this->db->where('id',$this->session->userdata('admin_id'));
		$query=$this->db->update($this->tableName);
	} 
   
  
}
