/[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.38 by sysadm, Wed Jun 4 13:42:53 2025 UTC Revision 1.40 by sysadm, Sat Jun 7 06:16:25 2025 UTC
# Line 86  int bbs_login(MYSQL *db) Line 86  int bbs_login(MYSQL *db)
86          }          }
87    
88          log_common("User \"%s\"(%ld) login from %s:%d\n",          log_common("User \"%s\"(%ld) login from %s:%d\n",
89                          BBS_username, BBS_priv.uid, hostaddr_client, port_client);                             BBS_username, BBS_priv.uid, hostaddr_client, port_client);
90    
91          return 0;          return 0;
92  }  }
# Line 97  int check_user(MYSQL *db, const char *us Line 97  int check_user(MYSQL *db, const char *us
97          MYSQL_ROW row;          MYSQL_ROW row;
98          char sql[SQL_BUFFER_LEN];          char sql[SQL_BUFFER_LEN];
99          int ret;          int ret;
100          long BBS_uid = 0;          int BBS_uid = 0;
101          char client_addr[IP_ADDR_LEN];          char client_addr[IP_ADDR_LEN];
102          int i;          int i;
103          int ok = 1;          int ok = 1;
# Line 222  int check_user(MYSQL *db, const char *us Line 222  int check_user(MYSQL *db, const char *us
222          }          }
223          if ((row = mysql_fetch_row(rs)))          if ((row = mysql_fetch_row(rs)))
224          {          {
225                  BBS_uid = atol(row[0]);                  BBS_uid = atoi(row[0]);
226                  strncpy(BBS_username, row[1], sizeof(BBS_username) - 1);                  strncpy(BBS_username, row[1], sizeof(BBS_username) - 1);
227                  BBS_username[sizeof(BBS_username) - 1] = '\0';                  BBS_username[sizeof(BBS_username) - 1] = '\0';
228                  int p_login = atoi(row[2]);                  int p_login = atoi(row[2]);
# Line 232  int check_user(MYSQL *db, const char *us Line 232  int check_user(MYSQL *db, const char *us
232                  // Add user login log                  // Add user login log
233                  snprintf(sql, sizeof(sql),                  snprintf(sql, sizeof(sql),
234                                   "INSERT INTO user_login_log(UID, login_dt, login_ip) "                                   "INSERT INTO user_login_log(UID, login_dt, login_ip) "
235                                   "VALUES(%ld, NOW(), '%s')",                                   "VALUES(%d, NOW(), '%s')",
236                                   BBS_uid, hostaddr_client);                                   BBS_uid, hostaddr_client);
237                  if (mysql_query(db, sql) != 0)                  if (mysql_query(db, sql) != 0)
238                  {                  {
# Line 308  int check_user(MYSQL *db, const char *us Line 308  int check_user(MYSQL *db, const char *us
308    
309          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
310                           "UPDATE user_pubinfo SET visit_count = visit_count + 1, "                           "UPDATE user_pubinfo SET visit_count = visit_count + 1, "
311                           "last_login_dt = NOW() WHERE UID = %ld",                           "last_login_dt = NOW() WHERE UID = %d",
312                           BBS_uid);                           BBS_uid);
313          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
314          {          {
# Line 342  int check_user(MYSQL *db, const char *us Line 342  int check_user(MYSQL *db, const char *us
342          return 0;          return 0;
343  }  }
344    
345  int load_user_info(MYSQL *db, long int BBS_uid)  int load_user_info(MYSQL *db, int BBS_uid)
346  {  {
347          MYSQL_RES *rs;          MYSQL_RES *rs;
348          MYSQL_ROW row;          MYSQL_ROW row;
# Line 352  int load_user_info(MYSQL *db, long int B Line 352  int load_user_info(MYSQL *db, long int B
352    
353          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
354                           "SELECT life, UNIX_TIMESTAMP(last_login_dt), user_timezone "                           "SELECT life, UNIX_TIMESTAMP(last_login_dt), user_timezone "
355                           "FROM user_pubinfo WHERE UID = %ld",                           "FROM user_pubinfo WHERE UID = %d",
356                           BBS_uid);                           BBS_uid);
357          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
358          {          {
# Line 424  int user_online_add(MYSQL *db) Line 424  int user_online_add(MYSQL *db)
424    
425          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
426                           "INSERT INTO user_online(SID, UID, ip, login_tm, last_tm) "                           "INSERT INTO user_online(SID, UID, ip, login_tm, last_tm) "
427                           "VALUES('Telnet_Process_%d', %ld, '%s', NOW(), NOW())",                           "VALUES('Telnet_Process_%d', %d, '%s', NOW(), NOW())",
428                           getpid(), BBS_priv.uid, hostaddr_client);                           getpid(), BBS_priv.uid, hostaddr_client);
429          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
430          {          {


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

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