/[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.97 by sysadm, Tue Nov 4 13:49:51 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                                    bbs_main.c  -  description  /*
3                                                           -------------------   * bbs_main
4          Copyright            : (C) 2004-2025 by Leaflet   *   - entry and major procedures of user interactive access
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com>
7     */
 /***************************************************************************  
  *                                                                         *  
  *   This program is free software; you can redistribute it and/or modify  *  
  *   it under the terms of the GNU General Public License as published by  *  
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
8    
9  #include "article_favor.h"  #include "article_favor.h"
10  #include "article_view_log.h"  #include "article_view_log.h"
# Line 28  Line 20 
20  #include "menu.h"  #include "menu.h"
21  #include "screen.h"  #include "screen.h"
22  #include "section_list.h"  #include "section_list.h"
23    #include "section_list_display.h"
24  #include "trie_dict.h"  #include "trie_dict.h"
25  #include "user_list.h"  #include "user_list.h"
26  #include "user_priv.h"  #include "user_priv.h"
# Line 48  int bbs_info() Line 41  int bbs_info()
41    
42  int bbs_welcome(void)  int bbs_welcome(void)
43  {  {
         char sql[SQL_BUFFER_LEN];  
   
44          int u_online = 0;          int u_online = 0;
45          int u_anonymous = 0;          int u_anonymous = 0;
46          int u_total = 0;          int u_total = 0;
47          int u_login_count = 0;          int u_login_count = 0;
48    
         MYSQL *db;  
         MYSQL_RES *rs;  
         MYSQL_ROW row;  
   
49          if (get_user_online_list_count(&u_online, &u_anonymous) < 0)          if (get_user_online_list_count(&u_online, &u_anonymous) < 0)
50          {          {
51                  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 64  int bbs_welcome(void)
64                  u_total = 0;                  u_total = 0;
65          }          }
66    
67          db = db_open();          if (get_user_login_count(&u_login_count) < 0)
         if (db == NULL)  
68          {          {
69                  return -1;                  log_error("get_user_login_count() error\n");
70                    u_login_count = 0;
71          }          }
72    
         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)  
         {  
                 log_error("Get user_login_log data failed\n");  
                 mysql_close(db);  
                 return -2;  
         }  
         if ((row = mysql_fetch_row(rs)))  
         {  
                 u_login_count = atoi(row[0]);  
         }  
         mysql_free_result(rs);  
   
         mysql_close(db);  
   
73          // Display logo          // Display logo
74          display_file(DATA_WELCOME, 2);          display_file(DATA_WELCOME, 2);
75    
# Line 343  int bbs_main() Line 309  int bbs_main()
309          }          }
310          log_common("User [%s] login\n", BBS_username);          log_common("User [%s] login\n", BBS_username);
311    
312            // Load section aid locations
313            if (section_aid_locations_load(BBS_priv.uid) < 0)
314            {
315                    log_error("article_view_log_load() error\n");
316                    goto cleanup;
317            }
318    
319          // Load article view log          // Load article view log
320          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)
321          {          {
# Line 375  int bbs_main() Line 348  int bbs_main()
348          // Logout          // Logout
349          bbs_logout();          bbs_logout();
350    
351            // Save section aid locations
352            if (section_aid_locations_save(BBS_priv.uid) < 0)
353            {
354                    log_error("article_view_log_save() error\n");
355            }
356    
357          // Save incremental article view log          // Save incremental article view log
358          if (article_view_log_save_inc(&BBS_article_view_log) < 0)          if (article_view_log_save_inc(&BBS_article_view_log) < 0)
359          {          {


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

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