How to change password in CodeIgniter?

Today, We want to share with you change password in codeigniter.In this post we will show you how to send password reset link in codeigniter?, hear for check old password and updating a new password using codeigniter we will give you demo and example for implement.In this post, we will learn about forgot password in codeigniter with an example.

How to Make Forgot Password in Codeigniter?

Forms.php (Controller)

load->database();
		$this->load->library('session');
		/*load Model*/
		$this->load->helper('url');
		$this->load->model('UserForm');
	}       
	
	public function update_new_set_password()
	{
		if($this->input->post('update_new_set_password'))
		{
			$password_old=$this->input->post('password_old');
			$freshpassword=$this->input->post('freshpassword');
			$second_time_verify_password=$this->input->post('second_time_verify_password');
			$session_id=$this->session->userdata('id');
			$que=$this->db->query("select * from client_sign_in where id='$session_id'");
			$row=$que->row();
			if((!strcmp($password_old, $pass))&& (!strcmp($freshpassword, $second_time_verify_password))){
				$this->UserForm->update_new_set_password($session_id,$freshpassword);
				echo "Good Luck, Password changed successfully !";
				}
			    else{
					echo "sorry, Invalid";
				}
		}
		$this->load->view('update_new_set_password');	
	}
}
?>

CodeIgniter Model

UserForm.php

db->query("select * from client_sign_in where id='$session_id'");
	$res=$getUserPassword->result();
	}
	function update_new_set_password($session_id,$freshpassword)
	{
	$update_pass=$this->db->query("UPDATE client_sign_in set pass='$freshpassword'  where id='$session_id'");
	}
}

CodeIgniter View

update_new_set_password.php




Login Form - www.pakainfo.com





Change Password









Run the program on your browser with URL:

http://localhost/codeIgniter/index.php/Forms/update_new_set_password

I hope you get an idea about forgot password gmail in codeigniter.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment