1 (edited by coxy 2005-02-21 17:37)

Topic: Quiet visit and visit timeout

Hi,

If you turn on a quiet visit - i.e. define('PUN_QUIET_VISIT', 1); - then if the user visit timeout has been reached, they are unable to log out without first visiting a page where quiet visit is not defined. For example, if the user is browsing the forum and reach their visit timeout - then click onto another area of my site where I have defined quiet visit, then click on a logout link from that page (i..e straight to login.php?action=out&id=2 etc) they are presented with an error.

The error generated in "login.php" on line 95 (using punBB 1.2.1) is "Unable to update user visit data".

Doing a bit of poking around the source code, it seems that on line 74 of "include/functions.php" the line:

    if (!defined('PUN_QUIET_VISIT'))
    {
     ....

prevents $pun_user['logged'] from getting assigned when in quiet visit mode. Hence the database call fails on line 95 of login.php.

Cheers, hope you find a fix (or tell me if i'm doing something wrong),

Andy Cox

p.s. keep up the good work with this software  wink

Re: Quiet visit and visit timeout

Nicely spotted. The easiest solution, which I also think is the best, is to simply check if $pun_user['logged'] is set in login.php. E.g:

    // Update last_visit (make sure there's something to update it with)
    if (isset($pun_user['logged']))
        $db->query('UPDATE '.$db->prefix.'users SET last_visit='.$pun_user['logged'].' WHERE id='.$pun_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error());

Try that. I think it will work as expected.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: Quiet visit and visit timeout

Yep, that does the trick

Cheers smile