/[LeafOK_CVS]/lbbs/src/user_priv.c
ViewVC logotype

Diff of /lbbs/src/user_priv.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.9 by sysadm, Fri May 2 02:19:18 2025 UTC Revision 1.10 by sysadm, Sun May 4 14:54:55 2025 UTC
# Line 18  Line 18 
18  #include "user_priv.h"  #include "user_priv.h"
19  #include "bbs.h"  #include "bbs.h"
20  #include "common.h"  #include "common.h"
21    #include "database.h"
22  #include "log.h"  #include "log.h"
23  #include <stdio.h>  #include <stdio.h>
24  #include <mysql.h>  #include <mysql.h>
# Line 85  int load_priv(MYSQL *db, BBS_user_priv * Line 86  int load_priv(MYSQL *db, BBS_user_priv *
86  {  {
87          MYSQL_RES *rs;          MYSQL_RES *rs;
88          MYSQL_ROW row;          MYSQL_ROW row;
89          char sql[1024];          char sql[SQL_BUFFER_LEN];
         int i;  
90    
91          p_priv->uid = uid;          p_priv->uid = uid;
92          p_priv->level = (uid == 0 ? P_GUEST : P_USER);          p_priv->level = (uid == 0 ? P_GUEST : P_USER);
# Line 108  int load_priv(MYSQL *db, BBS_user_priv * Line 108  int load_priv(MYSQL *db, BBS_user_priv *
108                  log_error("Get user_list data failed\n");                  log_error("Get user_list data failed\n");
109                  return -1;                  return -1;
110          }          }
111          if (row = mysql_fetch_row(rs))          if ((row = mysql_fetch_row(rs)))
112          {          {
113                  p_priv->g_priv |= (atoi(row[0]) ? S_POST : 0);                  p_priv->g_priv |= (atoi(row[0]) ? S_POST : 0);
114                  p_priv->g_priv |= (atoi(row[1]) ? S_MSG : 0);                  p_priv->g_priv |= (atoi(row[1]) ? S_MSG : 0);
# Line 129  int load_priv(MYSQL *db, BBS_user_priv * Line 129  int load_priv(MYSQL *db, BBS_user_priv *
129                  log_error("Get admin_config data failed\n");                  log_error("Get admin_config data failed\n");
130                  return -1;                  return -1;
131          }          }
132          if (row = mysql_fetch_row(rs))          if ((row = mysql_fetch_row(rs)))
133          {          {
134                  p_priv->level |= (atoi(row[0]) ? P_ADMIN_M : P_ADMIN_S);                  p_priv->level |= (atoi(row[0]) ? P_ADMIN_M : P_ADMIN_S);
135                  p_priv->g_priv |= (atoi(row[0]) ? S_ALL : S_ADMIN);                  p_priv->g_priv |= (atoi(row[0]) ? S_ALL : S_ADMIN);
# Line 152  int load_priv(MYSQL *db, BBS_user_priv * Line 152  int load_priv(MYSQL *db, BBS_user_priv *
152                  log_error("Get section_master data failed\n");                  log_error("Get section_master data failed\n");
153                  return -1;                  return -1;
154          }          }
155          while (row = mysql_fetch_row(rs))          while ((row = mysql_fetch_row(rs)))
156          {          {
157                  p_priv->level |= (atoi(row[1]) ? P_MAN_M : P_MAN_S);                  p_priv->level |= (atoi(row[1]) ? P_MAN_M : P_MAN_S);
158                  setpriv(p_priv, atoi(row[0]), getpriv(p_priv, atoi(row[0])) | (atoi(row[1]) ? S_MAN_M : S_MAN_S));                  setpriv(p_priv, atoi(row[0]), getpriv(p_priv, atoi(row[0])) | (atoi(row[1]) ? S_MAN_M : S_MAN_S));
# Line 174  int load_priv(MYSQL *db, BBS_user_priv * Line 174  int load_priv(MYSQL *db, BBS_user_priv *
174                  log_error("Get section_config data failed\n");                  log_error("Get section_config data failed\n");
175                  return -1;                  return -1;
176          }          }
177          while (row = mysql_fetch_row(rs))          while ((row = mysql_fetch_row(rs)))
178          {          {
179                  int priv = getpriv(p_priv, atoi(row[0]));                  int priv = getpriv(p_priv, atoi(row[0]));
180                  if (p_priv->level < atoi(row[2]))                  if (p_priv->level < atoi(row[2]))
# Line 207  int load_priv(MYSQL *db, BBS_user_priv * Line 207  int load_priv(MYSQL *db, BBS_user_priv *
207                  log_error("Get ban_user_list data failed\n");                  log_error("Get ban_user_list data failed\n");
208                  return -1;                  return -1;
209          }          }
210          while (row = mysql_fetch_row(rs))          while ((row = mysql_fetch_row(rs)))
211          {          {
212                  setpriv(p_priv, atoi(row[0]),                  setpriv(p_priv, atoi(row[0]),
213                                  getpriv(p_priv, atoi(row[0])) & (~S_POST));                                  getpriv(p_priv, atoi(row[0])) & (~S_POST));


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1