| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
} |
} |
| 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 |
|
|
| 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 |
} |
} |
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
} |
} |