| 40 |
{ |
{ |
| 41 |
struct tm tm_birth; |
struct tm tm_birth; |
| 42 |
|
|
| 43 |
localtime_r(&birthday, &tm_birth); |
gmtime_r(&birthday, &tm_birth); |
| 44 |
|
|
| 45 |
if (tm_birth.tm_mon < 1 || tm_birth.tm_mon > 12 || tm_birth.tm_mday < 1 || tm_birth.tm_mday > 31) |
if (tm_birth.tm_mday < astro_dates[tm_birth.tm_mon]) |
| 46 |
{ |
{ |
| 47 |
return astro_names[0]; |
return astro_names[tm_birth.tm_mon]; |
| 48 |
} |
} |
| 49 |
|
|
| 50 |
if (tm_birth.tm_mday < astro_dates[tm_birth.tm_mon - 1]) |
return astro_names[tm_birth.tm_mon + 1]; |
|
{ |
|
|
return astro_names[tm_birth.tm_mon - 1]; |
|
|
} |
|
|
|
|
|
return astro_names[tm_birth.tm_mon]; |
|
| 51 |
} |
} |
| 52 |
|
|
| 53 |
static const int user_level_points[] = { |
static const int user_level_points[] = { |
| 139 |
char str_last_logout_dt[LAST_LOGIN_DT_MAX_LEN + 1]; |
char str_last_logout_dt[LAST_LOGIN_DT_MAX_LEN + 1]; |
| 140 |
char login_ip[IP_ADDR_LEN]; |
char login_ip[IP_ADDR_LEN]; |
| 141 |
int ip_mask_level; |
int ip_mask_level; |
| 142 |
|
const char *p_action_title; |
| 143 |
char action_str[LINE_BUFFER_LEN]; |
char action_str[LINE_BUFFER_LEN]; |
| 144 |
const char *user_level_name; |
const char *user_level_name; |
| 145 |
char intro_f[BBS_user_intro_max_len]; |
char intro_f[BBS_user_intro_max_len]; |
| 200 |
p = action_str; |
p = action_str; |
| 201 |
for (i = 0; i < session_cnt; i++) |
for (i = 0; i < session_cnt; i++) |
| 202 |
{ |
{ |
| 203 |
if (p + strlen(sessions[i].current_action_title) + 4 >= action_str + sizeof(action_str)) // buffer overflow |
p_action_title = (sessions[i].current_action_title != NULL |
| 204 |
|
? sessions[i].current_action_title |
| 205 |
|
: sessions[i].current_action); |
| 206 |
|
|
| 207 |
|
if (p + strlen(p_action_title) + 4 >= action_str + sizeof(action_str)) // buffer overflow |
| 208 |
{ |
{ |
| 209 |
log_error("action_str of user(uid=%d) truncated at i=%d\n", p_user_info->uid, i); |
log_error("action_str of user(uid=%d) truncated at i=%d\n", p_user_info->uid, i); |
| 210 |
break; |
break; |
| 211 |
} |
} |
| 212 |
*p++ = '['; |
*p++ = '['; |
| 213 |
for (q = sessions[i].current_action_title; *q != '\0';) |
for (q = p_action_title; *q != '\0';) |
| 214 |
{ |
{ |
| 215 |
*p++ = *q++; |
*p++ = *q++; |
| 216 |
} |
} |