OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
groupchat
/
inc
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:13 AM
rwxrwxr-x
📄
db_connect.php
614 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
📄
delete_chat.php
382 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
📄
delete_group.php
410 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
📄
exit_group.php
431 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
📄
function.php
22.64 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
memberSearch.php
1.32 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
navbar.php
607 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
📄
script.js
11.89 KB
11/28/2024 01:24:17 PM
rw-rw-r--
📄
sendreview.php
1.71 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
sidebar.php
5.71 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
style.css
11.1 KB
11/28/2024 01:24:17 PM
rw-rw-r--
📄
test.php
1.83 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
update_member.php
460 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
Editing: script.js
Close
function searchMembers() { var searchItem = $('#searchMem'); $.ajax({ url: 'inc/memberSearch.php', method: 'POST', data: { item: searchItem }, success: function (response) { $('.scrollable-list').html() = ''; $('.scrollable-list').html(response); }, error: function (xhr, status, error) { // Handle errors console.error(xhr.responseText); } }); } function showCreateGroup() { $('.create-chat').show(); $('.chat-message').hide(); $('.panelContent').hide(); } function showGroupContent(user_id, group_id, user_name) { $('.create-chat').hide(); $('.chat-message').show(); $('.panelContent').hide(); console.log(user_id); console.log(group_id); console.log(user_name); $.ajax({ url: 'group.php', method: 'POST', data: { group_id: group_id, user_id: user_id, user_name: user_name }, success: function (response) { // Handle the response $('.chat-message').html(response); }, error: function (xhr, status, error) { // Handle errors console.error(xhr.responseText); } }); } function sendMessage($action, $group_id, $user_id, $user_name) { var messageText = $('#message-input').val().trim(); var current_utc_timestamp = new Date(); // Convert to ISO string in the format YYYY-MM-DD HH:mm:ss var posted_on_sql = current_utc_timestamp.toISOString().replace('T', ' ').replace(/\.\d+Z$/, ''); var posted_on = current_utc_timestamp.toLocaleString(); if (messageText === '') { return; } var $chatBox = $('#chat-box'); var $messageElement = $('<div></div>'); var messageHtml = `<div class='incoming'> <div class="incoming-text">${messageText}</div> <div class="nameWithTime" style="display: flex; column-gap: 5px;"> <div class="Sendername">${$user_name}</div> <div class="dateWithTime">${posted_on}</div> </div> </div>`; // $chatBox.append(messageHtml); $('#message-input').val('').focus(); // Scroll to bottom of chat box $chatBox.scrollTop($chatBox.prop("scrollHeight")); $.ajax({ url: 'inc/sendreview.php', method: 'POST', data: { action: $action, id: $group_id, userid: $user_id, message: messageText, posted_on: posted_on_sql }, success: function (response) { // alert('Message sent successfully!'); console.log(response); // Log response to console $chatBox.append(response); }, error: function (xhr, status, error) { // Handle errors console.error(xhr.responseText); } }); } function deleteGroup(action, id) { if (confirm("Are you sure you want to delete this " + action + "?")) { $.ajax({ url: 'inc/delete_group.php', type: 'POST', data: { action: action, id: id }, success: function (data) { console.log(data); alert("Deleted the " + action + "."); window.location.reload(); }, error: function (xhr, status, error,) { console.error('Error deleting group:', error); } }); } } function exitgroup(action, userid, id) { if (confirm("Are you sure you want to exit the " + action + "?")) { $.ajax({ url: 'inc/exit_group.php', type: 'POST', data: { action: action, user_id: userid, id: id }, success: function (data) { console.log(data); alert("Exited the " + action + "."); window.location.reload(); }, error: function (xhr, status, error,) { console.error('Error exiting group:', error); } }); } } // Function to update selected members display function updateSelectedMembersInfo() { const selectedMemberNames = $('.member-link.selected').map(function () { return $(this).data('user_name'); }).get(); $('#selected-members-info').html(selectedMemberNames.length > 0 ? selectedMemberNames.map(member => '<p>' + member + '</p>').join('') : '<p>No members selected.</p>' ); // Update hidden input with selected member IDs const selectedMembersIds = $('.member-link.selected').map(function () { return $(this).data('user_id'); }).get(); $('#selected-members-hidden').val(selectedMembersIds.join(',')); } function submitPostForm(action, vars) { var form = $('<form>', { method: 'POST', action: action }); $.each(vars, function (key, value) { $('<input>', { type: 'hidden', name: key, value: value }).appendTo(form); }); form.appendTo('body').submit(); } // Function to prepare data and call submitPostForm function groupDisplay(user_id, group_id) { var action = 'group.php'; // URL to send the POST request to var vars = { user_id: user_id, group_id: group_id }; submitPostForm(action, vars); } function redirectTo(url) { window.open(url, '_blank'); } function updateGroupDetails($group_id) { var selectedMembers = $('#selected-members-hidden').val(); console.log(selectedMembers); $.ajax({ type: 'POST', url: 'inc/update_member.php', data: { action: 'group', selected_members: selectedMembers, id: $group_id }, success: function (response) { // Handle the server response if needed console.log(response); // Example: Show a success message or update UI alert('Members added successfully.'); // Optionally, reload or update the member list after addition // window.location.reload(); }, error: function (xhr, status, error) { // Handle errors console.error(error); alert('Error adding members. Please try again.'); } }); } function delete_chat($type, $message_id) { $.ajax({ type: 'POST', url: 'inc/delete_chat.php', data: { type: $type, message_id: $message_id }, success: function (response) { // Handle the server response if needed console.log(response); // Example: Show a success message or update UI alert('Deleted message successfully.'); // Optionally, reload or update the member list after addition window.location.reload(); }, error: function (xhr, status, error) { // Handle errors console.error(error); alert('Error deleting the message. Please try again.'); } }); } function broadcastDisplay(user_id, broadcast_id) { var action = 'broadcast.php'; // URL to send the POST request to var vars = { user_id: user_id, broadcast_id: broadcast_id }; submitPostForm(action, vars); } function sendBroadcast($broadcast_id, $user_id, $user_name) { var messageText = $('#message-input').val().trim(); var user_id = $user_id; var user_name = $user_name; var current_utc_timestamp = new Date(); console.log(current_utc_timestamp); console.log(current_utc_timestamp.toLocaleString()); console.log(messageText); console.log(current_utc_timestamp); // Convert to ISO string in the format YYYY-MM-DD HH:mm:ss var posted_on_sql = current_utc_timestamp.toISOString().replace('T', ' ').replace(/\.\d+Z$/, ''); var posted_on = current_utc_timestamp.toLocaleString(); if (messageText === '') { return; } var $chatBox = $('#chat-box'); var $messageElement = $('<div></div>'); var messageHtml = `<div class='incoming'> <div class="incoming-text">${messageText}</div> <div class="nameWithTime" style="display: flex; column-gap: 5px;"> <div class="Sendername">${user_name}</div> <div class="dateWithTime">${posted_on}</div> </div> </div>`; $chatBox.append(messageHtml); $('#message-input').val('').focus(); // Scroll to bottom of chat box $chatBox.scrollTop($chatBox.prop("scrollHeight")); console.log('test'); $.ajax({ url: 'inc/sendreview.php', method: 'POST', data: { id: $broadcast_id, userid: user_id, message: messageText, posted_on: posted_on_sql }, success: function (response) { // Handle the response // alert('Message sent successfully!'); console.log(response); // Log response to console }, error: function (xhr, status, error) { // Handle errors console.error(xhr.responseText); } }); } function updateBroadcastDetails($broadcast_id) { var selectedMembers = $('#selected-members-hidden').val(); console.log(selectedMembers); $.ajax({ type: 'POST', url: 'inc/update_member.php', data: { action: 'broadcast', selected_members: selectedMembers, id: $broadcast_id }, success: function (response) { // Handle the server response if needed console.log(response); // Example: Show a success message or update UI alert('Members added successfully.'); // Optionally, reload or update the member list after addition // window.location.reload(); }, error: function (xhr, status, error) { // Handle errors console.error(error); alert('Error adding members. Please try again.'); } }); } function copyInviteLink(type, id) { // Create a temporary input element // var link = "<?= $_SERVER['DOCUMENT_ROOT'] ?>/groupchat/join_now.php?type=" + type + "&id=" + id + ""; // var link = "localhost/groupchat/join_now.php?type=" + type + "&id=" + id + ""; var link = "https://www.knoblycream.com/groupchat/join_now.php?type=" + type + "&id=" + id + ""; var $tempInput = $('<input>'); $('body').append($tempInput); $tempInput.val(link).select(); document.execCommand('copy'); $tempInput.remove(); alert('Invite link copied to clipboard!'); } function previewImage(type) { var imageInputId = type === 'group' ? '#group_image' : type === 'broadcast' ? '#broadcast_image' : ''; var imageUrl = $(imageInputId).val(); // Get the value of the input field using jQuery var $imagePreview = $('#imagePreview'); // Check if the input is a valid URL if (imageUrl) { $imagePreview.attr('src', imageUrl).show(); // Set the src attribute and show the image } else { $imagePreview.hide(); // Hide the image preview if no URL } } function verifySelected() { var usersId = $('#selected-members-hidden').val().split(','); $('.scrollable-list .scrollable-list-item').each(function() { // Find the <a> tag within the current .scrollable-list-item var $link = $(this).find('a.member-link'); var id = $link.data('user_id'); if($.inArray(String(id), usersId) !== -1){ $link.addClass('selected'); } }); }