2012-08-21 16:55:57 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
App::uses('AppModel', 'Model');
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Domain Name System related
|
|
|
|
*/
|
|
|
|
class Dns extends AppModel {
|
2012-09-18 15:30:32 +02:00
|
|
|
|
|
|
|
public $useTable = false;
|
2012-08-21 16:55:57 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Checks for a valid internet name
|
|
|
|
* Returns true if Name is an existing Domain Host Name, false otherwise
|
|
|
|
* TODO should be renamed
|
2012-09-18 15:30:32 +02:00
|
|
|
*
|
|
|
|
* @param unknown_type $nametotest The Domain Host Name to check for existence.
|
2012-08-21 16:55:57 +02:00
|
|
|
* @return boolean
|
|
|
|
*/
|
2012-09-18 15:30:32 +02:00
|
|
|
|
|
|
|
public function testipaddress ($nametotest) {
|
|
|
|
if (intval($nametotest) > 0) {
|
2012-08-21 16:55:57 +02:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
$ipaddress = $nametotest;
|
|
|
|
$ipaddress = gethostbyname($nametotest);
|
|
|
|
if ($ipaddress == $nametotest) {
|
|
|
|
return false;
|
2012-09-18 15:30:32 +02:00
|
|
|
} else {
|
2012-08-21 16:55:57 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|