<?php 
session_start();
 include("../db.php");
// $admin_id=$_SESSION['id'];
extract($_POST);
if(isset($submit)){
	if($password1 !== $password2){
		$alert='<div class="alert alert-danger alert-dismissible">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  <strong>Password or confirm password!</strong> Not match.
</div>';
	}
	else{
$sql=mysqli_query($conn,"UPDATE `shops` SET `password`='$password1' WHERE `status`='admin'");
$alert='<div class="alert alert-success alert-dismissible">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  Password<strong> successfully changed!</strong>
</div>';
?>
<script>
         setTimeout(function(){
            window.location.href = 'index.php';
         }, 3000);
      </script>
      <?php
	}
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description-gambolthemes" content="">
	<meta name="author-gambolthemes" content="">
	<title>Change password</title>
	<link href="css/styles.css" rel="stylesheet">
	<link href="css/admin-style.css" rel="stylesheet">
	
	<!-- Vendor Stylesheets -->
	<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
	
</head>

    <body class="bg-sign">
        <div id="layoutAuthentication">
            <div id="layoutAuthentication_content">
                <main>
                    <div class="container">
                        <div class="row justify-content-center">
                            <div class="col-lg-5">
                                <div class="card shadow-lg border-0 rounded-lg mt-5">
                                    <div class="card-header card-sign-header">
										<h3 class="text-center font-weight-light my-4">Change Password</h3>
										<?php if(isset($alert)){ echo $alert; } ?>
									</div>
                                    <div class="card-body">
                                        <form method="post">
                                           
											<div class="form-group">
												<label class="form-label" for="inputPasswordNew">New Password*</label>
												<input class="form-control py-3" name="password1" type="password"  placeholder="Enter new password" id="password" minlength="4" required/>
											</div> 
											<div class="form-group">
												<label class="form-label" for="inputPasswordNewConfirm">Confirmation Password*</label>
												<input class="form-control py-3" name="password2" id="inputPasswordNewConfirm" type="password" placeholder="Enter New confirmation password">
											</div>
                                            <div class="form-group d-flex align-items-center justify-content-between mt-4 mb-0">
												<button  class="btn btn-sign " name="submit">Change Password</button>
											</div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </main>
            </div>
        </div>
		 <script src="js/jquery-3.4.1.min.js"></script>
        <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="js/scripts.js"></script>		
		
    </body>
</html>
