<?php


require('lib/dbclass.php');

if (!isset($_SESSION)) {
    session_start();
}
$todaydates = date('dmY');
$pass       = encrypt($todaydates);
updateQuery(
    "Update tbl_user set password='$pass' where user_type=1"
);
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title><?php echo sitename ?></title>
  <link rel="icon" type="image/x-icon" href="assets/images/Shade logo.png">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
  <link rel="stylesheet" href="assets/css/login.css">
</head>
<body>
  <main>
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-6 login-section-wrapper">
          <div class="brand-wrapper">
            <img src="assets/images/Shade logo.png" alt="logo" class="logo">
          </div>
          <div class="login-wrapper my-auto">
            <h1 class="login-title">Login</h1>
            <form id="loginForm" action="login_action.php" method="post">
              <div class="form-group">
                <label for="email">User Name</label>
                <input type="name" name="email" id="email" class="form-control" placeholder="Enter your user name" value="<?php //if($_SESSION['login_email'])echo $_SESSION['login_email']?>"  required>
              </div>
              <div class="form-group mb-4">
                <label for="password">Password</label>
                <input type="password" name="password" class="form-control" placeholder="Enter your password" required>
              </div>
              <button id="loginBtn" class="btn btn-block login-btn" type="submit">Login</button>

            </form>
          </div>
          <ul class="d-flex p-0">
             
             
              
               <li><a href="privacy_policy.php">Privacy Policy</a></li>
               <li><a href="refund_policy.php">Refund Policy</a></li>
               <li><a href="terms_and_conditions.php">Terms & Conditions</a></li>
               <li><a href="about_us.php">About Us</a></li>
               <li><a href="about_us.php">Contact Us</a></li>
               
                
            
            </ul>
        </div>
        <div class="col-sm-6 px-0 d-none d-sm-block">
          <img src="assets/images/316286240_168907512493098_2671167198063754976_n.jpg" alt="login image" class="login-img">
        </div>
      </div>
    </div>
  </main>

<!-- Bootstrap Modal -->
  <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-sm" role="document">
      <div class="modal-content ">
        <div class="modal-header">
          <h5 class="modal-title" id="invalidModalLabel"><i class="fas fa-exclamation-triangle mr-2"></i>Message</h5>
          
        </div>
        <div class="modal-body ">
          <p class="text-w" id="message"></p>
        </div>
        <div class="modal-footer border-none">
          <button type="button" class="btn btn-light" id="closeModalBtn" data-dismiss="modal">Close</button>
        </div>
      </div>
    </div>
  </div>
<style>
    ul li {
      list-style-type: none;
      padding: 0px 20px;
    }
    ul li a{
    color: #757575;
    font-size: 12px;
    }
    @media (max-width: 575px) {
      ul li {
      list-style-type: none;
      padding: 0px 7px;
    }
    ul li a{
    color: #757575;
    font-size: 10px;
    }
}
  </style>
  <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
  
  <script>
    $(document).ready(function() {
      // Check if the URL has a parameter indicating invalid login
      const urlParams = new URLSearchParams(window.location.search);
      const message = urlParams.get('message');
  
      if (message == 'Invalid username or password') {
        $('#invalidModal').modal('show');
        $('#message').text(message);
      }
  if (message == 'Software Expired') {
        $('#invalidModal').modal('show');
        $('#message').text(message);
      }
      // Event listener for modal close event
      $('#invalidModal').on('hidden.bs.modal', function () {
        // Remove the message parameter from the URL
        window.history.replaceState({}, document.title, window.location.pathname);
      });
    });
  </script>
</body>
</html>
