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

Diff of /lbbs/src/login.c

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

Revision 1.5 by sysadm, Sat Oct 23 18:41:41 2004 UTC Revision 1.7 by sysadm, Sat Mar 19 14:44:21 2005 UTC
# Line 18  Line 18 
18  #include "bbs.h"  #include "bbs.h"
19  #include "common.h"  #include "common.h"
20  #include "io.h"  #include "io.h"
21    #include "database.h"
22  #include <mysql.h>  #include <mysql.h>
23  #include <regex.h>  #include <regex.h>
24    
# Line 112  check_user (char *username, char *passwo Line 113  check_user (char *username, char *passwo
113      }      }
114    
115    sprintf (sql,    sprintf (sql,
116             "select UID,p_login from user_list where username='%s' "             "select UID,username,p_login from user_list where username='%s' "
117             "and (password=MD5('%s') or password=PASSWORD('%s')) and "             "and (password=MD5('%s') or password=PASSWORD('%s')) and "
118             "enable", username, password, password);             "enable", username, password, password);
119    if (mysql_query (db, sql) != 0)    if (mysql_query (db, sql) != 0)
# Line 128  check_user (char *username, char *passwo Line 129  check_user (char *username, char *passwo
129    if (row = mysql_fetch_row (rs))    if (row = mysql_fetch_row (rs))
130      {      {
131        BBS_uid = atol (row[0]);        BBS_uid = atol (row[0]);
132        if (atoi (row[1]) == 0)        strcpy (BBS_username, row[1]);
133          if (atoi (row[2]) == 0)
134          {          {
135            mysql_free_result (rs);            mysql_free_result (rs);
136            mysql_close (db);            mysql_close (db);
# Line 247  load_user_info (MYSQL * db, long int BBS Line 249  load_user_info (MYSQL * db, long int BBS
249      {      {
250        BBS_auth_uid = atol (row[0]);        BBS_auth_uid = atol (row[0]);
251      }      }
252      else
253        {
254          BBS_auth_uid = 0;
255        }
256    mysql_free_result (rs);    mysql_free_result (rs);
257    
258    sprintf (sql,    sprintf (sql,
# Line 290  load_guest_info (MYSQL * db, long int BB Line 296  load_guest_info (MYSQL * db, long int BB
296        return -1;        return -1;
297      }      }
298    
299      strcpy (BBS_username, "guest");
300    
301    load_priv (db, &BBS_priv, 0, 0, S_NONE);    load_priv (db, &BBS_priv, 0, 0, S_NONE);
302    
303    BBS_last_access_tm = BBS_login_tm = time (0);    BBS_last_access_tm = BBS_login_tm = time (0);


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

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