offline
Posts
2
Likes
0
Credits
0
LEVEL
0
155 XP
Hello community.
I need your help, I'm new to coding. I've been trying to develop a homepage for my forum. Log story short, every time I tray to pull active sessions i ran into 500 error.
Let say i created user panel, it works, but i have to login through forum and register through forum, makes since. It dose pull user data, such as username, user profile img and so on..
BUT. to log out for example from homepage, it cant kill session I've tried many different ways ether its 500 error or just refreshes page but dose not log out.. That's one thing..
Next up, I've created chatbox for my homepage, also same issue with sessions, seems like i can't get them work outside /forum/ directory..
Anyone has any idea what im talking about and are able to help me with this? to make sessions work outside /forum?
Here's example code for my chatbox..
I need your help, I'm new to coding. I've been trying to develop a homepage for my forum. Log story short, every time I tray to pull active sessions i ran into 500 error.
Let say i created user panel, it works, but i have to login through forum and register through forum, makes since. It dose pull user data, such as username, user profile img and so on..
BUT. to log out for example from homepage, it cant kill session I've tried many different ways ether its 500 error or just refreshes page but dose not log out.. That's one thing..
Next up, I've created chatbox for my homepage, also same issue with sessions, seems like i can't get them work outside /forum/ directory..
Anyone has any idea what im talking about and are able to help me with this? to make sessions work outside /forum?
Here's example code for my chatbox..
PHP:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once 'C:/wamp64/www/forum/init.php'; // Ensure this path is correct
// Manually start the IPS session
\IPS\Session\Front::i();
// Get the logged-in user
$member = \IPS\Member::loggedIn();
// Debugging: Check if IPS recognizes the user
if ($member->member_id) {
echo "✅ You are logged in as: " . htmlspecialchars($member->name) . " (ID: " . $member->member_id . ")<br>";
} else {
echo "❌ You are NOT logged in! IPS session is not detected.<br>";
}
// Debugging: Check IPS session and cookies
echo "<pre>";
print_r($_COOKIE); // Show all cookies to verify IPS session cookie exists
echo "</pre>";
?>
<div id="chatbox">
<div id="chatMessages">
<!-- Messages will be loaded here -->
<?php include 'core/chat/fetchMessages.php'; ?>
</div>
<?php if ($loggedIn): ?>
<!-- Input area for logged-in users -->
<div class="input-area">
<img src="<?= htmlspecialchars($avatar) ?>" alt="Avatar">
<input type="text" id="messageInput" placeholder="Type a message...">
<button id="sendMessage"><i class="fa fa-paper-plane"></i></button>
</div>
<?php else: ?>
<!-- Warning for guests -->
<div class="chat-warning">You must be logged in to chat.</div>
<?php endif; ?>
</div>