:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/soulmeetvivah.com/member/**
:: Editing File: change-password.php
<?php include('header.php'); ?> <style type="text/css"> /* ============================================ Modern Tab Navigation Styles ============================================ */ .user-top-header { background: #fff; border-radius: 15px; padding: 0; box-shadow: 0 5px 20px rgba(0,0,0,0.1); margin-bottom: 30px; overflow: hidden; } .menu-list { list-style: none; padding: 0; margin: 0; display: flex; background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%); border-bottom: 3px solid #e0e0e0; position: relative; } .menu-list li { position: relative; flex: 1; text-align: center; transition: all 0.3s ease; } .menu-list li:not(:last-child) { border-right: 1px solid rgba(0,0,0,0.1); } .menu-list li a { display: flex; align-items: center; justify-content: center; padding: 18px 20px; text-decoration: none; color: #666; font-weight: 600; font-size: 15px; transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.5px; gap: 10px; } .menu-list li a i { font-size: 18px; transition: all 0.3s ease; } .menu-list li:hover:not(.active) a { color: #cd4252; background: rgba(205, 66, 82, 0.05); } .menu-list .active { background: #cd4252; } .menu-list .active a { color: #fff !important; } .block-box { background: white; padding: 20px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } </style> <div style="height: 100px;"></div> <div class="page-content"> <div class="container"> <div class="user-top-header"> <ul class="menu-list"> <li><a href="my-soulmeet"> <i class="icofont-user"></i> <span>My Profile</span> </a></li> <li><a href="my-photos"> <i class="icofont-picture"></i> <span>My Photos</span> </a></li> <li class="active"><a href="settings"> <i class="icofont-settings"></i> <span>Setting</span> </a></li> </ul> </div> <div class="block-box user-about"> <div class="widget-heading"> <h3 style="font-size: 18px!important;">Change Password</h3> </div> <div class="row"> <div class="col-lg-8"> <div id="passwordMessage" class="alert" style="display: none; margin-bottom: 20px;"></div> <form id="changePasswordForm"> <div class="form-group mb-3"> <label for="current_password" style="font-weight: 600; color: #333; margin-bottom: 8px;"> <i class="icofont-lock"></i> Current Password </label> <input type="password" class="form-control" id="current_password" name="current_password" placeholder="Enter your current password" required style="border-radius: 8px; padding: 12px 15px;"> </div> <div class="form-group mb-3"> <label for="new_password" style="font-weight: 600; color: #333; margin-bottom: 8px;"> <i class="icofont-lock"></i> New Password </label> <input type="password" class="form-control" id="new_password" name="new_password" placeholder="Enter your new password" required style="border-radius: 8px; padding: 12px 15px;"> <small class="form-text text-muted">Password must be at least 6 characters long.</small> </div> <div class="form-group mb-3"> <label for="confirm_password" style="font-weight: 600; color: #333; margin-bottom: 8px;"> <i class="icofont-lock"></i> Confirm New Password </label> <input type="password" class="form-control" id="confirm_password" name="confirm_password" placeholder="Confirm your new password" required style="border-radius: 8px; padding: 12px 15px;"> <small class="form-text text-muted">Re-enter the new password to confirm.</small> </div> <div class="text-center" style="margin-top: 30px;"> <button type="button" id="updatePasswordBtn" class="btn" style="background: #cd4252; color: #fff; padding: 12px 40px; border-radius: 8px; font-weight: 600; font-size: 16px;"> <i class="icofont-lock"></i> Update Password </button> </div> </form> </div> </div> </div> </div> </div> <script> // Wait for jQuery to be available (function() { function initPasswordUpdate() { if (typeof jQuery === 'undefined') { console.error('jQuery is not loaded'); setTimeout(initPasswordUpdate, 100); return; } jQuery(document).ready(function($) { console.log('Password update script initialized'); // Update Password Button Click $('#updatePasswordBtn').on('click', function(e) { e.preventDefault(); e.stopPropagation(); console.log('Update password button clicked'); // Get form values var currentPassword = $('#current_password').val().trim(); var newPassword = $('#new_password').val().trim(); var confirmPassword = $('#confirm_password').val().trim(); // Validation if (!currentPassword) { showMessage('Please enter your current password.', 'danger'); $('#current_password').focus(); return false; } if (!newPassword) { showMessage('Please enter a new password.', 'danger'); $('#new_password').focus(); return false; } if (newPassword.length < 6) { showMessage('Password must be at least 6 characters long!', 'danger'); $('#new_password').focus(); return false; } if (!confirmPassword) { showMessage('Please confirm your new password.', 'danger'); $('#confirm_password').focus(); return false; } if (newPassword != confirmPassword) { showMessage('New passwords do not match!', 'danger'); $('#confirm_password').focus(); return false; } if (currentPassword == newPassword) { showMessage('New password must be different from current password.', 'danger'); $('#new_password').focus(); return false; } // Disable button and show loading var submitBtn = $(this); var originalText = submitBtn.html(); submitBtn.prop('disabled', true).html('<i class="icofont-spinner-alt-4"></i> Updating...'); console.log('Sending AJAX request to update password'); $.ajax({ url: 'php/update_password.php', method: 'POST', data: { user_id: '<?=$user_id?>', current_password: currentPassword, new_password: newPassword }, dataType: 'text', success: function(response) { console.log('Password update response:', response); submitBtn.prop('disabled', false).html(originalText); var trimmedResponse = response.trim(); if (trimmedResponse == '1') { showMessage('Password updated successfully!', 'success'); // Clear form $('#changePasswordForm')[0].reset(); setTimeout(function() { // Optionally redirect or reload // location.reload(); }, 2000); } else { var errorMsg = trimmedResponse || 'Failed to update password. Please try again.'; showMessage(errorMsg, 'danger'); } }, error: function(xhr, status, error) { console.error('AJAX Error:', status, error, xhr.responseText); submitBtn.prop('disabled', false).html(originalText); showMessage('An error occurred. Please try again. Error: ' + error, 'danger'); } }); return false; }); // Also handle form submit as backup $('#changePasswordForm').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); $('#updatePasswordBtn').click(); return false; }); function showMessage(message, type) { var alertClass = type == 'success' ? 'alert-success' : 'alert-danger'; $('#passwordMessage').removeClass('alert-success alert-danger') .addClass(alertClass) .html('<strong>' + (type == 'success' ? 'Success!' : 'Error!') + '</strong> ' + message) .fadeIn(); // Auto-hide success messages after 5 seconds if (type == 'success') { setTimeout(function() { $('#passwordMessage').fadeOut(); }, 5000); } } }); } // Start initialization if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initPasswordUpdate); } else { initPasswordUpdate(); } })(); </script> <?php include('footer.php'); ?>