Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
whmcs-coza-epp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gunter Grodotzki
whmcs-coza-epp
Commits
be7bd273
Commit
be7bd273
authored
10 years ago
by
Charl Mert
Browse files
Options
Downloads
Patches
Plain Diff
added contact availability check
parent
a68fe778
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/registrars/cozaepp/cozaepp.php
+72
-2
72 additions, 2 deletions
modules/registrars/cozaepp/cozaepp.php
with
72 additions
and
2 deletions
modules/registrars/cozaepp/cozaepp.php
+
72
−
2
View file @
be7bd273
...
@@ -279,6 +279,75 @@ function cozaepp_SaveRegistrarLock($params) {
...
@@ -279,6 +279,75 @@ function cozaepp_SaveRegistrarLock($params) {
return
$values
;
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
{
$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 to register domain
function
cozaepp_RegisterDomain
(
$params
)
{
function
cozaepp_RegisterDomain
(
$params
)
{
# Grab varaibles
# Grab varaibles
...
@@ -309,7 +378,8 @@ function cozaepp_RegisterDomain($params) {
...
@@ -309,7 +378,8 @@ function cozaepp_RegisterDomain($params) {
$AdminEmailAddress
=
$params
[
"adminemail"
];
$AdminEmailAddress
=
$params
[
"adminemail"
];
$AdminPhone
=
$params
[
"adminphonenumber"
];
$AdminPhone
=
$params
[
"adminphonenumber"
];
# Our details
# Our details
$contactid
=
substr
(
md5
(
$sld
.
'.'
.
$tld
),
0
,
15
);
$contactid
=
_cozaepp_CheckContact
(
$sld
.
'.'
.
$tld
);
# Generate XML for namseverss
# Generate XML for namseverss
if
(
$nameserver1
=
$params
[
"ns1"
])
{
if
(
$nameserver1
=
$params
[
"ns1"
])
{
...
@@ -482,7 +552,7 @@ function cozaepp_TransferDomain($params) {
...
@@ -482,7 +552,7 @@ function cozaepp_TransferDomain($params) {
$AdminEmailAddress
=
$params
[
"adminemail"
];
$AdminEmailAddress
=
$params
[
"adminemail"
];
$AdminPhone
=
$params
[
"adminphonenumber"
];
$AdminPhone
=
$params
[
"adminphonenumber"
];
# Our details
# Our details
$contactid
=
substr
(
md5
(
$sld
.
'.'
.
$tld
)
,
0
,
15
)
;
$contactid
=
_cozaepp_CheckContact
(
$sld
.
'.'
.
$tld
);
# Get client instance
# Get client instance
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment