Topic: Website/PunBB Integration
I want my website to be able to read and utilize my punBB's cookie so that I can have them logged into my website and punBB simultaneously.
This is the code in 'include/functions.php' of my punBB 1.2.11 that successfully reads my punBB's coookie. I have only added a notice message within.
if (isset($_COOKIE[$cookie_name]))
list($cookie['user_id'], $cookie['password_hash']) = @unserialize($_COOKIE[$cookie_name]);
// Code I've added to inform members of a dilema.
echo '<strong>Website login is offline.</strong><br>Mboard login is working.<br><small>['.$cookie['user_id'].'] '.$cookie_name.'</small><p>';
if ($cookie['user_id'] > 1)
{
This is the code on the page of my website that fails to read my punBB's cookie (so that a user may be logged in to my website and the message board simultaneously).
if (isset($_COOKIE[$cookie_name]))
list($cookie['user_id'], $cookie['password_hash']) = @unserialize($_COOKIE[$cookie_name]);
// Code I've added to inform members of a dilema.
echo '<strong>Website login is offline.</strong><br>Mboard login is working.<br><small>['.$cookie['user_id'].'] '.$cookie_name.'</small><p>';
if ($cookie['user_id'] > 1)
{
The variable $cookie['user_id'] never returns any data when called by my website (as in the code above). Besides four extra tabs, the code is identical. Why does this code not work when used on the website? (that the punBB is part of)
Website is located at the main directory. The punBB is within a folder called 'mboard2'.
The cookie is valid, as I can run around logged in to the punBB with no trouble at all.
The value of $cookie_name in both codes is identical.
And aren't isset, list, unserialize all native PHP functions?
Back when I had punBB 1.5.1 (I just recently upgraded to 1.2.11 which is a vast improvement) I was able to do the following:
? Users could login to my website -> this would also simultaneously log them into the message board.
? Users could login to the messageboard -> this would also simultaneously log them into the website.
? ( Logging out worked exactly the same. I even managed to get stylesheet changes on either to update on the other. )
But with punBB 1.2.11, I am having trouble restoring this much-needed ability because of the code mentioned above.