mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-10 16:58:34 +02:00
Initial partial upload, testing needed
This commit is contained in:
parent
e51267f33c
commit
1203f890f1
7 changed files with 1054 additions and 0 deletions
496
database/registry.sql
Normal file
496
database/registry.sql
Normal file
|
@ -0,0 +1,496 @@
|
||||||
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS `registry`;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_tld` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`tld` varchar(32) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `tld` (`tld`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain tld';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_price` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`tldid` int(10) unsigned NOT NULL,
|
||||||
|
`command` enum('create','renew','transfer') NOT NULL default 'create',
|
||||||
|
`m0` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m12` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m24` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m36` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m48` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m60` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m72` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m84` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m96` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m108` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
`m120` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `unique_record` (`tldid`,`command`),
|
||||||
|
CONSTRAINT `domain_price_ibfk_1` FOREIGN KEY (`tldid`) REFERENCES `domain_tld` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain price';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_restore_price` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`tldid` int(10) unsigned NOT NULL,
|
||||||
|
`price` decimal(10,2) NOT NULL default '0.00',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `tldid` (`tldid`),
|
||||||
|
CONSTRAINT `domain_restore_price_ibfk_1` FOREIGN KEY (`tldid`) REFERENCES `domain_tld` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain restore price';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`reserved_domain_names` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(68) NOT NULL,
|
||||||
|
`type` enum('reserved','restricted') NOT NULL default 'reserved',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `name` (`name`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='reserved domain names';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`registrar` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`clid` varchar(16) NOT NULL,
|
||||||
|
`pw` varchar(64) NOT NULL,
|
||||||
|
`prefix` char(2) NOT NULL,
|
||||||
|
`email` varchar(255) NOT NULL,
|
||||||
|
`whois_server` varchar(255) NOT NULL,
|
||||||
|
`url` varchar(255) NOT NULL,
|
||||||
|
`abuse_email` varchar(255) NOT NULL,
|
||||||
|
`abuse_phone` varchar(255) NOT NULL,
|
||||||
|
`accountBalance` decimal(8,2) NOT NULL default '0.00',
|
||||||
|
`creditLimit` decimal(8,2) NOT NULL default '0.00',
|
||||||
|
`creditThreshold` decimal(8,2) NOT NULL default '0.00',
|
||||||
|
`thresholdType` enum('fixed','percent') NOT NULL default 'fixed',
|
||||||
|
`crdate` datetime NOT NULL,
|
||||||
|
`update` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `clid` (`clid`),
|
||||||
|
UNIQUE KEY `prefix` (`prefix`),
|
||||||
|
UNIQUE KEY `email` (`email`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='registrar';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`registrar_whitelist` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
|
`addr` varchar(45) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`registrar_id`,`addr`),
|
||||||
|
CONSTRAINT `registrar_whitelist_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='registrar whitelist';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`registrar_contact` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
|
`type` enum('owner','admin','billing','tech') NOT NULL default 'admin',
|
||||||
|
`title` varchar(255) NOT NULL,
|
||||||
|
`first_name` varchar(255) NOT NULL,
|
||||||
|
`middle_name` varchar(255) NOT NULL,
|
||||||
|
`last_name` varchar(255) NOT NULL,
|
||||||
|
`org` varchar(255) default NULL,
|
||||||
|
`street1` varchar(255) default NULL,
|
||||||
|
`street2` varchar(255) default NULL,
|
||||||
|
`street3` varchar(255) default NULL,
|
||||||
|
`city` varchar(255) NOT NULL,
|
||||||
|
`sp` varchar(255) default NULL,
|
||||||
|
`pc` varchar(16) default NULL,
|
||||||
|
`cc` char(2) NOT NULL,
|
||||||
|
`voice` varchar(17) default NULL,
|
||||||
|
`fax` varchar(17) default NULL,
|
||||||
|
`email` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`registrar_id`,`type`),
|
||||||
|
CONSTRAINT `registrar_contact_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='registrar data';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`poll` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
|
`qdate` datetime NOT NULL,
|
||||||
|
`msg` text default NULL,
|
||||||
|
`msg_type` enum('lowBalance','domainTransfer','contactTransfer') default NULL,
|
||||||
|
`obj_name_or_id` varchar(68),
|
||||||
|
`obj_trStatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL,
|
||||||
|
`obj_reID` varchar(255),
|
||||||
|
`obj_reDate` datetime,
|
||||||
|
`obj_acID` varchar(255),
|
||||||
|
`obj_acDate` datetime,
|
||||||
|
`obj_exDate` datetime default NULL,
|
||||||
|
`registrarName` varchar(255),
|
||||||
|
`creditLimit` decimal(8,2) default '0.00',
|
||||||
|
`creditThreshold` decimal(8,2) default '0.00',
|
||||||
|
`creditThresholdType` enum('FIXED','PERCENT'),
|
||||||
|
`availableCredit` decimal(8,2) default '0.00',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `poll_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='poll';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`payment_history` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
|
`date` datetime NOT NULL,
|
||||||
|
`description` text NOT NULL,
|
||||||
|
`amount` decimal(8,2) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `payment_history_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='payment history';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`statement` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
|
`date` datetime NOT NULL,
|
||||||
|
`command` enum('create','renew','transfer','restore','autoRenew') NOT NULL default 'create',
|
||||||
|
`domain_name` varchar(68) NOT NULL,
|
||||||
|
`length_in_months` tinyint(3) unsigned NOT NULL,
|
||||||
|
`from` datetime NOT NULL,
|
||||||
|
`to` datetime NOT NULL,
|
||||||
|
`amount` decimal(8,2) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `statement_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='financial statement';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`contact` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`identifier` varchar(255) NOT NULL,
|
||||||
|
`voice` varchar(17) default NULL,
|
||||||
|
`voice_x` int(10) default NULL,
|
||||||
|
`fax` varchar(17) default NULL,
|
||||||
|
`fax_x` int(10) default NULL,
|
||||||
|
`email` varchar(255) NOT NULL,
|
||||||
|
`nin` varchar(255) default NULL,
|
||||||
|
`nin_type` enum('personal','business') default NULL,
|
||||||
|
`clid` int(10) unsigned NOT NULL,
|
||||||
|
`crid` int(10) unsigned NOT NULL,
|
||||||
|
`crdate` datetime NOT NULL,
|
||||||
|
`upid` int(10) unsigned default NULL,
|
||||||
|
`update` datetime default NULL,
|
||||||
|
`trdate` datetime default NULL,
|
||||||
|
`trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL,
|
||||||
|
`reid` int(10) unsigned default NULL,
|
||||||
|
`redate` datetime default NULL,
|
||||||
|
`acid` int(10) unsigned default NULL,
|
||||||
|
`acdate` datetime default NULL,
|
||||||
|
`disclose_voice` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_fax` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_email` enum('0','1') NOT NULL default '1',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `identifier` (`identifier`),
|
||||||
|
CONSTRAINT `contact_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `contact_ibfk_2` FOREIGN KEY (`crid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `contact_ibfk_3` FOREIGN KEY (`upid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`contact_postalInfo` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`contact_id` int(10) unsigned NOT NULL,
|
||||||
|
`type` enum('int','loc') NOT NULL default 'int',
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`org` varchar(255) default NULL,
|
||||||
|
`street1` varchar(255) default NULL,
|
||||||
|
`street2` varchar(255) default NULL,
|
||||||
|
`street3` varchar(255) default NULL,
|
||||||
|
`city` varchar(255) NOT NULL,
|
||||||
|
`sp` varchar(255) default NULL,
|
||||||
|
`pc` varchar(16) default NULL,
|
||||||
|
`cc` char(2) NOT NULL,
|
||||||
|
`disclose_name_int` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_name_loc` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_org_int` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_org_loc` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_addr_int` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_addr_loc` enum('0','1') NOT NULL default '1',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`contact_id`,`type`),
|
||||||
|
CONSTRAINT `contact_postalInfo_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact:postalInfo';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`contact_authInfo` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`contact_id` int(10) unsigned NOT NULL,
|
||||||
|
`authtype` enum('pw','ext') NOT NULL default 'pw',
|
||||||
|
`authinfo` varchar(64) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `contact_id` (`contact_id`),
|
||||||
|
CONSTRAINT `contact_authInfo_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact:authInfo';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`contact_status` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`contact_id` int(10) unsigned NOT NULL,
|
||||||
|
`status` enum('clientDeleteProhibited','clientTransferProhibited','clientUpdateProhibited','linked','ok','pendingCreate','pendingDelete','pendingTransfer','pendingUpdate','serverDeleteProhibited','serverTransferProhibited','serverUpdateProhibited') NOT NULL default 'ok',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`contact_id`,`status`),
|
||||||
|
CONSTRAINT `contact_status_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact:status';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(68) NOT NULL,
|
||||||
|
`tldid` int(10) unsigned NOT NULL,
|
||||||
|
`registrant` int(10) unsigned default NULL,
|
||||||
|
`crdate` datetime NOT NULL,
|
||||||
|
`exdate` datetime NOT NULL,
|
||||||
|
`update` datetime default NULL,
|
||||||
|
`clid` int(10) unsigned NOT NULL,
|
||||||
|
`crid` int(10) unsigned NOT NULL,
|
||||||
|
`upid` int(10) unsigned default NULL,
|
||||||
|
`trdate` datetime default NULL,
|
||||||
|
`trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL,
|
||||||
|
`reid` int(10) unsigned default NULL,
|
||||||
|
`redate` datetime default NULL,
|
||||||
|
`acid` int(10) unsigned default NULL,
|
||||||
|
`acdate` datetime default NULL,
|
||||||
|
`transfer_exdate` datetime default NULL,
|
||||||
|
`idnlang` varchar(16) default NULL,
|
||||||
|
`delTime` datetime default NULL,
|
||||||
|
`resTime` datetime default NULL,
|
||||||
|
`rgpstatus` enum('addPeriod','autoRenewPeriod','renewPeriod','transferPeriod','pendingDelete','pendingRestore','redemptionPeriod') default NULL,
|
||||||
|
`rgppostData` text default NULL,
|
||||||
|
`rgpdelTime` datetime default NULL,
|
||||||
|
`rgpresTime` datetime default NULL,
|
||||||
|
`rgpresReason` text default NULL,
|
||||||
|
`rgpstatement1` text default NULL,
|
||||||
|
`rgpstatement2` text default NULL,
|
||||||
|
`rgpother` text default NULL,
|
||||||
|
`addPeriod` tinyint(3) unsigned default NULL,
|
||||||
|
`autoRenewPeriod` tinyint(3) unsigned default NULL,
|
||||||
|
`renewPeriod` tinyint(3) unsigned default NULL,
|
||||||
|
`transferPeriod` tinyint(3) unsigned default NULL,
|
||||||
|
`renewedDate` datetime default NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `name` (`name`),
|
||||||
|
CONSTRAINT `domain_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_ibfk_2` FOREIGN KEY (`crid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_ibfk_3` FOREIGN KEY (`upid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_ibfk_4` FOREIGN KEY (`registrant`) REFERENCES `contact` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_ibfk_5` FOREIGN KEY (`reid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_ibfk_6` FOREIGN KEY (`acid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_ibfk_7` FOREIGN KEY (`tldid`) REFERENCES `domain_tld` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_contact_map` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`domain_id` int(10) unsigned NOT NULL,
|
||||||
|
`contact_id` int(10) unsigned NOT NULL,
|
||||||
|
`type` enum('admin','billing','tech') NOT NULL default 'admin',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`domain_id`,`contact_id`,`type`),
|
||||||
|
CONSTRAINT `domain_contact_map_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_contact_map_ibfk_2` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact map';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_authInfo` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`domain_id` int(10) unsigned NOT NULL,
|
||||||
|
`authtype` enum('pw','ext') NOT NULL default 'pw',
|
||||||
|
`authinfo` varchar(64) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `domain_id` (`domain_id`),
|
||||||
|
CONSTRAINT `domain_authInfo_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain:authInfo';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_status` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`domain_id` int(10) unsigned NOT NULL,
|
||||||
|
`status` enum('clientDeleteProhibited','clientHold','clientRenewProhibited','clientTransferProhibited','clientUpdateProhibited','inactive','ok','pendingCreate','pendingDelete','pendingRenew','pendingTransfer','pendingUpdate','serverDeleteProhibited','serverHold','serverRenewProhibited','serverTransferProhibited','serverUpdateProhibited') NOT NULL default 'ok',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`domain_id`,`status`),
|
||||||
|
CONSTRAINT `domain_status_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain:status';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`secdns` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`domain_id` int(10) unsigned NOT NULL,
|
||||||
|
`maxsiglife` int(10) unsigned default '604800',
|
||||||
|
`interface` enum('dsData','keyData') NOT NULL default 'dsData',
|
||||||
|
`keytag` smallint(5) unsigned NOT NULL,
|
||||||
|
`alg` tinyint(3) unsigned NOT NULL default '5',
|
||||||
|
`digesttype` tinyint(3) unsigned NOT NULL default '1',
|
||||||
|
`digest` varchar(64) NOT NULL,
|
||||||
|
`flags` smallint(5) unsigned default NULL,
|
||||||
|
`protocol` smallint(5) unsigned default NULL,
|
||||||
|
`keydata_alg` tinyint(3) unsigned default NULL,
|
||||||
|
`pubkey` varchar(255) default NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`domain_id`,`digest`),
|
||||||
|
CONSTRAINT `secdns_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='secDNS';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`host` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`domain_id` int(10) unsigned default NULL,
|
||||||
|
`clid` int(10) unsigned NOT NULL,
|
||||||
|
`crid` int(10) unsigned NOT NULL,
|
||||||
|
`crdate` datetime NOT NULL,
|
||||||
|
`upid` int(10) unsigned default NULL,
|
||||||
|
`update` datetime default NULL,
|
||||||
|
`trdate` datetime default NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `name` (`name`),
|
||||||
|
CONSTRAINT `host_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `host_ibfk_2` FOREIGN KEY (`crid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `host_ibfk_3` FOREIGN KEY (`upid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `host_ibfk_4` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='host';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_host_map` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`domain_id` int(10) unsigned NOT NULL,
|
||||||
|
`host_id` int(10) unsigned NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `domain_host_map_id` (`domain_id`,`host_id`),
|
||||||
|
CONSTRAINT `domain_host_map_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE RESTRICT,
|
||||||
|
CONSTRAINT `domain_host_map_ibfk_2` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact map';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`host_addr` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`host_id` int(10) unsigned NOT NULL,
|
||||||
|
`addr` varchar(45) NOT NULL,
|
||||||
|
`ip` enum('v4','v6') NOT NULL default 'v4',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `unique` (`host_id`,`addr`,`ip`),
|
||||||
|
CONSTRAINT `host_addr_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='host_addr';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`host_status` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`host_id` int(10) unsigned NOT NULL,
|
||||||
|
`status` enum('clientDeleteProhibited','clientUpdateProhibited','linked','ok','pendingCreate','pendingDelete','pendingTransfer','pendingUpdate','serverDeleteProhibited','serverUpdateProhibited') NOT NULL default 'ok',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uniquekey` (`host_id`,`status`),
|
||||||
|
CONSTRAINT `host_status_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='host:status';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`domain_auto_approve_transfer` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(68) NOT NULL,
|
||||||
|
`registrant` int(10) unsigned default NULL,
|
||||||
|
`crdate` datetime NOT NULL,
|
||||||
|
`exdate` datetime NOT NULL,
|
||||||
|
`update` datetime default NULL,
|
||||||
|
`clid` int(10) unsigned NOT NULL,
|
||||||
|
`crid` int(10) unsigned NOT NULL,
|
||||||
|
`upid` int(10) unsigned default NULL,
|
||||||
|
`trdate` datetime default NULL,
|
||||||
|
`trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL,
|
||||||
|
`reid` int(10) unsigned default NULL,
|
||||||
|
`redate` datetime default NULL,
|
||||||
|
`acid` int(10) unsigned default NULL,
|
||||||
|
`acdate` datetime default NULL,
|
||||||
|
`transfer_exdate` datetime default NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain_auto_approve_transfer';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`contact_auto_approve_transfer` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`identifier` varchar(255) NOT NULL,
|
||||||
|
`voice` varchar(17) default NULL,
|
||||||
|
`voice_x` int(10) default NULL,
|
||||||
|
`fax` varchar(17) default NULL,
|
||||||
|
`fax_x` int(10) default NULL,
|
||||||
|
`email` varchar(255) NOT NULL,
|
||||||
|
`nin` varchar(255) default NULL,
|
||||||
|
`nin_type` enum('personal','business') default NULL,
|
||||||
|
`clid` int(10) unsigned NOT NULL,
|
||||||
|
`crid` int(10) unsigned NOT NULL,
|
||||||
|
`crdate` datetime NOT NULL,
|
||||||
|
`upid` int(10) unsigned default NULL,
|
||||||
|
`update` datetime default NULL,
|
||||||
|
`trdate` datetime default NULL,
|
||||||
|
`trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL,
|
||||||
|
`reid` int(10) unsigned default NULL,
|
||||||
|
`redate` datetime default NULL,
|
||||||
|
`acid` int(10) unsigned default NULL,
|
||||||
|
`acdate` datetime default NULL,
|
||||||
|
`disclose_voice` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_fax` enum('0','1') NOT NULL default '1',
|
||||||
|
`disclose_email` enum('0','1') NOT NULL default '1',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='contact_auto_approve_transfer';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`statistics` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`date` date NOT NULL,
|
||||||
|
`total_domains` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`created_domains` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`renewed_domains` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`transfered_domains` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`deleted_domains` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`restored_domains` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `date` (`date`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Statistics';
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_tld` VALUES('1','.COM.XX');
|
||||||
|
INSERT INTO `registry`.`domain_tld` VALUES('2','.ORG.XX');
|
||||||
|
INSERT INTO `registry`.`domain_tld` VALUES('3','.INFO.XX');
|
||||||
|
INSERT INTO `registry`.`domain_tld` VALUES('4','.PRO.XX');
|
||||||
|
INSERT INTO `registry`.`domain_tld` VALUES('5','.XX');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('1','1','create','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('2','1','renew','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('3','1','transfer','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('4','2','create','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('5','2','renew','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('6','2','transfer','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('7','3','create','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('8','3','renew','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('9','3','transfer','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('10','4','create','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('11','4','renew','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('12','4','transfer','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('13','5','create','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('14','5','renew','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_price` VALUES('15','5','transfer','0.00','5.00','10.00','15.00','20.00','25.00','30.00','35.00','40.00','45.00','50.00');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`domain_restore_price` VALUES('1','1','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_restore_price` VALUES('2','2','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_restore_price` VALUES('3','3','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_restore_price` VALUES('4','4','50.00');
|
||||||
|
INSERT INTO `registry`.`domain_restore_price` VALUES('5','5','50.00');
|
||||||
|
|
||||||
|
INSERT INTO `registry`.`registrar` (`name`,`clid`,`pw`,`prefix`,`email`,`whois_server`,`url`,`abuse_email`,`abuse_phone`,`accountBalance`,`creditLimit`,`creditThreshold`,`thresholdType`,`crdate`,`update`) VALUES('Namingo Test','namingo','{SHA}MyVYFDDrSjD546LIF11cMPu93ss=','XP','info@namingo.org','whois.namingo.org','http://www.namingo.org/','abuse@namingo.org','+380.123123123','100000.00','100000.00','500.00','fixed',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);
|
||||||
|
INSERT INTO `registry`.`registrar` (`name`,`clid`,`pw`,`prefix`,`email`,`whois_server`,`url`,`abuse_email`,`abuse_phone`,`accountBalance`,`creditLimit`,`creditThreshold`,`thresholdType`,`crdate`,`update`) VALUES('Registrar 002','testregistrar1','{SHA}ELxnUq/+JQS9a7pCUIZQpUrA3bY=','AA','info@testregistrar1.com','whois.namingo.org','http://www.namingo.org/','abuse@namingo.org','+380.123123123','100000.00','100000.00','500.00','fixed',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);
|
||||||
|
INSERT INTO `registry`.`registrar` (`name`,`clid`,`pw`,`prefix`,`email`,`whois_server`,`url`,`abuse_email`,`abuse_phone`,`accountBalance`,`creditLimit`,`creditThreshold`,`thresholdType`,`crdate`,`update`) VALUES('Registrar 003','testregistrar2','{SHA}jkkAfdvdLH5vbkCeQLGJy77LEGM=','BB','info@testregistrar2.com','whois.namingo.org','http://www.namingo.org/','abuse@namingo.org','+380.123123123','100000.00','100000.00','500.00','fixed',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);
|
||||||
|
|
||||||
|
CREATE USER 'registry'@'localhost' IDENTIFIED BY 'EPPRegistry';
|
||||||
|
CREATE USER 'registry-select'@'localhost' IDENTIFIED BY 'EPPRegistrySELECT';
|
||||||
|
CREATE USER 'registry-update'@'localhost' IDENTIFIED BY 'EPPRegistryUPDATE';
|
||||||
|
|
||||||
|
GRANT ALL ON `registry`.* TO 'registry'@'localhost';
|
||||||
|
GRANT SELECT ON `registry`.* TO 'registry-select'@'localhost';
|
||||||
|
GRANT UPDATE ON `registry`.`payment_history` TO 'registry-update'@'localhost';
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS `registryTransaction`;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registryTransaction`.`transaction_identifier` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`registrar_id` int(10) unsigned NOT NULL,
|
||||||
|
`clTRID` varchar(64),
|
||||||
|
`clTRIDframe` text,
|
||||||
|
`cldate` datetime,
|
||||||
|
`clmicrosecond` int(6),
|
||||||
|
`cmd` enum('login','logout','check','info','poll','transfer','create','delete','renew','update') default NULL,
|
||||||
|
`obj_type` enum('domain','host','contact') default NULL,
|
||||||
|
`obj_id` text default NULL,
|
||||||
|
`code` smallint(4) unsigned default NULL,
|
||||||
|
`msg` varchar(255) default NULL,
|
||||||
|
`svTRID` varchar(64),
|
||||||
|
`svTRIDframe` text,
|
||||||
|
`svdate` datetime,
|
||||||
|
`svmicrosecond` int(6),
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `clTRID` (`clTRID`),
|
||||||
|
UNIQUE KEY `svTRID` (`svTRID`),
|
||||||
|
CONSTRAINT `transaction_identifier_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registry`.`registrar` (`id`) ON DELETE RESTRICT
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='transaction identifier';
|
||||||
|
|
||||||
|
GRANT ALL ON `registryTransaction`.* TO 'registry'@'localhost';
|
||||||
|
GRANT SELECT ON `registryTransaction`.* TO 'registry-select'@'localhost';
|
||||||
|
|
||||||
|
FLUSH PRIVILEGES;
|
173
rdap/rdap.php
Normal file
173
rdap/rdap.php
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
<?php
|
||||||
|
// Include the Swoole extension
|
||||||
|
if (!extension_loaded('swoole')) {
|
||||||
|
die('Swoole extension must be installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a Swoole HTTP server
|
||||||
|
$http = new Swoole\Http\Server('0.0.0.0', 8080);
|
||||||
|
|
||||||
|
// Register a callback to handle incoming requests
|
||||||
|
$http->on('request', function ($request, $response) {
|
||||||
|
// Connect to the database
|
||||||
|
try {
|
||||||
|
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
|
||||||
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$response->end(json_encode(['error' => 'Error connecting to database']));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle domain query
|
||||||
|
if ($request->server['request_uri'] === '/domain') {
|
||||||
|
handleDomainQuery($request, $response, $pdo);
|
||||||
|
}
|
||||||
|
// Handle entity (contacts) query
|
||||||
|
elseif ($request->server['request_uri'] === '/entity') {
|
||||||
|
handleEntityQuery($request, $response, $pdo);
|
||||||
|
}
|
||||||
|
// Handle nameserver query
|
||||||
|
elseif ($request->server['request_uri'] === '/nameserver') {
|
||||||
|
handleNameserverQuery($request, $response, $pdo);
|
||||||
|
}
|
||||||
|
// Handle help query
|
||||||
|
elseif ($request->server['request_uri'] === '/help') {
|
||||||
|
handleHelpQuery($request, $response, $pdo);
|
||||||
|
}
|
||||||
|
// Handle search query (e.g., search for domains by pattern)
|
||||||
|
elseif ($request->server['request_uri'] === '/domains') {
|
||||||
|
handleSearchQuery($request, $response, $pdo);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$response->status(404);
|
||||||
|
$response->end(json_encode(['error' => 'Endpoint not found']));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the connection
|
||||||
|
$pdo = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start the server
|
||||||
|
$http->start();
|
||||||
|
|
||||||
|
function handleDomainQuery($request, $response, $pdo) {
|
||||||
|
// Extract and validate the domain name from the request
|
||||||
|
$domain = strtoupper(trim($request->get['domain']));
|
||||||
|
// ... Perform validation as in the WHOIS server ...
|
||||||
|
|
||||||
|
// Perform the RDAP lookup
|
||||||
|
try {
|
||||||
|
// Query 1: Get domain details
|
||||||
|
$stmt1 = $pdo->prepare("SELECT *, DATE_FORMAT(`crdate`, '%Y-%m-%dT%TZ') AS `crdate`, DATE_FORMAT(`exdate`, '%Y-%m-%dT%TZ') AS `exdate` FROM `registry`.`domain` WHERE `name` = :domain");
|
||||||
|
$stmt1->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||||
|
$stmt1->execute();
|
||||||
|
$domainDetails = $stmt1->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Check if the domain exists
|
||||||
|
if (!$domainDetails) {
|
||||||
|
// Domain not found, respond with a 404 error
|
||||||
|
$response->status(404);
|
||||||
|
$response->end(json_encode([
|
||||||
|
'errorCode' => 404,
|
||||||
|
'title' => 'Not Found',
|
||||||
|
'description' => 'The requested domain was not found in the RDAP database.',
|
||||||
|
]));
|
||||||
|
// Close the connection
|
||||||
|
$pdo = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query 2: Get status details
|
||||||
|
$stmt2 = $pdo->prepare("SELECT `status` FROM `domain_status` WHERE `domain_id` = :domain_id");
|
||||||
|
$stmt2->bindParam(':domain_id', $domainDetails['id'], PDO::PARAM_INT);
|
||||||
|
$stmt2->execute();
|
||||||
|
$statuses = $stmt2->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
|
// Query 3: Get registrar details
|
||||||
|
$stmt3 = $pdo->prepare("SELECT `name`,`whois_server`,`url`,`abuse_email`,`abuse_phone` FROM `registrar` WHERE `id` = :clid");
|
||||||
|
$stmt3->bindParam(':clid', $domainDetails['clid'], PDO::PARAM_INT);
|
||||||
|
$stmt3->execute();
|
||||||
|
$registrarDetails = $stmt3->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Query 4: Get registrant details
|
||||||
|
$stmt4 = $pdo->prepare("SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email FROM contact,contact_postalInfo WHERE contact.id=:registrant AND contact_postalInfo.contact_id=contact.id");
|
||||||
|
$stmt4->bindParam(':registrant', $domainDetails['registrant'], PDO::PARAM_INT);
|
||||||
|
$stmt4->execute();
|
||||||
|
$registrantDetails = $stmt4->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Query 5: Get admin and tech contacts (similar to registrant, with different conditions)
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// Query 6: Get nameservers
|
||||||
|
$stmt6 = $pdo->prepare("SELECT `name` FROM `domain_host_map`,`host` WHERE `domain_host_map`.`domain_id` = :domain_id AND `domain_host_map`.`host_id` = `host`.`id`");
|
||||||
|
$stmt6->bindParam(':domain_id', $domainDetails['id'], PDO::PARAM_INT);
|
||||||
|
$stmt6->execute();
|
||||||
|
$nameservers = $stmt6->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
|
// Construct the RDAP response in JSON format
|
||||||
|
$rdapResponse = [
|
||||||
|
'objectClassName' => 'domain',
|
||||||
|
'ldhName' => $domain,
|
||||||
|
'status' => $statuses,
|
||||||
|
'events' => [
|
||||||
|
['eventAction' => 'registration', 'eventDate' => $domainDetails['crdate']],
|
||||||
|
['eventAction' => 'expiration', 'eventDate' => $domainDetails['exdate']],
|
||||||
|
// ... Additional events ...
|
||||||
|
],
|
||||||
|
'entities' => [
|
||||||
|
[
|
||||||
|
'objectClassName' => 'entity',
|
||||||
|
'roles' => ['registrant'],
|
||||||
|
'vcardArray' => [
|
||||||
|
"vcard",
|
||||||
|
[
|
||||||
|
["version", "4.0"],
|
||||||
|
["fn", $registrantDetails['name']],
|
||||||
|
["org", $registrantDetails['org']],
|
||||||
|
["adr", [
|
||||||
|
"", // Post office box
|
||||||
|
$registrantDetails['street1'], // Extended address
|
||||||
|
$registrantDetails['street2'], // Street address
|
||||||
|
$registrantDetails['city'], // Locality
|
||||||
|
$registrantDetails['sp'], // Region
|
||||||
|
$registrantDetails['pc'], // Postal code
|
||||||
|
$registrantDetails['cc'] // Country name
|
||||||
|
]],
|
||||||
|
["tel", $registrantDetails['voice'], ["type" => "voice"]],
|
||||||
|
["tel", $registrantDetails['fax'], ["type" => "fax"]],
|
||||||
|
["email", $registrantDetails['email']],
|
||||||
|
// ... Additional vCard properties ...
|
||||||
|
]
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// ... Additional entities for admin, tech ...
|
||||||
|
],
|
||||||
|
'links' => [
|
||||||
|
[
|
||||||
|
'value' => 'http://example.com/rdap/domain/' . $domain,
|
||||||
|
'rel' => 'self',
|
||||||
|
'href' => 'http://example.com/rdap/domain/' . $domain,
|
||||||
|
'type' => 'application/rdap+json',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'http://example.com/rdap/tos',
|
||||||
|
'rel' => 'terms-of-service',
|
||||||
|
'href' => 'http://example.com/rdap/tos',
|
||||||
|
'type' => 'text/html',
|
||||||
|
],
|
||||||
|
// ... Additional RDAP links ...
|
||||||
|
],
|
||||||
|
'nameservers' => array_map(function ($name) {
|
||||||
|
return ['ldhName' => $name];
|
||||||
|
}, $nameservers),
|
||||||
|
// ... Other RDAP fields ...
|
||||||
|
];
|
||||||
|
|
||||||
|
// Send the RDAP response
|
||||||
|
$response->header('Content-Type', 'application/json');
|
||||||
|
$response->end(json_encode($rdapResponse));
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$response->end(json_encode(['error' => 'Error connecting to the RDAP database']));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
255
whois/port43/whois.php
Normal file
255
whois/port43/whois.php
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
<?php
|
||||||
|
// Include the Swoole extension
|
||||||
|
if (!extension_loaded('swoole')) {
|
||||||
|
die('Swoole extension must be installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a Swoole TCP server
|
||||||
|
$server = new Swoole\Server('0.0.0.0', 43);
|
||||||
|
|
||||||
|
// Register a callback to handle incoming connections
|
||||||
|
$server->on('connect', function ($server, $fd) {
|
||||||
|
echo "Client connected: {$fd}";
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register a callback to handle incoming requests
|
||||||
|
$server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
|
// Validate and sanitize the domain name
|
||||||
|
$domain = trim($data);
|
||||||
|
if (!$domain) {
|
||||||
|
$server->send($fd, "please enter a domain name");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (strlen($domain) > 68) {
|
||||||
|
$server->send($fd, "domain name is too long");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$domain = strtoupper($domain);
|
||||||
|
if (preg_match("/[^A-Z0-9\.\-]/", $domain)) {
|
||||||
|
$server->send($fd, "domain name invalid format");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (preg_match("/(^-|^\.|-\.|\.-|--|\.\.|-$|\.$)/", $domain)) {
|
||||||
|
$server->send($fd, "domain name invalid format");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!preg_match("/^[A-Z0-9-]+\.(XX|COM\.XX|ORG\.XX|INFO\.XX|PRO\.XX)$/", $domain)) {
|
||||||
|
$server->send($fd, "please search only XX domains at least 2 letters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect to the database
|
||||||
|
try {
|
||||||
|
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
|
||||||
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$server->send($fd, "Error connecting to database");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the WHOIS lookup
|
||||||
|
try {
|
||||||
|
$query = "SELECT *,
|
||||||
|
DATE_FORMAT(`crdate`, '%d-%b-%Y %T') AS `crdate`,
|
||||||
|
DATE_FORMAT(`update`, '%d-%b-%Y %T') AS `update`,
|
||||||
|
DATE_FORMAT(`exdate`, '%d-%b-%Y %T') AS `exdate`
|
||||||
|
FROM `registry`.`domain` WHERE `name` = :domain";
|
||||||
|
$stmt = $pdo->prepare($query);
|
||||||
|
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
if ($f['crdate']) $f['crdate'] .= ' UTC';
|
||||||
|
if ($f['update']) $f['update'] .= ' UTC';
|
||||||
|
if ($f['exdate']) $f['exdate'] .= ' UTC';
|
||||||
|
|
||||||
|
$query2 = "SELECT `tld` FROM `domain_tld` WHERE `id` = :tldid";
|
||||||
|
$stmt2 = $pdo->prepare($query2);
|
||||||
|
$stmt2->bindParam(':tldid', $f['tldid'], PDO::PARAM_INT);
|
||||||
|
$stmt2->execute();
|
||||||
|
|
||||||
|
$tld = $stmt2->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$res = "Access to {$tld['tld']} WHOIS information is provided to assist persons in"
|
||||||
|
."\ndetermining the contents of a domain name registration record in the"
|
||||||
|
."\nDomain Name Registry registry database. The data in this record is provided by"
|
||||||
|
."\nDomain Name Registry for informational purposes only, and Domain Name Registry does not"
|
||||||
|
."\nguarantee its accuracy. This service is intended only for query-based"
|
||||||
|
."\naccess. You agree that you will use this data only for lawful purposes"
|
||||||
|
."\nand that, under no circumstances will you use this data to: (a) allow,"
|
||||||
|
."\nenable, or otherwise support the transmission by e-mail, telephone, or"
|
||||||
|
."\nfacsimile of mass unsolicited, commercial advertising or solicitations"
|
||||||
|
."\nto entities other than the data recipient's own existing customers; or"
|
||||||
|
."\n(b) enable high volume, automated, electronic processes that send"
|
||||||
|
."\nqueries or data to the systems of Registry Operator, a Registrar, or"
|
||||||
|
."\nNIC except as reasonably necessary to register domain names or"
|
||||||
|
."\nmodify existing registrations. All rights reserved. Domain Name Registry reserves"
|
||||||
|
."\nthe right to modify these terms at any time. By submitting this query,"
|
||||||
|
."\nyou agree to abide by this policy."
|
||||||
|
."\n";
|
||||||
|
|
||||||
|
$query3 = "SELECT `name`,`whois_server`,`url`,`abuse_email`,`abuse_phone` FROM `registrar` WHERE `id` = :clid";
|
||||||
|
$stmt3 = $pdo->prepare($query3);
|
||||||
|
$stmt3->bindParam(':clid', $f['clid'], PDO::PARAM_INT);
|
||||||
|
$stmt3->execute();
|
||||||
|
|
||||||
|
$clidF = $stmt3->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$res .= ""
|
||||||
|
."\nRegistry Domain ID:".$f['id']
|
||||||
|
."\nDomain Name:".strtoupper($f['name'])
|
||||||
|
."\nCreated On:".$f['crdate']
|
||||||
|
."\nLast Updated On:".$f['update']
|
||||||
|
."\nExpiration Date:".$f['exdate']
|
||||||
|
."\nRegistrar:".$clidF['name']
|
||||||
|
."\nRegistrar WHOIS Server:".$clidF['whois_server']
|
||||||
|
."\nRegistrar URL:".$clidF['url']
|
||||||
|
."\nRegistrar Abuse Contact Email:".$clidF['abuse_email']
|
||||||
|
."\nRegistrar Abuse Contact Phone:".$clidF['abuse_phone'];
|
||||||
|
|
||||||
|
$query4 = "SELECT `status` FROM `domain_status` WHERE `domain_id` = :domain_id";
|
||||||
|
$stmt4 = $pdo->prepare($query4);
|
||||||
|
$stmt4->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
|
||||||
|
$stmt4->execute();
|
||||||
|
|
||||||
|
while ($f2 = $stmt4->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$res .= "\nStatus:".$f2['status'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$query5 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
|
||||||
|
FROM contact,contact_postalInfo WHERE contact.id=:registrant AND contact_postalInfo.contact_id=contact.id";
|
||||||
|
$stmt5 = $pdo->prepare($query5);
|
||||||
|
$stmt5->bindParam(':registrant', $f['registrant'], PDO::PARAM_INT);
|
||||||
|
$stmt5->execute();
|
||||||
|
|
||||||
|
$f2 = $stmt5->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$res .= "\nRegistry Registrant ID:".$f2['identifier']
|
||||||
|
."\nRegistrant Name:".$f2['name']
|
||||||
|
."\nRegistrant Organization:".$f2['org']
|
||||||
|
."\nRegistrant Street1:".$f2['street1']
|
||||||
|
."\nRegistrant Street2:".$f2['street2']
|
||||||
|
."\nRegistrant Street3:".$f2['street3']
|
||||||
|
."\nRegistrant City:".$f2['city']
|
||||||
|
."\nRegistrant State/Province:".$f2['sp']
|
||||||
|
."\nRegistrant Postal Code:".$f2['pc']
|
||||||
|
."\nRegistrant Country:".$f2['cc']
|
||||||
|
."\nRegistrant Phone:".$f2['voice']
|
||||||
|
."\nRegistrant Phone Ext.:".$f2['voice_x']
|
||||||
|
."\nRegistrant FAX:".$f2['fax']
|
||||||
|
."\nRegistrant FAX Ext.:".$f2['fax_x']
|
||||||
|
."\nRegistrant Email:".$f2['email'];
|
||||||
|
|
||||||
|
$query6 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
|
||||||
|
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='admin' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
||||||
|
$stmt6 = $pdo->prepare($query6);
|
||||||
|
$stmt6->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
|
||||||
|
$stmt6->execute();
|
||||||
|
|
||||||
|
$f2 = $stmt6->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$res .= "\nRegistry Admin ID:".$f2['identifier']
|
||||||
|
."\nAdmin Name:".$f2['name']
|
||||||
|
."\nAdmin Organization:".$f2['org']
|
||||||
|
."\nAdmin Street1:".$f2['street1']
|
||||||
|
."\nAdmin Street2:".$f2['street2']
|
||||||
|
."\nAdmin Street3:".$f2['street3']
|
||||||
|
."\nAdmin City:".$f2['city']
|
||||||
|
."\nAdmin State/Province:".$f2['sp']
|
||||||
|
."\nAdmin Postal Code:".$f2['pc']
|
||||||
|
."\nAdmin Country:".$f2['cc']
|
||||||
|
."\nAdmin Phone:".$f2['voice']
|
||||||
|
."\nAdmin Phone Ext.:".$f2['voice_x']
|
||||||
|
."\nAdmin FAX:".$f2['fax']
|
||||||
|
."\nAdmin FAX Ext.:".$f2['fax_x']
|
||||||
|
."\nAdmin Email:".$f2['email'];
|
||||||
|
|
||||||
|
$query7 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
|
||||||
|
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='billing' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
||||||
|
$stmt7 = $pdo->prepare($query7);
|
||||||
|
$stmt7->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
|
||||||
|
$stmt7->execute();
|
||||||
|
|
||||||
|
$f2 = $stmt7->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$res .= "\nRegistry Billing ID:".$f2['identifier']
|
||||||
|
."\nBilling Name:".$f2['name']
|
||||||
|
."\nBilling Organization:".$f2['org']
|
||||||
|
."\nBilling Street1:".$f2['street1']
|
||||||
|
."\nBilling Street2:".$f2['street2']
|
||||||
|
."\nBilling Street3:".$f2['street3']
|
||||||
|
."\nBilling City:".$f2['city']
|
||||||
|
."\nBilling State/Province:".$f2['sp']
|
||||||
|
."\nBilling Postal Code:".$f2['pc']
|
||||||
|
."\nBilling Country:".$f2['cc']
|
||||||
|
."\nBilling Phone:".$f2['voice']
|
||||||
|
."\nBilling Phone Ext.:".$f2['voice_x']
|
||||||
|
."\nBilling FAX:".$f2['fax']
|
||||||
|
."\nBilling FAX Ext.:".$f2['fax_x']
|
||||||
|
."\nBilling Email:".$f2['email'];
|
||||||
|
|
||||||
|
$query8 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
|
||||||
|
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='tech' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
||||||
|
$stmt8 = $pdo->prepare($query8);
|
||||||
|
$stmt8->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
|
||||||
|
$stmt8->execute();
|
||||||
|
|
||||||
|
$f2 = $stmt8->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$res .= "\nRegistry Tech ID:".$f2['identifier']
|
||||||
|
."\nTech Name:".$f2['name']
|
||||||
|
."\nTech Organization:".$f2['org']
|
||||||
|
."\nTech Street1:".$f2['street1']
|
||||||
|
."\nTech Street2:".$f2['street2']
|
||||||
|
."\nTech Street3:".$f2['street3']
|
||||||
|
."\nTech City:".$f2['city']
|
||||||
|
."\nTech State/Province:".$f2['sp']
|
||||||
|
."\nTech Postal Code:".$f2['pc']
|
||||||
|
."\nTech Country:".$f2['cc']
|
||||||
|
."\nTech Phone:".$f2['voice']
|
||||||
|
."\nTech Phone Ext.:".$f2['voice_x']
|
||||||
|
."\nTech FAX:".$f2['fax']
|
||||||
|
."\nTech FAX Ext.:".$f2['fax_x']
|
||||||
|
."\nTech Email:".$f2['email'];
|
||||||
|
|
||||||
|
$query9 = "SELECT `name` FROM `domain_host_map`,`host` WHERE `domain_host_map`.`domain_id` = :domain_id AND `domain_host_map`.`host_id` = `host`.`id`";
|
||||||
|
$stmt9 = $pdo->prepare($query9);
|
||||||
|
$stmt9->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
|
||||||
|
$stmt9->execute();
|
||||||
|
|
||||||
|
for ($i=0; $i<13; $i++) {
|
||||||
|
$f2 = $stmt9->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$res .= "\nName Server:".$f2['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$res .= "\nDNSSEC:Unsigned";
|
||||||
|
$res .= "\n\n";
|
||||||
|
$server->send($fd, $res . "");
|
||||||
|
|
||||||
|
if ($fp = @fopen("/var/log/whois/whois.log",'a')) {
|
||||||
|
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".getenv('REMOTE_ADDR')."\t-\t".$domain."\n");
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//NOT FOUND or No match for;
|
||||||
|
$server->send($fd, "NOT FOUND");
|
||||||
|
|
||||||
|
if ($fp = @fopen("/var/log/whois/whois_not_found.log",'a')) {
|
||||||
|
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".getenv('REMOTE_ADDR')."\t-\t".$domain."\n");
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$server->send($fd, "Error connecting to the whois database");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the connection
|
||||||
|
$pdo = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register a callback to handle client disconnections
|
||||||
|
$server->on('close', function ($server, $fd) {
|
||||||
|
echo "Client disconnected: {$fd}
|
||||||
|
";
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start the server
|
||||||
|
$server->start();
|
||||||
|
?>
|
1
whois/web/README.md
Normal file
1
whois/web/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
composer require gregwar/captcha
|
36
whois/web/checkWhois.php
Normal file
36
whois/web/checkWhois.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
if (!isset($_POST['domain']) || !isset($_POST['captcha'])) {
|
||||||
|
echo json_encode(['error' => 'Invalid request.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['captcha'] !== $_SESSION['captcha']) {
|
||||||
|
echo json_encode(['error' => 'Incorrect Captcha.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$domain = $_POST['domain'];
|
||||||
|
$whoisServer = 'whois.example.com';
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
$socket = fsockopen($whoisServer, 43, $errno, $errstr, 30);
|
||||||
|
|
||||||
|
if (!$socket) {
|
||||||
|
echo json_encode(['error' => "Error connecting to the Whois server."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite($socket, $domain . "\r\n");
|
||||||
|
while (!feof($socket)) {
|
||||||
|
$output .= fgets($socket);
|
||||||
|
}
|
||||||
|
fclose($socket);
|
||||||
|
|
||||||
|
echo json_encode(['result' => nl2br(htmlspecialchars($output))]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'Invalid request method.']);
|
||||||
|
}
|
62
whois/web/index.php
Normal file
62
whois/web/index.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
|
use Gregwar\Captcha\CaptchaBuilder;
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
$builder = new CaptchaBuilder;
|
||||||
|
$builder->build();
|
||||||
|
$_SESSION['captcha'] = $builder->getPhrase();
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Whois Check</title>
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
|
||||||
|
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||||
|
<script src="script.js"></script>
|
||||||
|
<style>
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.domain-input {
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
.captcha-input {
|
||||||
|
width: 35%;
|
||||||
|
margin-left:10px;
|
||||||
|
}
|
||||||
|
.captcha-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="text-center">Whois Check</h1>
|
||||||
|
<form id="whoisForm">
|
||||||
|
<div class="row">
|
||||||
|
<div class="domain-input">
|
||||||
|
<label for="domain">Domain</label>
|
||||||
|
<input type="text" id="domain" name="domain" placeholder="example.com" required>
|
||||||
|
</div>
|
||||||
|
<div class="captcha-input">
|
||||||
|
<label for="captcha">Captcha</label>
|
||||||
|
<div class="captcha-container">
|
||||||
|
<input type="text" id="captcha" name="captcha" required>
|
||||||
|
<img src="<?php echo $builder->inline(); ?>" id="captchaImage" style="margin-left:10px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="button-primary">Check Whois</button>
|
||||||
|
</form>
|
||||||
|
<div id="result" class="mt-4"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
31
whois/web/script.js
Normal file
31
whois/web/script.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
document.getElementById("whoisForm").addEventListener("submit", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
var formData = new FormData(this);
|
||||||
|
|
||||||
|
xhr.open("POST", "checkWhois.php", true);
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === 4) {
|
||||||
|
var resultDiv = document.getElementById("result");
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
var data = JSON.parse(xhr.responseText);
|
||||||
|
if (data.error) {
|
||||||
|
resultDiv.innerHTML = '<div class="alert alert-danger">' + data.error + '</div>';
|
||||||
|
} else {
|
||||||
|
resultDiv.innerHTML = '<div class="alert alert-success">' + data.result + '</div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resultDiv.innerHTML = '<div class="alert alert-danger">An error occurred. Please try again.</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.onloadstart = function() {
|
||||||
|
document.getElementById("result").innerHTML = '<div class="loading">Loading...</div>';
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send(formData);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue