HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/pmw24/driver_settlement/application/controllers/Recover_password_user.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Recover_password_user extends MY_Controller {

	public function __construct() {
		parent::__construct();
		$this->load->model('Mcommon');
	}
	public function index($key){	
		$this->forgotpassword($key);
	}
	public function forgotpassword($key) {
		$data['key'] = $key;
		$data['title'] = 'Punjabmotors';
		$this->load->view('forgotpassword_user', $data);
	}

	public function recover_account() {
		$new_password = $this->input->post('newpassword1');
		$recovery_key = $this->input->post('recovery_key');
		$result=$this->mcommon->check_recovery_key($recovery_key);
		if($result){
			$condition=array('user_id'=>$result['user_id']);
			$data=array('password'=>md5($new_password),'recovery_key'=>'');
			$update_result = $this->mcommon->update('master_user',$condition,$data);
			if($update_result){
				$response = array("status" => true, "message" => "Password Updated Successfully");
			}
			else{
				$response = array("status" => true, "message" => "Some thing went wrong. Please try again");
			}
		}
		else{
			$response = array("status" => true, "message" => "Reset link Expired. Please try again.");
		}
		echo json_encode($response);
	}

	public function error_404() {
		$data['title'] = 'Punjabmotors';
		$this->load->view('error_404');
	}
	
}