SMF Support > SMF 2.0.x Support
Sessions not transfering from website to forum
CoffeeAddict:
I've been trying to get the sessions from by website to transfer to the forum header and haven't had any success.
I've integrated my own header file so the look of the forum is the same as the website, and this is where I'd like the sessions to transfer. So that when a user goes from the site where they are logged in, to the forums, they will still be logged in at the top as usual.
I have this code in all my files
<?php
session_start();
require_once("/home/bestinsh/inc/classes.php");
require_once("/home/bestinsh/inc/config.php");
require_once("/home/bestinsh/inc/functions.php");
dbConnect(db_host, db_user, db_password, db_name);
if ($_SESSION["user_id"])
$user->updateLogIn($_SESSION["user_id"]);
?>
I am NOT expecting the actual forums to recognize the user as logged in, JUST the header that's wrapped around the forums.
I suspect it has something to do with the settings for the forum that's keeping this from happening. If I create a test file in the forum directory the sessions work fine, it's just when I visit the actual forum that they don't. Help please?
CoffeeAddict:
Anyone? I'm still stuck on this, there has to be a way for the cookies/sessions/whatever to transfer to the header from the website, but let the actual forum cookies stay the same.
Arantor:
You will need to include SMF's SSI.php file and do so before all your other stuff since that handles sessions (note that sessions are stored in the database, which is not the normal way of things)
CoffeeAddict:
I included that file in the header before the other stuff and nothing seems to have changed. I don't think I'm doing this correctly.
Arantor:
You didn't mention that before.
You're also starting another session and going through a lot of database stuff that SMF already does itself anyway.
Navigation
[0] Message Index
[#] Next page
Go to full version