<?php include("_config/dbconfig.php");
include("_includes/head.php");

  if($_SESSION['user_role_session']!="Admin"){ 
  		echo "<script> window.location='dashboard.php'</script>"; 
		die();
  }

$full_name      = '';
$father_name    = '';


if(count($_POST)>0 && isset($_POST['add_form'])){ 

		$user_name     	= $_POST['user'];
		$pass 			= $_POST['pass'];
		$check = $obj_user_class->updateAdminPass($user_name, $pass);
		echo "<script> window.location='change_password.php'</script>"; 
		die();

}
 
		$page_title = "Change Password";
		echo '<title>Change Password </title>'; 
		$UserRoles = $obj_user_class->getUserRole();

?>

<?php include("_includes/header.php"); ?>

<div class="col-sm-12 right_form">
        <div class="title">
            <div class="row">
                <div class="col-md-8 col-sm-12">
                    <h1><?php echo $page_title; ?></h1>
                </div>
            </div>
        </div>
        
        <ol class="breadcrumb white">
          <li><a href="dashboard.php">Dashboard</a></li>
          <li><a href="">Change Password</a></li>
        </ol>
</div>

 
 <div class="col-sm-12 form_inner">
    <form class="col-sm-8 form-box" id="agent_form" method="post" action="" enctype="multipart/form-data">
                <div class="row">
					<div class="col-md-6 col-sm-6 form-group">
						<label for="FirstName">Username</label>
						<input type="text" class="form-control required" name="user" readonly="readonly" value="<?php echo $_SESSION['user_email_session'];  ?>" >
					</div>
                    <div class="clearfix"></div>
					<div class="col-md-6 col-sm-6 form-group">
						<label for="LastName">New Password</label>
                        <input type="text" class="form-control  required" name="pass" value="" >
					</div>
                    <div class="clearfix"></div> 
                     
                    <div class="col-sm-12 form-group">
                         <button type="submit" class="btn btn-default" name="add_form"> Submit </button>
                    </div>
                    
                    
		</div>
            </form>
		</div>

<?php include("_includes/footer.php"); ?>

<script>
	$(document).ready(function(){
                   $("#agent_form").validate();
               });

function thumbImg(){
	
		var imgg = $("#profile_img").val();
		arr = imgg.split(".");
		imgg = arr[1].toLowerCase();
		
		if(imgg == "jpg" || imgg =="jepg"  ||  imgg =="png"  || imgg =="gif"){
                    $("#old_img").fadeOut(300);                    
                }
		else {
				alert('Please select the valid file or format!');
				$("#thumb_img").focus();
				$("#thumb_img").val('');
			}
	}	
        
        
</script>

<?php if(isset($_GET['view']) && !empty($_GET['view'])){ ?>
<script>
$(document).ready(function(){ 
        $('.form-control').attr('readonly', 'readonly'); 
   });               

</script>


<?php } ?>


<script>
    $('.date').datepicker(); 
</script>