Implement ip2nation and ip2nationCountries (#518)

* Implement ip2nation and ip2nationCountries

* fix account.sql

* Tabs

* Codestyle

* More codestyle

* Maybe not. Fk travis.

* Missing field on LOGIN_SEL_ACCOUNT_INFO_BY_NAME

* Update WorldSocket.cpp
This commit is contained in:
Nefertumm
2017-08-20 01:00:00 -03:00
committed by Yehonal
parent 0dd68dfbee
commit fd684a858c
9 changed files with 161 additions and 25 deletions

View File

@@ -20,6 +20,7 @@ CREATE TABLE `account`
`last_ip` varchar(15) NOT NULL DEFAULT '127.0.0.1',
`failed_logins` int(10) unsigned NOT NULL DEFAULT '0',
`locked` tinyint(3) unsigned NOT NULL DEFAULT '0',
`lock_country` varchar(2) NOT NULL DEFAULT '00',
`last_login` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`online` tinyint(3) unsigned NOT NULL DEFAULT '0',
`expansion` tinyint(3) unsigned NOT NULL DEFAULT '0',
@@ -37,16 +38,16 @@ CREATE TABLE `account`
LOCK TABLES `account` WRITE;
/*!40000 ALTER TABLE `account` DISABLE KEYS */;
INSERT INTO `account` VALUES
(1,'test1','047ce22643f9b0bd6baeb18d51bf1075a4d43fc6','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(2,'test2','10eb1ff16cf5380147e8281cd8080a210ecb3c53','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(3,'test3','e546bbf9ca93ae5291f0b441bb9ea2fa0c466176','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(4,'test4','61015d83b456a9c6a7defdff07f55265f24097af','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(5,'test5','dddeac4ffe5f286ec57b7a1ed63bf3a859debe1e','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(6,'test6','f1f94cdffd83c8c4182d66689077f92c807ab579','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(7,'test7','6fcd35c35b127be1d9ca040b2b478eb366506ce2','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(8,'test8','484332ccb02e284e4e0a04573c3fa417f4745fdf','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(9,'test9','4fce15ed251721f02754d5381ae9d0137b6a6a30','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(10,'test10','b22d249228e84ab493b39a2bd765bee9b7c0b350','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'0000-00-00 00:00:00',0,2,0,'','',0,'',0);
(1,'test1','047ce22643f9b0bd6baeb18d51bf1075a4d43fc6','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(2,'test2','10eb1ff16cf5380147e8281cd8080a210ecb3c53','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(3,'test3','e546bbf9ca93ae5291f0b441bb9ea2fa0c466176','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(4,'test4','61015d83b456a9c6a7defdff07f55265f24097af','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(5,'test5','dddeac4ffe5f286ec57b7a1ed63bf3a859debe1e','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(6,'test6','f1f94cdffd83c8c4182d66689077f92c807ab579','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(7,'test7','6fcd35c35b127be1d9ca040b2b478eb366506ce2','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(8,'test8','484332ccb02e284e4e0a04573c3fa417f4745fdf','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(9,'test9','4fce15ed251721f02754d5381ae9d0137b6a6a30','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0),
(10,'test10','b22d249228e84ab493b39a2bd765bee9b7c0b350','','','','','2016-01-30 21:09:43','127.0.0.1',0,0,'00','0000-00-00 00:00:00',0,2,0,'','',0,'',0);
/*!40000 ALTER TABLE `account` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

View File

@@ -0,0 +1,23 @@
INSERT INTO version_db_auth (`sql_rev`) VALUES ('1498796201292521600');
ALTER TABLE `account` ADD COLUMN `lock_country` VARCHAR(2) NOT NULL DEFAULT '00' AFTER `locked`;
DROP TABLE IF EXISTS `ip2nation`;
CREATE TABLE `ip2nation` (
`ip` int(11) unsigned NOT NULL default '0',
`country`char(2) NOT NULL default '',
KEY `ip` (`ip`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ip2nationCountries`;
CREATE TABLE `ip2nationCountries` (
`code` varchar(4) NOT NULL default '',
`iso_code_2` varchar(2) NOT NULL default '',
`iso_code_3` varchar(3) default '',
`iso_country` varchar(255) NOT NULL default '',
`country` varchar(255) NOT NULL default '',
`lat` float NOT NULL default '0',
`lon` float NOT NULL default '0',
PRIMARY KEY (`code`),
KEY `code` (`code`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@@ -0,0 +1,9 @@
INSERT INTO version_db_world (`sql_rev`) VALUES ('1498796247453520600');
DROP TABLE IF EXISTS ip2nation;
DROP TABLE IF EXISTS ip2nationCountries;
DELETE FROM `command` WHERE `name` in ('account lock', 'account lock ip', 'account lock country');
INSERT INTO `command` (`name`,`security`,`help`) VALUES
('account lock ip', 0, 'Syntax: .account lock ip [on|off]\nAllow login from account only from current used IP or remove this requirement.'),
('account lock country', 0, 'Syntax: .account lock country [on|off]\nAllow login from account only from current used Country or remove this requirement.');