<?php
require "commonincludefiles.php";


if ($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) 
{
	if ($_REQUEST["ID"] > 0 && isset($_REQUEST["ID"]))
			 {
			 	$user_id = $_REQUEST["ID"];
				$udername= $_REQUEST["username"];
				$oldpass= $_REQUEST["oldpassword"];
				$schoolid = $_SESSION["VedantnrCollegeId"];
				$newpass= $_REQUEST["password1"];
				
				$objUserMgmt = new UserMgmt();
				
				$limit=0;
				$start=0;
				$condition=" AND user_id='$user_id' AND user_name='$udername'";
				$order_field="";
				$order_type="";
				
				$out = $objUserMgmt->getAllRecords($limit,$start,$condition,$order_field,$order_type);
				
				if (dbRows($out) > 0) 
				{
					$admins	= dbObject($out);
					$objUserMgmt->user_id 			=$user_id;
					$objUserMgmt->user_name			=$udername;
					$objUserMgmt->user_password		= $newpass;
					$objUserMgmt->changePassword();
					$_SESSION["c_pass"] = $newpass;
			    }
			  echo '{"success":"true","msg":""}';
			 
	}
}	
else {
		echo '{"success":"false","msg":"session expiry"}';
	}
?>