/[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.22 by sysadm, Tue May 6 13:28:38 2025 UTC Revision 1.24 by sysadm, Sat May 10 11:09:02 2025 UTC
# Line 43  int bbs_login() Line 43  int bbs_login()
43          int count = 0;          int count = 0;
44          int ok = 0;          int ok = 0;
45    
46          // Input username          for (; !ok && count < 3; count++)
         while (!ok)  
47          {          {
48                  prints("\033[1;33mΗλΚδΘλΥΚΊΕ\033[m(ΚΤΣΓΗλΚδΘλ `\033[1;36mguest\033[m', "                  prints("\033[1;33mΗλΚδΘλΥΚΊΕ\033[m(ΚΤΣΓΗλΚδΘλ`\033[1;36mguest\033[m', "
49                             "ΧΆ²αΗλΚδΘλ`\033[1;31mnew\033[m'): ");                             "ΧΆ²αΗλΚδΘλ`\033[1;31mnew\033[m'): ");
50                  iflush();                  iflush();
51    
52                  str_input(username, sizeof(username), DOECHO);                  if (str_input(username, sizeof(username), DOECHO) < 0)
53                  count++;                  {
54                            continue;
55                    }
56    
57                  if (strcmp(username, "guest") == 0)                  if (strcmp(username, "guest") == 0)
58                  {                  {
# Line 82  int bbs_login() Line 83  int bbs_login()
83    
84                  if (username[0] != '\0')                  if (username[0] != '\0')
85                  {                  {
                         // Input password  
86                          prints("\033[1;37mΗλΚδΘλΓάΒλ\033[m: ");                          prints("\033[1;37mΗλΚδΘλΓάΒλ\033[m: ");
87                          iflush();                          iflush();
88    
89                          str_input(password, sizeof(password), NOECHO);                          if (str_input(password, sizeof(password), NOECHO) < 0)
90                            {
91                                    continue;
92                            }
93    
94                          MYSQL *db = db_open();                          MYSQL *db = db_open();
95                          if (db == NULL)                          if (db == NULL)
# Line 98  int bbs_login() Line 101  int bbs_login()
101    
102                          mysql_close(db);                          mysql_close(db);
103                  }                  }
104                  if (count >= 3 && !ok)          }
105                  {  
106                          login_fail();          if (!ok)
107                          return -1;          {
108                  }                  login_fail();
109                    return -1;
110          }          }
111    
112          return 0;          return 0;


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

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