/[LeafOK_CVS]/lbbs/src/login.c
ViewVC logotype

Diff of /lbbs/src/login.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.55 by sysadm, Wed Oct 1 02:48:54 2025 UTC Revision 1.58 by sysadm, Thu Oct 16 05:26:55 2025 UTC
# Line 30  Line 30 
30  #include <regex.h>  #include <regex.h>
31  #include <unistd.h>  #include <unistd.h>
32  #include <mysql/mysql.h>  #include <mysql/mysql.h>
33    #include <sys/param.h>
34    
35  int bbs_login(void)  int bbs_login(void)
36  {  {
# Line 518  int user_online_del(MYSQL *db) Line 519  int user_online_del(MYSQL *db)
519                  return -1;                  return -1;
520          }          }
521    
522            return 0;
523    }
524    
525    int user_online_exp(MYSQL *db)
526    {
527            char sql[SQL_BUFFER_LEN];
528    
529            // +1 exp for every 5 minutes online since last logout
530            // but at most 24 hours worth of exp can be gained in Telnet session
531            snprintf(sql, sizeof(sql),
532                            "UPDATE user_pubinfo SET exp = exp + "
533                            "FLOOR((UNIX_TIMESTAMP() - GREATEST(IF(last_logout_dt IS NULL, 0, UNIX_TIMESTAMP(last_logout_dt)), %ld)) / 60 / 5), "
534                            "last_logout_dt = NOW() "
535                            "WHERE UID = %d",
536                            MAX(BBS_login_tm, time(NULL) - 60 * 60 * 24),
537                            BBS_priv.uid);
538            if (mysql_query(db, sql) != 0)
539            {
540                    log_error("Update user_pubinfo error: %s\n", mysql_error(db));
541                    return -1;
542            }
543    
544          return 0;          return 0;
545  }  }
546    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1