/
home
/
techb158
/
workloadmatch.com
/
api
/
chat
/
/home/techb158/workloadmatch.com/api/chat
mkdir
upload
Name
Size
Mode
Actions
fetch.php
2034
0644
edit
dl
rm
send.php
1319
0644
edit
dl
rm
test.php
908
0644
edit
dl
rm
unread_count.php
745
0644
edit
dl
rm
Edit:
/home/techb158/workloadmatch.com/api/chat/test.php
(908B)
<?php // Debug test — hit this in browser to verify API works: /api/chat/test.php include_once '../../includes/db_connect.php'; include_once '../../includes/functions.php'; sec_session_start(); header('Content-Type: application/json'); $userId = isset($_SESSION['user_id']) ? (int)$_SESSION['user_id'] : 0; $loggedIn = login_check($mysqli); // Check chat_messages table exists $tableExists = false; $r = $mysqli->query("SHOW TABLES LIKE 'chat_messages'"); if ($r && $r->num_rows > 0) $tableExists = true; // Count messages $msgCount = 0; if ($tableExists) { $r = $mysqli->query("SELECT COUNT(*) AS c FROM chat_messages"); if ($r) $msgCount = (int)$r->fetch_assoc()['c']; } echo json_encode([ 'user_id' => $userId, 'logged_in' => $loggedIn, 'session_id' => session_id(), 'session_name' => session_name(), 'table_exists' => $tableExists, 'total_messages' => $msgCount ]);
Save
cmd:
run