:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/soulmeetvivah.com/member/**
:: Editing File: deactive-profile.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); } .warning-box { background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%); border: 2px solid #ffc107; padding: 25px; border-radius: 10px; margin-bottom: 25px; box-shadow: 0 3px 10px rgba(255, 193, 7, 0.2); } .warning-box h5 { color: #856404; font-weight: 700; margin-bottom: 10px; } .warning-box p { color: #856404; margin: 0; line-height: 1.6; } </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;">Profile Status</h3> </div> <div class="row"> <div class="col-lg-8"> <?php // Check current profile status $user_id_escaped = mysqli_real_escape_string($conn, $user_id); $sql_status = "SELECT visible_status FROM user_details WHERE user_id = '$user_id_escaped'"; $result_status = mysqli_query($conn, $sql_status); $current_status = '1'; // Default to active if ($result_status && mysqli_num_rows($result_status) > 0) { $row_status = mysqli_fetch_assoc($result_status); $current_status = $row_status['visible_status']; } $is_active = ($current_status == '1'); ?> <!-- Current Status Display --> <div class="status-box" style="background: <?=$is_active ? '#d4edda' : '#f8d7da'?>; border: 2px solid <?=$is_active ? '#28a745' : '#dc3545'?>; padding: 20px; border-radius: 10px; margin-bottom: 25px;"> <div style="display: flex; align-items: center; justify-content: space-between;"> <div> <h5 style="color: <?=$is_active ? '#155724' : '#721c24'?>; margin: 0 0 5px 0;"> <i class="fa <?=$is_active ? 'fa-check-circle' : 'fa-times-circle'?>" style="margin-right: 10px;"></i> Current Status: <strong><?=$is_active ? 'Active' : 'Deactivated'?></strong> </h5> <p style="color: <?=$is_active ? '#155724' : '#721c24'?>; margin: 0;"> <?php if ($is_active) { ?> Your profile is currently <strong>visible</strong> to other members. <?php } else { ?> Your profile is currently <strong>hidden</strong> from other members. <?php } ?> </p> </div> <div style="font-size: 40px; color: <?=$is_active ? '#28a745' : '#dc3545'?>;"> <i class="fa <?=$is_active ? 'fa-check-circle' : 'fa-times-circle'?>"></i> </div> </div> </div> <?php if ($is_active) { ?> <!-- Deactivate Section (only show if active) --> <div class="warning-box"> <h5><i class="fa fa-exclamation-triangle"></i> Warning</h5> <p>Deactivating your profile will hide it from other members. You can reactivate it anytime by logging in again.</p> </div> <div id="deactiveMessage" class="alert" style="display: none;"></div> <form id="deactiveForm"> <div class="form-group mb-3"> <label for="confirm_password" style="font-weight: 600; color: #333; margin-bottom: 8px;"> <i class="icofont-lock"></i> Enter your password to confirm </label> <input type="password" class="form-control" id="confirm_password" name="confirm_password" placeholder="Enter your current password" required style="border-radius: 8px; padding: 12px 15px;"> <small class="form-text text-muted">You must enter your current password to deactivate your profile.</small> </div> <div class="text-center" style="margin-top: 30px;"> <button type="button" id="deactiveProfileBtn" class="btn" style="background: #cd4252; color: #fff; padding: 12px 40px; border-radius: 8px; font-weight: 600; font-size: 16px; margin-right: 10px;"> <i class="fa-regular fa-eye-slash"></i> Deactive Profile </button> <a href="settings" class="btn btn-secondary" style="padding: 12px 40px; border-radius: 8px; font-weight: 600; font-size: 16px;"> <i class="icofont-close"></i> Cancel </a> </div> </form> <?php } else { ?> <!-- Reactivate Section (only show if deactivated) --> <div class="info-box" style="background: #d1ecf1; border: 2px solid #bee5eb; padding: 25px; border-radius: 10px; margin-bottom: 25px;"> <h5 style="color: #0c5460; margin-bottom: 10px;"> <i class="fa fa-info-circle"></i> Profile Deactivated </h5> <p style="color: #0c5460; margin: 0;"> Your profile is currently hidden from other members. Click the button below to reactivate it and make it visible again. </p> </div> <div id="deactiveMessage" class="alert" style="display: none;"></div> <div class="text-center" style="margin-top: 30px;"> <button type="button" id="reactivateProfileBtn" class="btn" style="background: #28a745; color: #fff; padding: 12px 40px; border-radius: 8px; font-weight: 600; font-size: 16px; margin-right: 10px;"> <i class="fa fa-check-circle"></i> Reactivate Profile </button> <a href="settings" class="btn btn-secondary" style="padding: 12px 40px; border-radius: 8px; font-weight: 600; font-size: 16px;"> <i class="icofont-close"></i> Cancel </a> </div> <?php } ?> </div> </div> </div> </div> </div> <script> // Wait for jQuery to be available (function() { function initDeactiveProfile() { if (typeof jQuery === 'undefined') { console.error('jQuery is not loaded'); setTimeout(initDeactiveProfile, 100); return; } jQuery(document).ready(function($) { console.log('Deactive profile script initialized'); // Deactive Profile Button Click $('#deactiveProfileBtn').on('click', function(e) { e.preventDefault(); e.stopPropagation(); console.log('Deactive profile button clicked'); // Get password var password = $('#confirm_password').val().trim(); // Validation if (!password) { showMessage('Please enter your password to confirm.', 'danger'); $('#confirm_password').focus(); return false; } // Confirm action if (!confirm('Are you sure you want to deactivate your profile?\n\nYour profile will be hidden from other members. You can reactivate it anytime by logging in again.')) { return false; } // Double confirmation if (!confirm('This action will hide your profile from all members. Are you absolutely sure?')) { 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> Deactivating...'); console.log('Sending AJAX request to deactivate profile'); $.ajax({ url: 'php/deactive_profile.php', method: 'POST', data: { user_id: '<?=$user_id?>', password: password }, dataType: 'text', success: function(response) { console.log('Deactive profile response:', response); submitBtn.prop('disabled', false).html(originalText); var trimmedResponse = response.trim(); if (trimmedResponse == '1') { showMessage('Profile deactivated successfully! You will be redirected to login page.', 'success'); setTimeout(function() { window.location.href = '../login'; }, 2000); } else { var errorMsg = trimmedResponse || 'Failed to deactivate profile. 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; }); // Reactivate Profile Button Click $('#reactivateProfileBtn').on('click', function(e) { e.preventDefault(); e.stopPropagation(); console.log('Reactivate profile button clicked'); // Confirm action if (!confirm('Are you sure you want to reactivate your profile?\n\nYour profile will become visible to other members again.')) { 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> Reactivating...'); console.log('Sending AJAX request to reactivate profile'); $.ajax({ url: 'php/reactivate_profile.php', method: 'POST', data: { user_id: '<?=$user_id?>' }, dataType: 'text', success: function(response) { console.log('Reactivate profile response:', response); submitBtn.prop('disabled', false).html(originalText); var trimmedResponse = response.trim(); if (trimmedResponse == '1') { showMessage('Profile reactivated successfully! Your profile is now visible to other members.', 'success'); setTimeout(function() { location.reload(); }, 2000); } else { var errorMsg = trimmedResponse || 'Failed to reactivate profile. 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 $('#deactiveForm').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); $('#deactiveProfileBtn').click(); return false; }); function showMessage(message, type) { var alertClass = type == 'success' ? 'alert-success' : 'alert-danger'; $('#deactiveMessage').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() { $('#deactiveMessage').fadeOut(); }, 5000); } } }); } // Start initialization if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initDeactiveProfile); } else { initDeactiveProfile(); } })(); </script> <?php include('footer.php'); ?>