| 731 |
memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); |
memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); |
| 732 |
len += (line_offsets[i + 1] - line_offsets[i]); |
len += (line_offsets[i + 1] - line_offsets[i]); |
| 733 |
} |
} |
| 734 |
|
if (content[len - 1] != '\n') // Appennd \n if not exist |
| 735 |
|
{ |
| 736 |
|
content[len] = '\n'; |
| 737 |
|
len++; |
| 738 |
|
} |
| 739 |
content[len] = '\0'; |
content[len] = '\0'; |
| 740 |
|
|
| 741 |
free(content_f); |
free(content_f); |
| 975 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |
| 976 |
"INSERT INTO bbs(SID, TID, UID, username, nickname, title, CID, transship, " |
"INSERT INTO bbs(SID, TID, UID, username, nickname, title, CID, transship, " |
| 977 |
"sub_dt, sub_ip, reply_note, exp, last_reply_dt, icon, length) " |
"sub_dt, sub_ip, reply_note, exp, last_reply_dt, icon, length) " |
| 978 |
"VALUES(%d, 0, %d, '%s', '%s', '%s', %d, 0, NOW(), '%s', 1, %d, NOW(), 1, %ld)", |
"VALUES(%d, %d, %d, '%s', '%s', '%s', %d, 0, NOW(), '%s', 1, %d, NOW(), 1, %ld)", |
| 979 |
p_section->sid, BBS_priv.uid, BBS_username, nickname_f, title_f, |
p_section->sid, p_article->aid, BBS_priv.uid, BBS_username, nickname_f, title_f, |
| 980 |
p_article_new->cid, hostaddr_client, BBS_user_exp, len_content); |
p_article_new->cid, hostaddr_client, BBS_user_exp, len_content); |
| 981 |
|
|
| 982 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |