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

Diff of /lbbs/src/bbs_main.c

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

Revision 1.94 by sysadm, Sat Nov 1 10:35:42 2025 UTC Revision 1.96 by sysadm, Sun Nov 2 08:13:50 2025 UTC
# Line 28  Line 28 
28  #include "menu.h"  #include "menu.h"
29  #include "screen.h"  #include "screen.h"
30  #include "section_list.h"  #include "section_list.h"
31    #include "section_list_display.h"
32  #include "trie_dict.h"  #include "trie_dict.h"
33  #include "user_list.h"  #include "user_list.h"
34  #include "user_priv.h"  #include "user_priv.h"
# Line 48  int bbs_info() Line 49  int bbs_info()
49    
50  int bbs_welcome(void)  int bbs_welcome(void)
51  {  {
         char sql[SQL_BUFFER_LEN];  
   
52          int u_online = 0;          int u_online = 0;
53          int u_anonymous = 0;          int u_anonymous = 0;
54          int u_total = 0;          int u_total = 0;
55          int u_login_count = 0;          int u_login_count = 0;
56    
         MYSQL *db;  
         MYSQL_RES *rs;  
         MYSQL_ROW row;  
   
57          if (get_user_online_list_count(&u_online, &u_anonymous) < 0)          if (get_user_online_list_count(&u_online, &u_anonymous) < 0)
58          {          {
59                  log_error("get_user_online_list_count() error\n");                  log_error("get_user_online_list_count() error\n");
# Line 77  int bbs_welcome(void) Line 72  int bbs_welcome(void)
72                  u_total = 0;                  u_total = 0;
73          }          }
74    
75          db = db_open();          if (get_user_login_count(&u_login_count) < 0)
         if (db == NULL)  
         {  
                 return -1;  
         }  
   
         snprintf(sql, sizeof(sql), "SELECT ID FROM user_login_log ORDER BY ID LIMIT 1");  
         if (mysql_query(db, sql) != 0)  
         {  
                 log_error("Query user_login_log error: %s\n", mysql_error(db));  
                 mysql_close(db);  
                 return -2;  
         }  
         if ((rs = mysql_store_result(db)) == NULL)  
76          {          {
77                  log_error("Get user_login_log data failed\n");                  log_error("get_user_login_count() error\n");
78                  mysql_close(db);                  u_login_count = 0;
                 return -2;  
         }  
         if ((row = mysql_fetch_row(rs)))  
         {  
                 u_login_count = atoi(row[0]);  
79          }          }
         mysql_free_result(rs);  
   
         mysql_close(db);  
80    
81          // Display logo          // Display logo
82          display_file(DATA_WELCOME, 2);          display_file(DATA_WELCOME, 2);
# Line 343  int bbs_main() Line 317  int bbs_main()
317          }          }
318          log_common("User [%s] login\n", BBS_username);          log_common("User [%s] login\n", BBS_username);
319    
320            // Load section aid locations
321            if (section_aid_locations_load(BBS_priv.uid) < 0)
322            {
323                    log_error("article_view_log_load() error\n");
324                    goto cleanup;
325            }
326            
327          // Load article view log          // Load article view log
328          if (article_view_log_load(BBS_priv.uid, &BBS_article_view_log, 0) < 0)          if (article_view_log_load(BBS_priv.uid, &BBS_article_view_log, 0) < 0)
329          {          {
# Line 375  int bbs_main() Line 356  int bbs_main()
356          // Logout          // Logout
357          bbs_logout();          bbs_logout();
358    
359            // Save section aid locations
360            if (section_aid_locations_save(BBS_priv.uid) < 0)
361            {
362                    log_error("article_view_log_save() error\n");
363            }
364    
365          // Save incremental article view log          // Save incremental article view log
366          if (article_view_log_save_inc(&BBS_article_view_log) < 0)          if (article_view_log_save_inc(&BBS_article_view_log) < 0)
367          {          {


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

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