Jump to content

Recommended Posts

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! 

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Premium

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.

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! 

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.