| 3 |
* user_priv |
* user_priv |
| 4 |
* - basic operations of user privilege |
* - basic operations of user privilege |
| 5 |
* |
* |
| 6 |
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com> |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
|
#ifdef HAVE_CONFIG_H |
| 10 |
|
#include "config.h" |
| 11 |
|
#endif |
| 12 |
|
|
| 13 |
#include "bbs.h" |
#include "bbs.h" |
| 14 |
#include "common.h" |
#include "common.h" |
| 15 |
#include "database.h" |
#include "database.h" |
| 17 |
#include "user_priv.h" |
#include "user_priv.h" |
| 18 |
#include <stdio.h> |
#include <stdio.h> |
| 19 |
#include <stdlib.h> |
#include <stdlib.h> |
| 20 |
#include <mysql/mysql.h> |
#include <mysql.h> |
| 21 |
|
|
| 22 |
BBS_user_priv BBS_priv; |
BBS_user_priv BBS_priv; |
| 23 |
|
|
| 126 |
uid); |
uid); |
| 127 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 128 |
{ |
{ |
| 129 |
log_error("Query user_list error: %s\n", mysql_error(db)); |
log_error("Query user_list error: %s", mysql_error(db)); |
| 130 |
return -1; |
return -1; |
| 131 |
} |
} |
| 132 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 133 |
{ |
{ |
| 134 |
log_error("Get user_list data failed\n"); |
log_error("Get user_list data failed"); |
| 135 |
return -1; |
return -1; |
| 136 |
} |
} |
| 137 |
if ((row = mysql_fetch_row(rs))) |
if ((row = mysql_fetch_row(rs))) |
| 148 |
uid); |
uid); |
| 149 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 150 |
{ |
{ |
| 151 |
log_error("Query admin_config error: %s\n", mysql_error(db)); |
log_error("Query admin_config error: %s", mysql_error(db)); |
| 152 |
return -1; |
return -1; |
| 153 |
} |
} |
| 154 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 155 |
{ |
{ |
| 156 |
log_error("Get admin_config data failed\n"); |
log_error("Get admin_config data failed"); |
| 157 |
return -1; |
return -1; |
| 158 |
} |
} |
| 159 |
if ((row = mysql_fetch_row(rs))) |
if ((row = mysql_fetch_row(rs))) |
| 172 |
uid); |
uid); |
| 173 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 174 |
{ |
{ |
| 175 |
log_error("Query section_master error: %s\n", mysql_error(db)); |
log_error("Query section_master error: %s", mysql_error(db)); |
| 176 |
return -1; |
return -1; |
| 177 |
} |
} |
| 178 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 179 |
{ |
{ |
| 180 |
log_error("Get section_master data failed\n"); |
log_error("Get section_master data failed"); |
| 181 |
return -1; |
return -1; |
| 182 |
} |
} |
| 183 |
while ((row = mysql_fetch_row(rs))) |
while ((row = mysql_fetch_row(rs))) |
| 196 |
"ORDER BY SID"); |
"ORDER BY SID"); |
| 197 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 198 |
{ |
{ |
| 199 |
log_error("Query section_config error: %s\n", mysql_error(db)); |
log_error("Query section_config error: %s", mysql_error(db)); |
| 200 |
return -1; |
return -1; |
| 201 |
} |
} |
| 202 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 203 |
{ |
{ |
| 204 |
log_error("Get section_config data failed\n"); |
log_error("Get section_config data failed"); |
| 205 |
return -1; |
return -1; |
| 206 |
} |
} |
| 207 |
while ((row = mysql_fetch_row(rs))) |
while ((row = mysql_fetch_row(rs))) |
| 230 |
uid); |
uid); |
| 231 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 232 |
{ |
{ |
| 233 |
log_error("Query ban_user_list error: %s\n", mysql_error(db)); |
log_error("Query ban_user_list error: %s", mysql_error(db)); |
| 234 |
return -1; |
return -1; |
| 235 |
} |
} |
| 236 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 237 |
{ |
{ |
| 238 |
log_error("Get ban_user_list data failed\n"); |
log_error("Get ban_user_list data failed"); |
| 239 |
return -1; |
return -1; |
| 240 |
} |
} |
| 241 |
while ((row = mysql_fetch_row(rs))) |
while ((row = mysql_fetch_row(rs))) |
| 251 |
uid); |
uid); |
| 252 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 253 |
{ |
{ |
| 254 |
log_error("Query section_favorite error: %s\n", mysql_error(db)); |
log_error("Query section_favorite error: %s", mysql_error(db)); |
| 255 |
return -1; |
return -1; |
| 256 |
} |
} |
| 257 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 258 |
{ |
{ |
| 259 |
log_error("Get section_favorite data failed\n"); |
log_error("Get section_favorite data failed"); |
| 260 |
return -1; |
return -1; |
| 261 |
} |
} |
| 262 |
while ((row = mysql_fetch_row(rs))) |
while ((row = mysql_fetch_row(rs))) |