?
Path : /home/yogsadhna/public_html/admin/ |
Current File : /home/yogsadhna/public_html/admin/change-password.php |
<?php include('includes/connection.php'); include('includes/allfunction.php'); include('includes/auth.php'); if(isset($_POST['submit'])) { $cp=$_POST['currentpassword']; $np=$_POST['newpassword']; $cnp=$_POST['confirmpassword']; if($np==$cnp) { $sql="select * from login where password='$cp' "; $result=mysqli_query($conn,$sql); $count=mysqli_num_rows($result); if($count>0) { $sql="update login set password='$np' "; $result=mysqli_query($conn,$sql); echo "<script>alert ('Password Updated sucessfully') </script> "; } else { echo "<script>alert ('Old Password does not match') </script>"; } } else { echo "<script>alert ('New Password & Confirm Password does not match') </script>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Change Password </title> <!-- plugins:css --> <?php include_once('includes/css.php'); ?> <style> .password-container { position: relative; margin-bottom: 15px; } .password-input { width: 20%; padding: 10px; box-sizing: border-box; } .toggle-btn { position: absolute; right: 77%; top: 50%; transform: translateY(-50%); cursor: pointer; } </style> </head> <body> <div class="container-scroller"> <!-- partial:partials/_navbar.html --> <?php include_once('includes/header.php'); ?> <!-- partial --> <div class="container-fluid page-body-wrapper"> <!-- partial:partials/_sidebar.html --> <?php include_once('includes/sidebar.php'); ?> <!-- partial --> <div class="main-panel"> <div class="content-wrapper"> <div class="col-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Change Password </h4> <p></p> <form class="forms-sample" method="post"> <div class="password-container"> <input type="password" name="currentpassword" id="password1" class="password-input" placeholder="Current Password"> <span class="toggle-btn" onclick="togglePassword('password1')">👁️</span> </div> <div class="password-container"> <input type="password" name="newpassword" id="password2" class="password-input" placeholder="New Password "> <span class="toggle-btn" onclick="togglePassword('password2')">👁️</span> </div> <div class="password-container"> <input type="password" name="confirmpassword" id="password3" class="password-input" placeholder="Confirm Password "> <span class="toggle-btn" onclick="togglePassword('password3')">👁️</span> </div> <button type="submit" name="submit" class="btn btn-gradient-primary me-2">Submit</button> </form> </div> </div> </div> </div> <!-- content-wrapper ends --> <!-- partial:partials/_footer.html --> <?php include_once('includes/footer.php'); ?> <!-- partial --> </div> <!-- main-panel ends --> </div> <!-- page-body-wrapper ends --> </div> <!-- container-scroller --> <!-- plugins:js --> <?php include_once('includes/script.php') ?> <!-- End custom js for this page --> <script> function togglePassword(id) { const passwordField = document.getElementById(id); const type = passwordField.getAttribute('type') === 'password' ? 'text' : 'password'; passwordField.setAttribute('type', type); } </script> </body> </html>