<?php include('../config.php'); 
include('inc.session-create.php'); 
$PageTitle="Change Password";
$FileName = 'login_pass.php';
$validate=new Validation();
if($_SESSION['success']!="")
{
   $stat['success']=$_SESSION['success'];
   unset($_SESSION['success']);
}
if(isset($_POST['updaterecord']))
 	{ 
$validate->addRule($_POST['new_pass'],'',"New Password",true,6,14);
$validate->addRule($_POST['renew_pass'],'',"Confirm Password",true,6,14);
if($validate->validate() && count($stat)==0)
	{
	   if($_POST['new_pass']==$_POST['renew_pass']) {
				   $aryData=array(	
													'password'     	 	         		=>	md5($_POST['new_pass']),
								 );  
					 $flgIn = $db->updateAry("admin_login", $aryData , "where id='".$_SESSION['SUPER_ADMIN']['id']."'");
					 $stat['success']="Password Updated Successfully";
					 unset($_POST);
		} else {
			$stat['error']="Confirm password do not match";   
			}	
	} else {
			$stat['error'] = $validate->errors();
			}
	} 
?>
<!DOCTYPE html>
<html>
<head>
<?php include('inc.meta.php'); ?>
</head>
<body class="fixed-left">
<div id="wrapper">
<?php include('inc.header.php'); ?>
  <?php include('inc.sideleft.php'); ?>
  <div class="content-page">
    <div class="content">
      <div class="container">
        <div class="row">
          <div class="col-sm-12">
            <h4 class="page-title"><?php echo $PageTitle; ?></h4>
          </div>
        </div>
        <div class="row">
          <div class="col-md-12">
            <div class="card-box">
              <div class="row">
                <div class="col-md-9"> <?php echo msg($stat); ?> </div>
              </div>
            </div>
            <div class="card-box">
              <form role="form" action="" method="post" enctype="multipart/form-data">
                <div class="row">
                  <div class="col-lg-6 col-md-6">
                    <div class="form-group clearfix">
                      <label class="col-lg-12 control-label " for="userName">New Password *</label>
                      <div class="col-lg-12">
                        <input type="password" class="form-control required" id="userName" name="new_pass" value="">
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-6 col-md-6">
                    <div class="form-group clearfix">
                      <label class="col-md-12 control-label " for="userName">Confirm Password *</label>
                      <div class="col-md-12">
                        <input type="password" class="form-control required" id="userName" name="renew_pass" value="">
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row footsect">
                  <div class="col-lg-12 col-md-12">
                    <div class="form-group clearfix">
                      <button type="submit" name="updaterecord" class="btn btn-default"><i class="fa fa-paper-plane-o"></i> Update</button>
                    </div>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include('inc.footer.php'); ?>
  </div>
</div>
<?php include('inc.js.php'); ?>
</body>
</html>
