users_mod format + last_login [message #33005] |
Tue, 08 August 2006 19:55 |
defa
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 |
Ilia
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 #33011 is a reply to message #33010] |
Tue, 08 August 2006 20:49 |
Ilia
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 |
defa
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 #33015 is a reply to message #33013] |
Tue, 08 August 2006 21:07 |
Ilia
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
|
|
|
|
|
|
|
|