主要是验证域名的注册人邮箱是否在用户验证过邮箱中。
用到第三方接口。
会有点慢,加一个 进行中。。。加载图。
前台代码:
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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。