<?php 

// Include main file
include_once('../libs/main.php');

// Check user Login
include_once('checkLogin.php');

$successMsg = '';

if(isset($_REQUEST['successMsg'])){
	$successMsg = $_REQUEST['successMsg'];
}

if(isset($_REQUEST['failedMsg'])){
	$failedMsg = $_REQUEST['failedMsg'];
}

// Logical section of page
$userObj =  new  user();

if(!isset($_REQUEST['user_id']) || intval($_REQUEST['user_id'])==0){
	header('Location:userlist.php');
	exit;
}

if(isset($_POST['submit'])){
	
	if($_POST['user_password']==$_POST['user_repassword']){
		
		$rs = $userObj->resetPassword($_POST['user_id'], md5($_POST['user_password']));
		if($rs){
			$successMsg ="Member Password changed successfully";
			if($_POST['status'] == 1){			
				header('Location:userlist.php?successMsg='.$successMsg);
			}else{
				header('Location:paid_userlist.php?successMsg='.$successMsg);
			}
			exit;
		}
	}else{
		$failedMsg = "Password and Again password do not matched.";
	}
}

// Include Template 
include_once('../libs/routs.php')

?>