/[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.74 by sysadm, Tue Dec 2 08:48:05 2025 UTC Revision 1.75 by sysadm, Fri Dec 19 06:16:27 2025 UTC
# Line 155  int check_user(const char *username, con Line 155  int check_user(const char *username, con
155          // Begin transaction          // Begin transaction
156          if (mysql_query(db, "SET autocommit=0") != 0)          if (mysql_query(db, "SET autocommit=0") != 0)
157          {          {
158                  log_error("SET autocommit=0 error: %s\n", mysql_error(db));                  log_error("SET autocommit=0 error: %s", mysql_error(db));
159                  ret = -1;                  ret = -1;
160                  goto cleanup;                  goto cleanup;
161          }          }
162    
163          if (mysql_query(db, "BEGIN") != 0)          if (mysql_query(db, "BEGIN") != 0)
164          {          {
165                  log_error("Begin transaction error: %s\n", mysql_error(db));                  log_error("Begin transaction error: %s", mysql_error(db));
166                  ret = -1;                  ret = -1;
167                  goto cleanup;                  goto cleanup;
168          }          }
# Line 179  int check_user(const char *username, con Line 179  int check_user(const char *username, con
179                           ip_mask(client_addr, 1, '%'));                           ip_mask(client_addr, 1, '%'));
180          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
181          {          {
182                  log_error("Query user_list error: %s\n", mysql_error(db));                  log_error("Query user_list error: %s", mysql_error(db));
183                  ret = -1;                  ret = -1;
184                  goto cleanup;                  goto cleanup;
185          }          }
186          if ((rs = mysql_store_result(db)) == NULL)          if ((rs = mysql_store_result(db)) == NULL)
187          {          {
188                  log_error("Get user_list data failed\n");                  log_error("Get user_list data failed");
189                  ret = -1;                  ret = -1;
190                  goto cleanup;                  goto cleanup;
191          }          }
# Line 212  int check_user(const char *username, con Line 212  int check_user(const char *username, con
212                           username);                           username);
213          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
214          {          {
215                  log_error("Query user_list error: %s\n", mysql_error(db));                  log_error("Query user_list error: %s", mysql_error(db));
216                  ret = -1;                  ret = -1;
217                  goto cleanup;                  goto cleanup;
218          }          }
219          if ((rs = mysql_store_result(db)) == NULL)          if ((rs = mysql_store_result(db)) == NULL)
220          {          {
221                  log_error("Get user_list data failed\n");                  log_error("Get user_list data failed");
222                  ret = -1;                  ret = -1;
223                  goto cleanup;                  goto cleanup;
224          }          }
# Line 240  int check_user(const char *username, con Line 240  int check_user(const char *username, con
240                           username, password);                           username, password);
241          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
242          {          {
243                  log_error("Query user_list error: %s\n", mysql_error(db));                  log_error("Query user_list error: %s", mysql_error(db));
244                  ret = -1;                  ret = -1;
245                  goto cleanup;                  goto cleanup;
246          }          }
247          if ((rs = mysql_store_result(db)) == NULL)          if ((rs = mysql_store_result(db)) == NULL)
248          {          {
249                  log_error("Get user_list data failed\n");                  log_error("Get user_list data failed");
250                  ret = -1;                  ret = -1;
251                  goto cleanup;                  goto cleanup;
252          }          }
# Line 267  int check_user(const char *username, con Line 267  int check_user(const char *username, con
267                                   BBS_uid, hostaddr_client);                                   BBS_uid, hostaddr_client);
268                  if (mysql_query(db, sql) != 0)                  if (mysql_query(db, sql) != 0)
269                  {                  {
270                          log_error("Insert into user_login_log error: %s\n", mysql_error(db));                          log_error("Insert into user_login_log error: %s", mysql_error(db));
271                          ret = -1;                          ret = -1;
272                          goto cleanup;                          goto cleanup;
273                  }                  }
# Line 275  int check_user(const char *username, con Line 275  int check_user(const char *username, con
275                  // Commit transaction                  // Commit transaction
276                  if (mysql_query(db, "COMMIT") != 0)                  if (mysql_query(db, "COMMIT") != 0)
277                  {                  {
278                          log_error("Commit transaction error: %s\n", mysql_error(db));                          log_error("Commit transaction error: %s", mysql_error(db));
279                          ret = -1;                          ret = -1;
280                          goto cleanup;                          goto cleanup;
281                  }                  }
# Line 298  int check_user(const char *username, con Line 298  int check_user(const char *username, con
298                                   username, password, hostaddr_client);                                   username, password, hostaddr_client);
299                  if (mysql_query(db, sql) != 0)                  if (mysql_query(db, sql) != 0)
300                  {                  {
301                          log_error("Insert into user_err_login_log error: %s\n", mysql_error(db));                          log_error("Insert into user_err_login_log error: %s", mysql_error(db));
302                          ret = -1;                          ret = -1;
303                          goto cleanup;                          goto cleanup;
304                  }                  }
# Line 306  int check_user(const char *username, con Line 306  int check_user(const char *username, con
306                  // Commit transaction                  // Commit transaction
307                  if (mysql_query(db, "COMMIT") != 0)                  if (mysql_query(db, "COMMIT") != 0)
308                  {                  {
309                          log_error("Commit transaction error: %s\n", mysql_error(db));                          log_error("Commit transaction error: %s", mysql_error(db));
310                          ret = -1;                          ret = -1;
311                          goto cleanup;                          goto cleanup;
312                  }                  }
# Line 319  int check_user(const char *username, con Line 319  int check_user(const char *username, con
319          // Set AUTOCOMMIT = 1          // Set AUTOCOMMIT = 1
320          if (mysql_query(db, "SET autocommit=1") != 0)          if (mysql_query(db, "SET autocommit=1") != 0)
321          {          {
322                  log_error("SET autocommit=1 error: %s\n", mysql_error(db));                  log_error("SET autocommit=1 error: %s", mysql_error(db));
323                  ret = -1;                  ret = -1;
324                  goto cleanup;                  goto cleanup;
325          }          }
# Line 359  int check_user(const char *username, con Line 359  int check_user(const char *username, con
359                           BBS_uid);                           BBS_uid);
360          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
361          {          {
362                  log_error("Update user_pubinfo error: %s\n", mysql_error(db));                  log_error("Update user_pubinfo error: %s", mysql_error(db));
363                  ret = -1;                  ret = -1;
364                  goto cleanup;                  goto cleanup;
365          }          }
# Line 381  int check_user(const char *username, con Line 381  int check_user(const char *username, con
381    
382                  if (setenv("TZ", user_tz_env, 1) == -1)                  if (setenv("TZ", user_tz_env, 1) == -1)
383                  {                  {
384                          log_error("setenv(TZ = %s) error %d\n", user_tz_env, errno);                          log_error("setenv(TZ = %s) error %d", user_tz_env, errno);
385                          return -3;                          return -3;
386                  }                  }
387    
# Line 410  int load_user_info(MYSQL *db, int BBS_ui Line 410  int load_user_info(MYSQL *db, int BBS_ui
410                           BBS_uid);                           BBS_uid);
411          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
412          {          {
413                  log_error("Query user_pubinfo error: %s\n", mysql_error(db));                  log_error("Query user_pubinfo error: %s", mysql_error(db));
414                  ret = -1;                  ret = -1;
415                  goto cleanup;                  goto cleanup;
416          }          }
417          if ((rs = mysql_store_result(db)) == NULL)          if ((rs = mysql_store_result(db)) == NULL)
418          {          {
419                  log_error("Get user_pubinfo data failed\n");                  log_error("Get user_pubinfo data failed");
420                  ret = -1;                  ret = -1;
421                  goto cleanup;                  goto cleanup;
422          }          }
# Line 515  int user_online_add(MYSQL *db) Line 515  int user_online_add(MYSQL *db)
515                           hostaddr_client);                           hostaddr_client);
516          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
517          {          {
518                  log_error("Add visit log error: %s\n", mysql_error(db));                  log_error("Add visit log error: %s", mysql_error(db));
519                  return -1;                  return -1;
520          }          }
521    
# Line 530  int user_online_add(MYSQL *db) Line 530  int user_online_add(MYSQL *db)
530                           getpid(), BBS_priv.uid, hostaddr_client);                           getpid(), BBS_priv.uid, hostaddr_client);
531          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
532          {          {
533                  log_error("Add user_online error: %s\n", mysql_error(db));                  log_error("Add user_online error: %s", mysql_error(db));
534                  return -3;                  return -3;
535          }          }
536    
# Line 546  int user_online_del(MYSQL *db) Line 546  int user_online_del(MYSQL *db)
546                           getpid());                           getpid());
547          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
548          {          {
549                  log_error("Delete user_online error: %s\n", mysql_error(db));                  log_error("Delete user_online error: %s", mysql_error(db));
550                  return -1;                  return -1;
551          }          }
552    
# Line 567  int user_online_exp(MYSQL *db) Line 567  int user_online_exp(MYSQL *db)
567                           BBS_priv.uid);                           BBS_priv.uid);
568          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
569          {          {
570                  log_error("Update user_pubinfo error: %s\n", mysql_error(db));                  log_error("Update user_pubinfo error: %s", mysql_error(db));
571                  return -1;                  return -1;
572          }          }
573    
# Line 596  int user_online_update(const char *actio Line 596  int user_online_update(const char *actio
596          db = db_open();          db = db_open();
597          if (db == NULL)          if (db == NULL)
598          {          {
599                  log_error("db_open() error: %s\n", mysql_error(db));                  log_error("db_open() error: %s", mysql_error(db));
600                  return -1;                  return -1;
601          }          }
602    
# Line 606  int user_online_update(const char *actio Line 606  int user_online_update(const char *actio
606                           BBS_current_action, getpid());                           BBS_current_action, getpid());
607          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
608          {          {
609                  log_error("Update user_online error: %s\n", mysql_error(db));                  log_error("Update user_online error: %s", mysql_error(db));
610                  return -2;                  return -2;
611          }          }
612    
# Line 667  int user_update_agreement(void) Line 667  int user_update_agreement(void)
667                                           BBS_priv.uid);                                           BBS_priv.uid);
668                          if (mysql_query(db, sql) != 0)                          if (mysql_query(db, sql) != 0)
669                          {                          {
670                                  log_error("Update user_pubinfo error: %s\n", mysql_error(db));                                  log_error("Update user_pubinfo error: %s", mysql_error(db));
671                                  ret = -1;                                  ret = -1;
672                                  goto cleanup;                                  goto cleanup;
673                          }                          }


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

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