diff options
| author | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-11 14:35:53 +0100 |
|---|---|---|
| committer | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-11 14:35:53 +0100 |
| commit | 2bc063ccd25092e1b4251136573adaeed8e55937 (patch) | |
| tree | c71bf3109163cf502ee9daeb07f8450c32569771 /database/sqlite | |
| parent | 5875ca215d75d2a5e2c3ca147b19a5197bcb2dbf (diff) | |
| download | eurephia-2bc063ccd25092e1b4251136573adaeed8e55937.tar.gz eurephia-2bc063ccd25092e1b4251136573adaeed8e55937.tar.xz eurephia-2bc063ccd25092e1b4251136573adaeed8e55937.zip | |
Corrected a lot of small errors, setting wrong flag and SQL mistakes
Diffstat (limited to 'database/sqlite')
| -rw-r--r-- | database/sqlite/administration.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/database/sqlite/administration.c b/database/sqlite/administration.c index 6eb1205..3927192 100644 --- a/database/sqlite/administration.c +++ b/database/sqlite/administration.c @@ -423,10 +423,15 @@ int eDBadminGetUserInfo(eurephiaCTX *ctx, int getInfo, eurephiaUSERINFO *user) { " (bl.username IS NOT NULL), opensess, logincount" " FROM openvpn_users u" " LEFT JOIN openvpn_blacklist bl USING(username)" - " LEFT JOIN (SELECT uid, count(*) AS logincount FROM openvpn_lastlog) lc" + " LEFT JOIN (SELECT uid, count(*) AS logincount " + " FROM openvpn_lastlog" + " GROUP BY uid) lc" " ON (lc.uid = u.uid)" - " LEFT JOIN (SELECT uid, count(*)>0 AS opensess FROM openvpn_lastlog) os" - " ON (os.uid = u.uid) ", + " LEFT JOIN (SELECT uid, count(*) > 0 AS opensess" + " FROM openvpn_lastlog" + " WHERE sessionstatus = 2" + " GROUP BY uid) os" + " ON (os.uid = u.uid)", NULL, uinfo_map); if( uinf == NULL ) { @@ -447,7 +452,7 @@ int eDBadminGetUserInfo(eurephiaCTX *ctx, int getInfo, eurephiaUSERINFO *user) { user->account_flags = ((sqlite_get_value(uinf, 0, 3) == NULL) ? ACCFLAG_NEVERUSED : 0); user->account_flags|= ((sqlite_get_value(uinf, 0, 2) != NULL) ? ACCFLAG_DEACTIVATED : 0); user->account_flags|= ((atoi(sqlite_get_value(uinf, 0, 5)) == 1) ? ACCFLAG_BLACKLISTED : 0); - user->account_flags|= ((atoi_nullsafe(sqlite_get_value(uinf, 0, 6))==1) ? ACCFLAG_BLACKLISTED : 0); + user->account_flags|= ((atoi_nullsafe(sqlite_get_value(uinf, 0, 6))==1) ? ACCFLAG_OPENSESSION : 0); if( (getInfo & USERINFO_user) == USERINFO_user ) { free_nullsafe(user->password); |
