Added basic URS support and initial database tables for gTLD

This commit is contained in:
Pinga 2023-08-07 14:21:12 +03:00
parent 3026da96e0
commit 59fa35a252
2 changed files with 104 additions and 0 deletions

45
automation/urs.php Normal file
View file

@ -0,0 +1,45 @@
<?php
$hostname = '{your_imap_server:993/imap/ssl}INBOX';
$username = 'your_email@example.com';
$password = 'your_password';
// Connect to mailbox
$inbox = imap_open($hostname, $username, $password) or die('Cannot connect to mailbox: ' . imap_last_error());
// Search for emails from the two URS providers
$emailsFromProviderA = imap_search($inbox, 'FROM "providerA@example.com" UNSEEN');
$emailsFromProviderB = imap_search($inbox, 'FROM "providerB@example.com" UNSEEN');
// Combine the arrays of email IDs
$allEmails = array_merge($emailsFromProviderA, $emailsFromProviderB);
// Connect to the database using PDO
$pdo = new PDO("mysql:host=your_host;dbname=your_db", "db_username", "db_password");
foreach ($allEmails as $emailId) {
$header = imap_headerinfo($inbox, $emailId);
$from = $header->from[0]->mailbox . "@" . $header->from[0]->host;
$subject = $header->subject;
$date = date('Y-m-d H:i:s', strtotime($header->date));
// Determine the URS provider based on the email sender
$ursProvider = ($from == 'providerA@example.com') ? 'URSPA' : 'URSPB';
// Extract domain name or relevant info from the email (you'd need more specific code here based on the email content)
$body = imap_fetchbody($inbox, $emailId, 1);
$domainName = extractDomainNameFromEmail($body); // You'd have to define this function
// Insert into the database
$stmt = $pdo->prepare("INSERT INTO urs_actions (domain_name, urs_provider, action_date, status) VALUES (?, ?, ?, ?)");
$stmt->execute([$domainName, $ursProvider, $date, 'Suspended']);
}
imap_close($inbox);
function extractDomainNameFromEmail($emailBody) {
// Placeholder function; you'd extract the domain name based on the email format/content
// This is just a basic example
preg_match("/domain: (.*?) /i", $emailBody, $matches);
return $matches[1] ?? '';
}

View file

@ -483,6 +483,65 @@ CREATE TABLE IF NOT EXISTS `users_throttling` (
KEY `expires_at` (`expires_at`) KEY `expires_at` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Flags'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Panel Users Flags';
CREATE TABLE urs_actions (
id INT AUTO_INCREMENT PRIMARY KEY,
domain_name VARCHAR(255) NOT NULL,
urs_provider VARCHAR(255) NOT NULL,
action_date DATE NOT NULL,
status VARCHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='URS Actions';
CREATE TABLE `rde_escrow_deposits` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`deposit_id` VARCHAR(255) UNIQUE, -- Unique deposit identifier
`deposit_date` DATE NOT NULL,
`file_name` VARCHAR(255) NOT NULL,
`file_format` ENUM('XML', 'CSV') NOT NULL, -- Format of the data file
`file_size` BIGINT UNSIGNED,
`checksum` VARCHAR(64),
`encryption_method` VARCHAR(255), -- Details about how the file is encrypted
`deposit_type` ENUM('Full', 'Incremental', 'Differential') NOT NULL,
`status` ENUM('Deposited', 'Retrieved', 'Failed') NOT NULL DEFAULT 'Deposited',
`receiver` VARCHAR(255), -- Escrow agent or receiver of the deposit
`notes` TEXT,
`verification_status` ENUM('Verified', 'Failed', 'Pending') DEFAULT 'Pending', -- Status after the escrow agent verifies the deposit
`verification_notes` TEXT -- Notes or remarks from the verification process
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Escrow Deposits';
CREATE TABLE `icann_reports` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`report_date` DATE NOT NULL,
`type` VARCHAR(255) NOT NULL,
`file_name` VARCHAR(255),
`submitted_date` DATE,
`status` ENUM('Pending', 'Submitted', 'Accepted', 'Rejected') NOT NULL DEFAULT 'Pending',
`notes` TEXT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='ICANN Reporting';
CREATE TABLE `promotion_pricing` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`tld_id` INT UNSIGNED,
`promo_name` VARCHAR(255) NOT NULL,
`start_date` DATE NOT NULL,
`end_date` DATE NOT NULL,
`discount_percentage` DECIMAL(5,2),
`discount_amount` DECIMAL(10,2),
`description` TEXT,
`conditions` TEXT,
FOREIGN KEY (`tld_id`) REFERENCES `domain_tld`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Promotions';
CREATE TABLE `premium_domain_pricing` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`domain_name` VARCHAR(255) NOT NULL,
`tld_id` INT UNSIGNED NOT NULL,
`start_date` DATE NOT NULL,
`end_date` DATE,
`price` DECIMAL(10,2) NOT NULL,
`conditions` TEXT,
FOREIGN KEY (`tld_id`) REFERENCES `domain_tld`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Premium Domains';
INSERT INTO `registry`.`domain_tld` VALUES('1','.COM.XX'); INSERT INTO `registry`.`domain_tld` VALUES('1','.COM.XX');
INSERT INTO `registry`.`domain_tld` VALUES('2','.ORG.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('3','.INFO.XX');