FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » users_mod format + last_login
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
users_mod format + last_login [message #33005] Tue, 08 August 2006 19:55 Go to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
Hi Ilja, hi folks,

Today I tried to ban inactive users from our forum with about 600 users. At first I had the problem to find out the format of the users_mod DB entry - then I found out that the ban bit is the last bit of the 2nd byte of an 4 byte value (0x00 01 00 00). my question is - is this assumption correct? And the second question: can anyone document the exact meaning of this bitmask here?

Afterwards I chose the last_login value to check which users didn't login for the last two month. The sql query gave me 219 inactive users.

I used the following statement:

select id,login from fud26_users where date_sub(curdate(), interval 62 day) >= last_login;


As I later found out - the result was wrong - some users, who login regulary had the value 0 stored in the DB. So either I missunderstood the meaning of the last_login value, or there is a bug preventing that the time stamp is stored in the DB.

Afterwards I used this statment:

select id,login from fud26_users where date_sub(curdate(), interval 62 day) >= last_visit;


using the last_visit value, which returned me only 37 users. - so is there a bug? or what is the last_login timestamp is used for?

thanks a lot
bye
defa
Re: users_mod format + last_login [message #33007 is a reply to message #33005] Tue, 08 August 2006 20:23 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
last_visit is a unix timestamp field you need to use UNIX_TIMESTAMP() mysql function and subtract 86400 for each day you want to go back.

The bit masks are already documented, simply look inside the fud_users.tbl file.


FUDforum Core Developer
Re: users_mod format + last_login [message #33010 is a reply to message #33007] Tue, 08 August 2006 20:43 Go to previous messageGo to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
OK I checked the my SQL syntax and corrected it. But the problem that severeal users have 0 values for last_login although they have correct last_visit value remains.

bye
defa
Re: users_mod format + last_login [message #33011 is a reply to message #33010] Tue, 08 August 2006 20:49 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
It is possible to have this value at 0, in instances when the user never logged out of the forum after initial registration. The value of this field is ONLY updated when login action is performed.

FUDforum Core Developer
Re: users_mod format + last_login [message #33013 is a reply to message #33011] Tue, 08 August 2006 21:00 Go to previous messageGo to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
Yes I got that - but I talked to at least 3 users who loged in yesterday (which last_visit says) although the last_login value was 0.

I looked at the code - and found no reason why that issue occurs, but I checked that very intensively - two of the users logged in, and wrote me a PM to make sure they really logged in, afterwards I checked there DB entries and the last_login value was 0.

bye
defa

[Updated on: Tue, 08 August 2006 21:04]

Report message to a moderator

Re: users_mod format + last_login [message #33014 is a reply to message #33013] Tue, 08 August 2006 21:07 Go to previous messageGo to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
I made another test to make sure I am not absolutely wrong.

We have a absolute ammount of 540 users.

select id from fud26_users where last_visit = 0 AND last_login = 0;

This return 34 user who have _never_ logged in.

select id from fud26_users where last_visit != 0 AND last_login = 0;

This return 184 user who have a last_login value of 0 although they visited the forum at least once. For my basic understanding the last SQL Query shouldn't give any results.

bye
defa
Re: users_mod format + last_login [message #33015 is a reply to message #33013] Tue, 08 August 2006 21:07 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Don't know what to tell you, my quick tour through the code tells me that the value is only changed in 2 places and both of them in login.php.t and each time they are assigned a value of the __request_timestamp__ constant, which is basically time().

FUDforum Core Developer
Re: users_mod format + last_login [message #33016 is a reply to message #33015] Tue, 08 August 2006 21:10 Go to previous messageGo to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
Indeed - I also saw that and can't see any fault, but the test of the DB tells me that something strange is happening there.

bye
defa
Re: users_mod format + last_login [message #33017 is a reply to message #33016] Tue, 08 August 2006 21:13 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Can you ask those users to logout and then login to see if the values of those fields get updated.

FUDforum Core Developer
Re: users_mod format + last_login [message #33020 is a reply to message #33017] Tue, 08 August 2006 21:45 Go to previous messageGo to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
I'll try to work this out with a user tomorrow and post the results here. (ist 23:44 here)

bye
defa
Re: users_mod format + last_login [message #33039 is a reply to message #33020] Wed, 09 August 2006 14:28 Go to previous messageGo to next message
defa is currently offline  defa   Germany
Messages: 14
Registered: July 2005
Karma: 0
Junior Member
I cheked everything, and I found out what causes my problem - but I am not sure now wether it's a bug or a feature.

The last_login value is only set when an unsuccsesful login attempt is detected, not when the login was successful- so it is never set if a user never makes an mistake. The varname just irritated me.

So - I wonder if this behaviour is as it should be. I also can use the last_visit value to achieve the effect I want to achieve.

bye
defa
Re: users_mod format + last_login [message #33043 is a reply to message #33039] Wed, 09 August 2006 14:54 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Originally this value was added to prevent login attempt hammering, so it was not updated on successful logins. But I see no reason not to update on successful login as well, so patch to address this was applied to CVS. You can find it here:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=11544


FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PATH_INFO templates stay on home page
Next Topic: Lock / Unlock and file permissions
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 11:21:18 GMT 2024

Total time taken to generate the page: 0.02517 seconds