mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 11:24:52 +00:00
Refactor WHOIS lookups to use hosted heroku app
This commit is contained in:
@@ -400,4 +400,26 @@ function encryptUpgradeLoginEntry($login_password_cleartext, $site_encryption_ma
|
|||||||
return $login_password_ciphertext;
|
return $login_password_ciphertext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get domain expiration date
|
||||||
|
function getDomainExpirationDate($name){
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, "https://itflow-whois.herokuapp.com/$name");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||||
|
$response = json_decode(curl_exec($ch),1);
|
||||||
|
|
||||||
|
if($response){
|
||||||
|
if(is_array($response['expiration_date'])){
|
||||||
|
$expiry = new DateTime($response['expiration_date'][1]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$expiry = new DateTime($response['expiration_date']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $expiry->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default return
|
||||||
|
return '0000-00-00';
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
19
post.php
19
post.php
@@ -5756,13 +5756,11 @@ if(isset($_POST['add_domain'])){
|
|||||||
$mx = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short MX $domain")));
|
$mx = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short MX $domain")));
|
||||||
$whois = trim(strip_tags(mysqli_real_escape_string($mysqli,shell_exec("whois -H $domain | sed 's/ //g' | head -30"))));
|
$whois = trim(strip_tags(mysqli_real_escape_string($mysqli,shell_exec("whois -H $domain | sed 's/ //g' | head -30"))));
|
||||||
|
|
||||||
// Get expiry date for com/org/net domains - This is very hacky. An API would be better.
|
// Get domain expiry date - if not specified
|
||||||
if(!empty($whois && $expire == '0000-00-00')){
|
if($expire == '0000-00-00'){
|
||||||
if(substr($_POST['name'], -3) == 'com' OR substr($_POST['name'], -3) == 'org' OR substr($_POST['name'], -3) == 'net'){
|
$expire = getDomainExpirationDate($name);
|
||||||
$pos = strpos($whois, 'Registry Expiry Date:');
|
|
||||||
$expire = substr($whois, $pos+22,10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$a = '';
|
$a = '';
|
||||||
@@ -5833,14 +5831,7 @@ if(isset($_POST['edit_domain'])){
|
|||||||
$ns = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short NS $domain")));
|
$ns = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short NS $domain")));
|
||||||
$mx = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short MX $domain")));
|
$mx = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short MX $domain")));
|
||||||
$whois = trim(strip_tags(mysqli_real_escape_string($mysqli,shell_exec("whois -H $domain | sed 's/ //g' | head -30"))));
|
$whois = trim(strip_tags(mysqli_real_escape_string($mysqli,shell_exec("whois -H $domain | sed 's/ //g' | head -30"))));
|
||||||
|
$expire = getDomainExpirationDate($name);
|
||||||
// Get expiry date for com/org/net domains - This is very hacky. An API would be better.
|
|
||||||
if(!empty($whois)){
|
|
||||||
if(substr($_POST['name'], -3) == 'com' OR substr($_POST['name'], -3) == 'org' OR substr($_POST['name'], -3) == 'net'){
|
|
||||||
$pos = strpos($whois, 'Registry Expiry Date:');
|
|
||||||
$expire = substr($whois, $pos+22,10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$a = '';
|
$a = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user