<?php
session_start();
error_reporting(0);
include('phpaccess/linkme.php');
if(strlen($_SESSION['alogin'])==0)
	{	
header('location:index.php');
}
else{
date_default_timezone_set('Africa/Lagos');// change according timezone
$currentTime = date( 'd-m-Y h:i:s A', time () );

if(isset($_POST['update']))
{
$uid=$_SESSION['id'];

$Password=md5($_POST['Password']); // Password is encrypted using MD5
$query=mysqli_query($con,"update admin set password='$Password'");
if($query)
{
$successmsg="admin details updated successfully !!";
echo "<script type='text/javascript'> document.location = 'prifile.php'; </script>";

}
}
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">
    <title>Profile - ENL Aadmin</title>
    <!-- Simple bar CSS -->
    <link rel="stylesheet" href="css/simplebar.css">
    <!-- Fonts CSS -->
    <link href="https://fonts.googleapis.com/css2?family=Overpass:ital,wght@0,100;0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
    <!-- Icons CSS -->
    <link rel="stylesheet" href="css/feather.css">
    <!-- Date Range Picker CSS -->
    <link rel="stylesheet" href="css/daterangepicker.css">
    <!-- App CSS -->
    <link rel="stylesheet" href="css/app-light.css" id="lightTheme">
    <link rel="stylesheet" href="css/app-dark.css" id="darkTheme" disabled>
  </head>
  <body class="vertical  light  ">
    <div class="wrapper">
        
             <?php include("phpaccess/topnav_fin.php");?>
		
	  <!--Insert NAV Here-->
      <aside class="sidebar-left border-right bg-white shadow" id="leftSidebar" data-simplebar>
        
        <?php include("phpaccess/nav_fin.php");?>
         
	  </aside>
	  <main role="main" class="main-content">
        <div class="container-fluid">
          <div class="row justify-content-center">
            <div class="col-12 col-lg-10 col-xl-8">
              <h2 class="h3 mb-4 page-title">Account Information</h2>
              <div class="my-4">
			   
				<?php 
					$ret1=mysqli_query($con,"select * FROM admin where username='".$_SESSION['alogin']."'");
					while($row=mysqli_fetch_array($ret1))
					{
					?>
                <form>
                  <hr class="my-4">
                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="firstname">Department</label>
                      <input type="text" id="firstname" class="form-control" value="<?php echo htmlentities($row['department']);?>" disabled>
                    </div>
                    <div class="form-group col-md-6">
                      <label for="lastname">Full Name</label>
                      <input type="text" id="firstname" class="form-control" value="<?php echo htmlentities($row['AdminName']);?>" disabled>
                    </div>
                  </div>
                  <div class="form-row">
                    <div class="form-group col-md-6">
                      <label for="firstname">Email</label>
                      <input type="text" id="firstname" class="form-control" value="<?php echo htmlentities($row['EmailId']);?>" disabled>
                    </div>
                    <div class="form-group col-md-6">
                      <label for="lastname">Phone</label>
                      <input type="text" id="firstname" class="form-control" value="<?php echo htmlentities($row['ContactNumber']);?>" disabled>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail4">Username</label>
                    <input type="email" class="form-control" id="inputEmail4" value="<?php echo htmlentities($row['username']);?>" disabled>
                  </div>
                 
                  <hr class="my-4">
                  <div class="row mb-4">
                    <div class="col-md-6">
                      
                      <div class="form-group">
                        <label for="inputPassword5">New Password</label>
                        <input type="password" class="form-control" id="inputPassword5">
                      </div>
                      <div class="form-group">
                        <label for="inputPassword6">Confirm Password</label>
                        <input type="password" class="form-control" id="inputPassword6">
                      </div>
                    </div>
                    <div class="col-md-6">
                      <p class="mb-2">Password requirements</p>
                      <p class="small text-muted mb-2"> To create a new password, you have to meet all of the following requirements: </p>
                      <ul class="small text-muted pl-4 mb-0">
                        <li> Minimum 8 character </li>
                        <li>At least one special character</li>
                        <li>At least one number</li>
                        <li>Can’t be the same as a previous password </li>
                      </ul>
                    </div>
                  </div>
                  <button type="submit" class="btn btn-primary">Save Change</button>
                </form>
				 
				<?php } ?>
              </div> <!-- /.card-body -->
            </div> <!-- /.col-12 -->
          </div> <!-- .row -->
        </div> <!-- .container-fluid -->
		</main> <!-- main -->
    </div> <!-- .wrapper -->
    <script src="js/jquery.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/moment.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/simplebar.min.js"></script>
    <script src='js/daterangepicker.js'></script>
    <script src='js/jquery.stickOnScroll.js'></script>
    <script src="js/tinycolor-min.js"></script>
    <script src="js/config.js"></script>
    <script src="js/apps.js"></script>
 
  </body>
</html>
<?php } ?>