| 114 |
// Verify format |
// Verify format |
| 115 |
for (i = 0; ok && username[i] != '\0'; i++) |
for (i = 0; ok && username[i] != '\0'; i++) |
| 116 |
{ |
{ |
| 117 |
if (!(isalpha(username[i]) || (i > 0 && isdigit(username[i])))) |
if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_')))) |
| 118 |
{ |
{ |
| 119 |
ok = 0; |
ok = 0; |
| 120 |
} |
} |
| 121 |
} |
} |
| 122 |
if (ok && (i < 3 || i > 12)) |
if (ok && (i < 5 || i > BBS_username_max_len)) |
| 123 |
{ |
{ |
| 124 |
ok = 0; |
ok = 0; |
| 125 |
} |
} |
| 130 |
ok = 0; |
ok = 0; |
| 131 |
} |
} |
| 132 |
} |
} |
| 133 |
if (ok && (i < 5 || i > 12)) |
if (ok && (i < 5 || i > BBS_password_max_len)) |
| 134 |
{ |
{ |
| 135 |
ok = 0; |
ok = 0; |
| 136 |
} |
} |
| 503 |
} |
} |
| 504 |
|
|
| 505 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |
| 506 |
"INSERT INTO user_online(SID, UID, ip, login_tm, last_tm) " |
"INSERT INTO user_online(SID, UID, ip, current_action, login_tm, last_tm) " |
| 507 |
"VALUES('Telnet_Process_%d', %d, '%s', NOW(), NOW())", |
"VALUES('Telnet_Process_%d', %d, '%s', 'LOGIN', NOW(), NOW())", |
| 508 |
getpid(), BBS_priv.uid, hostaddr_client); |
getpid(), BBS_priv.uid, hostaddr_client); |
| 509 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 510 |
{ |
{ |
| 579 |
} |
} |
| 580 |
|
|
| 581 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |
| 582 |
"UPDATE user_online SET current_action = '%s', last_tm=NOW() " |
"UPDATE user_online SET current_action = '%s', last_tm = NOW() " |
| 583 |
"WHERE SID = 'Telnet_Process_%d'", |
"WHERE SID = 'Telnet_Process_%d'", |
| 584 |
BBS_current_action, getpid()); |
BBS_current_action, getpid()); |
| 585 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |