57 lines
2.5 KiB
PHP
57 lines
2.5 KiB
PHP
<section class="diZContainer diZmxAuto">
|
|
<h2 class="diZBorderBottom">Ultimate Domain & IP Lookup Tool</h2>
|
|
</section>
|
|
<!-- <p class="diZTextJustify">Discover detailed information about any domain and IP address with ease using Who-Is. Our tool provides instant access to essential data, including ownership, registration details, and more, all in a user-friendly interface designed for efficiency and accuracy.</p> -->
|
|
|
|
<form method="post" class="diZToolsSection diZmt4 diZmb4 diZBorderRadius diZPadding5px">
|
|
<div class="diZFlexRowCol diZJustifyCenter diZItemsCenter">
|
|
<input class="diZmr2 diZw70" placeholder="Domain" name="domain" type="text" />
|
|
<p class="diZmr2">OR</p>
|
|
<input class="diZmr2 diZw70" placeholder="IP Address" name="ip" type="text" />
|
|
<input class="diZmr2" type="submit" value="Check" />
|
|
</div>
|
|
</form>
|
|
<?php
|
|
if(isset($_POST['domain']) && $_POST['domain']){
|
|
function validateDomain($domain) {
|
|
$regex = "/^(?!\-)(?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.)+[a-zA-Z]{2,}$/";
|
|
if (preg_match($regex, $domain)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$domain = isset($_POST['domain']) ? $_POST['domain'] : '';
|
|
if ($domain && validateDomain($domain)) {
|
|
$command = 'whois '.$_POST['domain'];
|
|
$escaped_command = escapeshellcmd($command);
|
|
$output = shell_exec($escaped_command);
|
|
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre class="diZTextJustify" style="width: fit-content;"> ',$output, '</pre> <br><br></div>';
|
|
} else {
|
|
echo "Invalid domain.";
|
|
}
|
|
}
|
|
if(isset($_POST['ip']) && $_POST['ip']){
|
|
function validatePublicIp($ip) {
|
|
if (filter_var($ip, FILTER_VALIDATE_IP)) {
|
|
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
$ip = isset($_POST['ip']) ? $_POST['ip'] : '';
|
|
if ($ip && validatePublicIp($ip)) {
|
|
$command = 'whois '.$_POST['ip'];
|
|
$escaped_command = escapeshellcmd($command);
|
|
$output = shell_exec($escaped_command);
|
|
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre> ',$output, '</pre> <br><br></div>';
|
|
} else {
|
|
echo "Invalid IP address.";
|
|
}
|
|
}
|
|
|
|
?>
|
|
|