sessions.php / Error updating last visit time

This mod will register when the user last logged in, allong with the info about how meny users have visited the board

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

sessions.php / Error updating last visit time

Postby Peter77s on Sat 09. Apr, 2005 06:11

Error updating last visit time
Last edited by Peter77s on Sat 23. Apr, 2005 17:14, edited 4 times in total.
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Postby Peter77s on Sun 17. Apr, 2005 21:23

IN LINE FIND IF

ADD //

?????? THERE ARE TWO IF!!!


if ( $user_id != ANONYMOUS )
{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;

$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) ) :roll:
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Postby Peter77s on Sun 17. Apr, 2005 21:51

I can enter my board fine... but before I do I get this

phpBB : Critical Error

Error clearing sessions table

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIX_TIMESTAMP() - session_time >=9 AND session_id <> '

DELETE FROM phpbb_sessions UNIX_TIMESTAMP() - session_time >=9 AND session_id <> '0aa2810594606b19fa6861a2cb4314e2'

Line : 305
File : sessions.php


then if I refresh the page all works fine... .if I dont move for a minute and click on a link in my forum or refresh the page I get the same error
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Postby easygo on Fri 22. Apr, 2005 10:54

Hi Peter77s, try this one instead of yours

Code: Select all
//if ( $user_id != ANONYMOUS )
{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;

$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
   message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
}

$userdata['user_lastvisit'] = $last_visit;

$sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '';
$sessiondata['userid'] = $user_id;
//}

Works fine for me. So I hope for you too.

greetz easy
easygo
Poster
Poster
 
Posts: 44
Joined: Tue 02. Nov, 2004 17:03

Postby Peter77s on Sat 23. Apr, 2005 12:26

thank you easygo for your version. thought it did not work for me... I still appreciate your help.

Seems like I have it working now. the only problem I have is that when I test my board with firefox, it will not let me in. it gives me this error.
phpBB : Critical Error

Error creating user session

DEBUG MODE

Line : 325
File : sessions.php




but with my IE it works fine. got some small bugs in users profile for example in thier profile it will say

Last Online Duration: 2 Weeks, 1 Day, 09:41:26

that can't be true!

so still working on it.


<edit> ok nevermind I can enter with firefox now. all seems to be working fine expect the Last Online Duration: 2 Weeks, 1 Day, 09:41:26 in user profile.

[sarcasm] thanks for the great support and fast reply, admin!!! :D [/ sarcasm]
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Postby easygo on Sat 23. Apr, 2005 13:51

Hi Peter,

feel free to post the part of sessions.php around line 325
or the whole file as ZIP attachment as well.

Thus you can make it easier for Niels and another
to find a fix for your firefox problem.

Peter77s wrote:Last Online Duration: 2 Weeks, 1 Day, 09:41:26

Looks like wrong argument, somehow.

greetz easy
Here we go ^^
Image
easygo
Poster
Poster
 
Posts: 44
Joined: Tue 02. Nov, 2004 17:03

Postby Peter77s on Sat 23. Apr, 2005 17:17

:? I must of edited this lots of times....

After many varietys of differn't try's, I decided not to comment out the part that was giving me the most trouble.
and now everything is working fine. the mod is working great like it should be and my members last duration time seems to be recorded correctly. this is odd that it can work like this, but seems like we all have our odd way with this mod since your way did not work for me but did for you. :wink:

if ( $user_id != ANONYMOUS )
{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;

$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit, user_lastlogon = " . time() . ", user_totallogon=user_totallogon+1
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
}

$userdata['user_lastvisit'] = $last_visit;

$sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '';
$sessiondata['userid'] = $user_id;
}

$userdata['session_id'] = $session_id;
$userdata['session_ip'] = $user_ip;
$userdata['session_user_id'] = $user_id;
$userdata['session_logged_in'] = $login;
$userdata['session_page'] = $page_id;
$userdata['session_start'] = $current_time;
$userdata['session_time'] = $current_time;

setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);

$SID = 'sid=' . $session_id;

return $userdata;
}

//
// Checks for a given user session, tidies session table and updates user
// sessions at each page refresh
//
function session_pagestart($user_ip, $thispage_id)
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Postby hsnshawn666 on Thu 12. May, 2005 13:41

i get this error if i want to install your script with easymod

Code: Select all

Kritischer Fehler

FINDE FEHLGESCHLAGEN: Konnte in Zeile [includes/sessions.php] nicht finden:

if (
{// (
$last_visit = (
$sql = "UPDATE " . USERS_TABLE . "
SET

MOD Skript Linie #509 :: FAQ :: Report


please help :(
hsnshawn666
Poster
Poster
 
Posts: 2
Joined: Thu 05. May, 2005 12:02

Next

Return to Last visit [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron