Logging Out Issue

  • HollyHunter
  • Newbie
  • Newbie
  • User avatar
  • Joined: Jun 02, 2009
  • Posts: 13
  • Status: Offline

Post June 5th, 2009, 4:24 am

Hi All

I have a script that integrates PunBB with a social networking script i'm using, the integration works fine and when a user logs into my social script, they get logged into the forum as well, good stuff.

The problem i've got is that after about a day or so they seem to get automatically logged out of the PunBB forums and remain logged into the social script, which means people are going to have to log into forum everytime they visit which is quite silly.

Now i'll bet 10p that the integration script i'm using is setting some kind of time for them to remain logged into the forum, there doesn't appear to be any other explanation.

Could someone who understands php have a look at the script for me and tell me if this is the case, and also how i remove that function so they remain logged in until they log out?

I've uploaded the code here: *** Problem Solved ****

The cookie functions are near the end with the log in / out info...

Thanks to anyone who can help! xx
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 5th, 2009, 4:24 am

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post June 5th, 2009, 1:19 pm

Here's your issue:

Code: [ Select ]
$timedata = time () + 86400;
{code condensed for readability}
setcookie ($$cookiename, base64_encode ($user_id . '|' . $hvalue . '|' . $timedata . '|' . sha1 ($salt . $hvalue . pun_hash ($timedata, $salt))), $timedata, $$cookiepath, $$cookiedomain, $$cookiesecure, true);
  1. $timedata = time () + 86400;
  2. {code condensed for readability}
  3. setcookie ($$cookiename, base64_encode ($user_id . '|' . $hvalue . '|' . $timedata . '|' . sha1 ($salt . $hvalue . pun_hash ($timedata, $salt))), $timedata, $$cookiepath, $$cookiedomain, $$cookiesecure, true);


You're setting an expiration on the cookie for 24 hours after login.


You can't set a cookie that doesn't expire, but you can set one for some time in the future. Change line 244 (that's the pastebin number) to this:

Code: [ Select ]
$timedata = time() + 60*60*24*7*365; //expires in one year
I'd love to change the world, but they won't give me the source code.
  • HollyHunter
  • Newbie
  • Newbie
  • User avatar
  • Joined: Jun 02, 2009
  • Posts: 13
  • Status: Offline

Post June 5th, 2009, 2:07 pm

Thanks UPSGuy, I'll give that a go :)

Holly xx

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 145 guests
  • 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 post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.