.Rise 18 Posted January 23, 2018 Share Posted January 23, 2018 Hello, I tried to add feature like "IP Login". It locks your IP and you can not login using different IP adress. I tried to write this code: char ip; char query[1024]; snprintf(query, sizeof(query),"SELECT ip FROM account.ip_login WHERE ip = '%s' AND login = '%s'", inet_ntoa(d->GetAddr().sin_addr), login); std::auto_ptr<SQLMsg> execquery(DBManager::instance().DirectQuery(query)); MYSQL_ROW row = mysql_fetch_row(execquery->Get()->pSQLResult); str_to_number(ip, row[0]); if (ip != '0' && execquery->Get()->uiNumRows < 1) { LoginFailure(d, "IP_MATCH"); return; } But when I run it and try to login, core gets dumped. I have tried a lot of variations of this code. One time I could not login when there were not IP adress in table. (It was recognising IP address, but when I cleared table, I could not login due bad IP) Any solution, please? (I pay 10€ - after solution) Thanks. If I helped you, do not forget to press "Thanks" button! Link to comment Share on other sites More sharing options...
Fire 23 Posted January 23, 2018 Share Posted January 23, 2018 IP is already formatted why you convert to a number and declare it as char? Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted January 23, 2018 Premium Share Posted January 23, 2018 Hello, I may probably sound offtopic but overall I don't think locking player's ip is a good idea... In fact, if someone is using a dynamic ip, a mobile phone connection or if he is living in two different places or just if he moves he won't be able to connect anymore and it will probably be a source of issue more than a protection. I think you should give the option to enable or disable the check on the fly so that every player will be able to add this security willingly. Link to comment Share on other sites More sharing options...
.Rise 18 Posted January 24, 2018 Author Share Posted January 24, 2018 6 hours ago, Galet said: Hello, I may probably sound offtopic but overall I don't think locking player's ip is a good idea... In fact, if someone is using a dynamic ip, a mobile phone connection or if he is living in two different places or just if he moves he won't be able to connect anymore and it will probably be a source of issue more than a protection. I think you should give the option to enable or disable the check on the fly so that every player will be able to add this security willingly. Hi, yes. I made it to check if player is in table IP_login, it will check the player. If I helped you, do not forget to press "Thanks" button! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now