您好,登錄后才能下訂單哦!
主要是驗證域名的注冊人郵箱是否在用戶驗證過郵箱中。
用到第三方接口。
會有點慢,加一個 進行中。。。加載圖。
前臺代碼:
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(
'<img src="{$TMPL}/p_w_picpaths/loading.gif" /><span>進行中......</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>
--------
后臺代碼:
function verify(){
$this->check_hash_key();
$domain = strim($_REQUEST['domain']);
if($domain=="") {
$data = array('status' => -2, 'info' => "請傳入域名!", '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);
}
}
$sql3 = "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($sql3);
if($db_whois){
//
$domain_id = $this->get_domain_id($domain);
$sql4 = "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($sql4)) {
$data = array('status' => 2, 'info' => "驗證成功!" , 'jump' => "");
ajax_return($data);
}else{
$data = array('status' => -3, 'info' => "驗證成功但數據庫寫入失敗,請聯系客服!" . $db_whois['id'] . "--" . $sql4, 'jump' => "");
ajax_return($data);
}
}else {
$data = array('status' => 2, 'info' => "驗證失敗!", 'jump' => "");
ajax_return($data);
}
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。