<?php
include"initialize_page.php";
include"systemfunctions.php";
?>
<?php include('resources/header.php') ?>
	<title>Change Password</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
<?php include('resources/css-file.php') ?>
<?php include('resources/navigation.php') ?> 
<!-- Dashboard wrapper starts -->
<div class="dashboard-wrapper">
	<div class="main-container">				
		<div class="row">
			<div class="col-sm-12 ac-summ">
				<h2>Change Password</h2>
			</div>
		</div>
		<div class="row gutter">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<ul class="boxli">
				<li>
					<h4>Change Password</h4>
					<p>If you feel that you have a weaker strengh password, then please change it. We recommend to change your password in every 45 days to make it secure.   <strong>Password Change guidelines</strong></p>
					<form method="post" action="" id="addcustom">
						<div class="form-group">
							<input type="hidden" name="q" value="change_password" class="form-control">
						</div>                                      
						<div class="form-group">
							<label>User Name</label>
							<input class="form-control" type="text" value="<?php echo user_details($user_id,'x_fname');  ?> <?php echo user_details($user_id,'x_lname');  ?>" readonly />
						</div>
						<div class="form-group">
							<label>Account Number</label>
							<input class="form-control" type="text" value="<?php echo user_details($account_id,'x_time');  ?>" readonly />
						</div>
						<div class="form-group">
							<label>Current Password</label>
							<input class="form-control" type="password" value="" name="currentpassword" required>
						</div>
						<div class="form-group">
							<label>New Password</label>
							 <input class="form-control" type="password" value="" name="newpass" required>
						</div>
						<div class="form-group">
							<label>Confirm New Password</label>
							<input class="form-control" type="password" value="" name="confirmnewpass" required>
						</div>
						<button class="btn btn-info">Change Password</button>
					</form>
				</li>
				</ul>	
			</div>
		</div>	
		</br>
	</div>
	<!-- Main container ends -->
</div>
<!-- Dashboard wrapper ends -->
<?php include('resources/footer.php') ?>
<?php include('resources/js-file.php') ?>
<script src="js/jQuery.style.switcher.js"></script>

<script type="text/javascript">
	 $(document).ready(function() {
    $("#addcustom").on('submit',(function(e) {
e.preventDefault();

$.ajax({
url: "controller.php", // Url to which the request is send
type: "POST",             // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false,       // The content type used when sending data to the server.
cache: false,             // To unable request pages to be cached
processData:false,        // To send DOMDocument or non processed data file it is set to false
success: function(data)   // A function to be called if request succeeds
{
	//alert(data);
	if(data==0)
	{
		alert("Please fill all fields...");
	}
	if(data==1)
	{
		alert("Changed Successfully..");
		window.location.href='<?php  echo website_settingdata('x_weburl'); ?>user/change-password.php';
	}
	if(data==2)
	{
	alert("New Password & Confirm New Password should be same..");	
	}
	if(data==3)
	{
	alert("Incorrect Current Password..");	
	}
	
}
});
}));
});
	
	</script>
