FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
session_start() before/after require_once()???
Message  
Reply with quote
Post session_start() before/after require_once()??? 
Hi there PHP surfers:

I currently use session_start to keep my members logged in to my forum. But sometimes they log out unexpectedly.

I have session_start() on every page and usually they log out randomly when they change between pages on the forum. I suspect I could set a cookie that keeps them logged in but before I make the changes I wonder why this happens?

My code is;

Code:

require_once( './lib.php');
$user_logged = FALSE;
session_start();
if (isset($_SESSION[user])) {
$user_logged = TRUE;
} else {
...
}


This is the basic script I use on each page that checks whether $_SESSION[user] is set and to change the variable $user_logged to TRUE so the member functions in the script activate. I know this is a terrible way of doing things and I intend to rework the forum software on the next update.

But I am curious as to why members randomly log out? Is it because I set a variable and use require_once() before session_start() ???

Any help would be appreciated.

Thanks

catcalls

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com