How to capture IPS Suite sessions outside /forum/

offline

Posts

2

Likes

0

Bits 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..
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>
 
Liked by:
offline

Posts

13

Likes

4

Bits Credits

0

LEVEL

0

170 XP

So if I understand correctly, you are trying to include your Invision Community 5 Suite (IPS5) into a custom-made homepage.
And you are using IPS5 to authenticate your users.
The server error (500) you are getting is a server configuration error.
That probably means that you are violating IPS5 session management.
The first thing that comes to mind are cookie settings: what domain are you using in your cookies?
Start by reading up on IPS5 session manegement. A good place to start is here.
 
Liked by:
Top Bottom