Verify that the domain name is the domain name of the user

Source: Internet
Author: User


The main is to verify that the domain name's registrant mailbox is in the user-verified mailbox.

Use the third-party interface.

will be a bit slow, plus one in progress ... Load diagram.


Front Code:

Function Verifydomain (val) {
var ajaxurl = app_root+ "/index.php?ctl=uc_domainapply&act=verify";

var query = new Object ();
Query.flag = 1;
Query.fhash = __hash_key__;
Query.domain = val;

$.ajax ({
Url:ajaxurl,
DataType: "JSON",
Data:query,
Type: "POST",
        Beforesend:function () {
$.showsuccess (
' <span> in Progress ......</span> '
);
},
Success:function (ajaxobj) {
if (ajaxobj.status==0)
{
$.showsuccess (Ajaxobj.info,function () {
if (ajaxobj.jump! = ")
Location.href = Ajaxobj.jump;
Else
Location.reload ();
});

}
Else
{
$.showerr (Ajaxobj.info, function () {
if (ajaxobj.jump! = ")
Location.href = Ajaxobj.jump;
Else
Location.reload ();
});
}
},
Error:function (Ajaxobj)
{
Alert ("Error");
}
});

}

</script>


--------

Background code:

function Verify () {
$this->check_hash_key ();
$domain = Strim ($_request[' domain ');
if ($domain = = "") {
$data = Array (' status ' =-2, ' info ' = ' = ' please pass in the domain name! ", ' jump ' =" ");
Ajax_return ($data);
}
Require_once App_root_path. " System/phpwhois/whois.main.php ";

$whois = new Whois ();
$result = $whois->lookup ($domain);
foreach ($result [' RawData '] as $tmp) {
if (Strpos ($tmp, "Egistrant Email")) {
$arr = Explode ("Registrant Email:", $tmp);
}
}

$sql 3 = "SELECT * from". Db_prefix. " C_whois_email where user_id = ". $GLOBALS [' User_info '] [' ID ']." and flag = 1 and email = ' ". Trim ($arr [1])." ' ";

$db _whois = $GLOBALS [' db ']->getrow ($sql 3);
if ($db _whois) {
//
$domain _id = $this->get_domain_id ($domain);
$sql 4 = "Update". Db_prefix. " C_user_domain Set flag = 1 WHERE user_id = ". $GLOBALS [' User_info '] [' ID ']." and domain_id = ". $domain _id;
if ($GLOBALS [' DB ']->query ($sql 4)} {
$data = Array (' status ' = = 2, ' info ' = ' = ' Verify success! ", ' jump ' =" ");
Ajax_return ($data);
}else{
$data = Array (' status ' = + -3, ' info ' = ' = ' validation succeeded but database write failed, please contact customer service! " . $DB _whois[' id ']. "--" . $sql 4, ' jump ' = ' "");
Ajax_return ($data);

}
}else {
$data = Array (' status ' = = 2, ' info ' = ' = ' validation failed! ", ' jump ' =" ");
Ajax_return ($data);
}
}

Verify that the domain name is the domain name of the user

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.