Skip to content
Snippets Groups Projects
Commit 8e76ca8b authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Revert "added contact availability check"

This reverts commit be7bd273.

Change-Id: I3f26ee868c43a5b473e214aa8a7d8ba91d817ec5
parent fc187a54
No related branches found
No related tags found
No related merge requests found
......@@ -279,77 +279,6 @@ function cozaepp_SaveRegistrarLock($params) {
return $values;
}
# Function to retrieve an available contact id
function _cozaepp_CheckContact($prehash) {
$prehash = $prehash . time() . rand(0, 1000000);
$contactid = substr(md5($prehash), 0,15);
# Get client instance and check for available contact id
try {
$client = _cozaepp_Client();
$contactAvailable = 0;
$count = 0;
while ($contactAvailable == 0) {
# Check if contact exists
$request = $client->request($xml = '
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<check>
<contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>'.$contactid.'</contact:id>
</contact:check>
</check>
</command>
</epp>
');
# Parse XML result
$doc= new DOMDocument();
$doc->loadXML($request);
logModuleCall('Cozaepp', 'RegisterDomain:CheckContact', $xml, $request);
# Pull off status
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$contactAvailable = $doc->getElementsByTagName('id')->item(0)->getAttribute('avail');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes == '1000') {
$values['contact'] = 'Contact Created';
} else if($coderes == '2302') {
$values['contact'] = 'Contact Already exists';
} else if($coderes == '2201') {
$values['contact'] = 'Contact Already exists and is not owned by you';
} else {
$values["error"] = "RegisterDomain/contact-check($contactid): Code ($coderes) $msg";
return $values;
}
$values["status"] = $msg;
# if contact still isn't available attempt to add a random time again rehash and return
if ($contactAvailable == 0) {
$contactAvailable = substr(md5($prehash . time() . rand(0, 1000000) . $count), 0,15);
}
if ($count >= 10) {
break;
}
$count++;
}
return $contactid;
} catch (Exception $e) {
$values["error"] = 'RegisterDomain/EPP: '.$e->getMessage();
return $values;
}
}
# Function to register domain
function cozaepp_RegisterDomain($params) {
# Grab varaibles
......@@ -380,8 +309,7 @@ function cozaepp_RegisterDomain($params) {
$AdminEmailAddress = $params["adminemail"];
$AdminPhone = $params["adminphonenumber"];
# Our details
$contactid = _cozaepp_CheckContact($sld . '.' . $tld);
$contactid = substr(md5($sld . '.' . $tld), 0,15);
# Generate XML for namseverss
if ($nameserver1 = $params["ns1"]) {
......@@ -554,7 +482,7 @@ function cozaepp_TransferDomain($params) {
$AdminEmailAddress = $params["adminemail"];
$AdminPhone = $params["adminphonenumber"];
# Our details
$contactid = _cozaepp_CheckContact($sld . '.' . $tld);
$contactid = substr(md5($sld . '.' . $tld), 0,15);
# Get client instance
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment