-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenomcheck.php
123 lines (111 loc) · 3.55 KB
/
enomcheck.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
namespace RKWhmcsUtils;
require_once(__DIR__ . '/vendor/autoload.php');
$whmcsDomains = (WhmcsDb::buildInstance())->getActiveDomains();
$enom = Enom::buildInstance();
$enomDomains = [];
$enomTldCounts = [];
try {
$enomDomainsRaw = $enom->call('GetDomains', ['Display' => 100]);
foreach ($enomDomainsRaw['domain-list']['domain'] as $domain) {
/*
{
"DomainNameID": "381598879",
"sld": "example",
"tld": "com",
"ns-status": "NA",
"expiration-date": "6/1/2023",
"auto-renew": "Yes",
"wppsstatus": "n/a",
"RRProcessor": "E"
},
*/
$domainName = $domain['sld'] . "." . $domain['tld'];
$enomDomains[$domainName] = [
'expirationDate' => $domain['expiration-date'],
'autoRenew' => $domain['auto-renew']
];
$enomTldCounts[$domain['tld']] = (@$enomTldCounts[$domain['tld']] ?: 0) + 1;
}
} catch (\Exception $e) {
die("Error during eNom API call. Try refreshing the page. Raw error: {$e->getMessage()}");
}
ksort($enomTldCounts);
$allDomains = array_unique(array_merge(array_keys($enomDomains), array_keys($whmcsDomains)));
sort($allDomains);
include(__DIR__ . '/inc/00-head.php');
?>
<style>
.bad {
font-weight: bold;
color: red;
}
#tld-counts {
margin-bottom: 20px;
}
</style>
</head>
<body>
<h1>eNom Check</h1>
<div id="tld-counts">
<h2>TLDs registered in eNom</h2>
<table>
<tbody>
<?php foreach ($enomTldCounts as $tld => $count): ?>
<tr>
<td><?= $tld ?></td>
<td><?= $count ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<h2>Overview</h2>
<table>
<thead>
<th>Domain</th>
<th>In WHMCS?</th>
<th>WHMCS: registrar</th>
<th>eNom Expiration Date</th>
<th>eNom Auto-Renew Enabled?</th>
</thead>
<tbody>
<?php
foreach ($allDomains as $domain):
$whmcsDomain = isset($whmcsDomains[$domain]) ? $whmcsDomains[$domain] : null;
$enomDomain = isset($enomDomains[$domain]) ? $enomDomains[$domain] : false;
$registrar = $whmcsDomain ? $whmcsDomain['registrar'] : '';
$registrarDisplay = '';
if ($whmcsDomain) {
$registrarDisplay = $registrar ?: 'None';
if ($enomDomain) {
$registrarDisplay = $registrar === 'enom' ? 'eNom' : "<span class='bad'>$registrarDisplay</span>";
} else if ($registrar === 'enom') {
$registrarDisplay = "<span class='bad'>eNom</span>";
}
}
$enomExpDisplay = $enomDomain['expirationDate'];
$enomAutoRenewDisplay = $enomDomain ? $enomDomain['autoRenew'] ? 'Yes' : 'No' : '';
if ($enomDomain) {
if ($enomDomain['autoRenew']) {
// Bad, should be 'No', renewal only to be triggered by WHMCS after payment
$enomAutoRenewDisplay = '<span class="bad">Yes</span>';
}
} elseif ($registrar === 'enom') {
$enomExpDisplay = '<span class="bad">Missing</span>';
$enomAutoRenewDisplay = '<span class="bad">Missing</span>';
}
?>
<tr>
<td><?= $domain ?></td>
<td><?= $whmcsDomain ? 'Yes' : '<span class="bad">Missing</span>' ?></td>
<td><?= $registrarDisplay ?></td>
<td><?= $enomExpDisplay ?></td>
<td><?= $enomAutoRenewDisplay ?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</body>