summaryrefslogtreecommitdiff
path: root/src/login_sql/login.c
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-07 06:18:17 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-07 06:18:17 +0000
commita250899cbd3bd86d0958f6c9967c859e86da88c6 (patch)
tree0063688f78ca8c105fb36e5286b6fe1baca819a1 /src/login_sql/login.c
parent27fd5bb209c45a6e16465a659b4f8638fa967a3c (diff)
downloadhercules-a250899cbd3bd86d0958f6c9967c859e86da88c6.tar.gz
hercules-a250899cbd3bd86d0958f6c9967c859e86da88c6.tar.bz2
hercules-a250899cbd3bd86d0958f6c9967c859e86da88c6.tar.xz
hercules-a250899cbd3bd86d0958f6c9967c859e86da88c6.zip
updates
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@483 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login_sql/login.c')
-rw-r--r--src/login_sql/login.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 3a261bdf0..48b29fdda 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -135,6 +135,8 @@ char tmpsql[65535], tmp_sql[65535];
int console = 0;
+int case_sensitive = 1;
+
//-----------------------------------------------------
#define AUTH_FIFO_SIZE 256
@@ -399,7 +401,7 @@ int mmo_auth( struct mmo_account* account , int fd){
// make query
sprintf(tmpsql, "SELECT `%s`,`%s`,`%s`,`lastlogin`,`logincount`,`sex`,`connect_until`,`last_ip`,`ban_until`,`state`,`%s`"
- " FROM `%s` WHERE BINARY `%s`='%s'", login_db_account_id, login_db_userid, login_db_user_pass, login_db_level, login_db, login_db_userid, t_uid);
+ " FROM `%s` WHERE %s `%s`='%s'", login_db_account_id, login_db_userid, login_db_user_pass, login_db_level, login_db, case_sensitive ? "BINARY" : "", login_db_userid, t_uid);
//login {0-account_id/1-userid/2-user_pass/3-lastlogin/4-logincount/5-sex/6-connect_untl/7-last_ip/8-ban_until/9-state}
// query
@@ -563,7 +565,7 @@ int mmo_auth( struct mmo_account* account , int fd){
return 6; // 6 = Your are Prohibited to log in until %s
} else { // ban is finished
// reset the ban time
- sprintf(tmpsql, "UPDATE `%s` SET `ban_until`='0' WHERE BINARY `%s`='%s'", login_db, login_db_userid, t_uid);
+ sprintf(tmpsql, "UPDATE `%s` SET `ban_until`='0' WHERE %s `%s`='%s'", login_db, case_sensitive ? "BINARY" : "", login_db_userid, t_uid);
if (mysql_query(&mysql_handle, tmpsql)) {
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
}
@@ -588,8 +590,8 @@ int mmo_auth( struct mmo_account* account , int fd){
memcpy(account->lastlogin, tmpstr, 24);
account->sex = sql_row[5][0] == 'S' ? 2 : sql_row[5][0]=='M';
- sprintf(tmpsql, "UPDATE `%s` SET `lastlogin` = NOW(), `logincount`=`logincount` +1, `last_ip`='%s' WHERE BINARY `%s` = '%s'",
- login_db, ip, login_db_userid, sql_row[1]);
+ sprintf(tmpsql, "UPDATE `%s` SET `lastlogin` = NOW(), `logincount`=`logincount` +1, `last_ip`='%s' WHERE %s `%s` = '%s'",
+ login_db, ip, case_sensitive ? "BINARY" : "", login_db_userid, sql_row[1]);
mysql_free_result(sql_res) ; //resource free
if (mysql_query(&mysql_handle, tmpsql)) {
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
@@ -1328,7 +1330,7 @@ int parse_login(int fd) {
result = -3;
}
- sprintf(tmpsql,"SELECT `ban_until` FROM `%s` WHERE BINARY `%s` = '%s'",login_db,login_db_userid, t_uid);
+ sprintf(tmpsql,"SELECT `ban_until` FROM `%s` WHERE %s `%s` = '%s'",login_db, case_sensitive ? "BINARY" : "",login_db_userid, t_uid);
if(mysql_query(&mysql_handle, tmpsql)) {
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
}
@@ -1671,6 +1673,12 @@ int login_config_read(const char *cfgName){
if(strcmpi(w2,"on") == 0 || strcmpi(w2,"yes") == 0 )
console = 1;
}
+ else if (strcmpi(w1, "case_sensitive") == 0) {
+ if(strcmpi(w2,"on") == 0 || strcmpi(w2,"yes") == 0 )
+ case_sensitive = 1;
+ if(strcmpi(w2,"off") == 0 || strcmpi(w2,"no") == 0 )
+ case_sensitive = 0;
+ }
}
fclose(fp);
printf ("End reading configuration...\n");