Home> php教程> PHP源码> body text

ajax 注册验证

WBOY
Release: 2016-06-08 17:30:11
Original
1238 people have browsed it

ajax 注册验证,今天这个文章有一点怪了,就是验证url 是否能被正常访问哦,


博客地址:
*


上面是简单的html代码程序.下面贴出php 验证代码.

if( $ta==0){
if(@file_get_contents($xm)){
echo '

博客地址可以访问
';
}else{
echo '
对不起,你输入的博客地址不能正常访问
';
}
}else{
echo "
对不起,无效的操作!
";
}

好了我还是反ajax 代码也写出来吧,

var xmlHttp = false;

function ajaxcreate(){

try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
if(!xmlHttp){alert('Create Xmlhttp Fail ');return false;}
}

ajaxcreate();
xmvalue=document.getElementById("blog").value;
var url="ajax_check.php?txt="+encodeURI(xmvalue)+"&tag="+encodeURI(str)+"&rd="+Math.random();
if (xmvalue== null || xmvalue.length>200 || xmvalue == "") return false;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send(xmvalue);
xmlHttp.onreadystatechange=returnstate;
}
function returnstate(){
if(xmlHttp.readyState != 4 ){
document.getElementById("u_info").innerHTML="

正在验证请稍后...
";
}
if(xmlHttp.readyState == 4 ){
document.getElementById("u_info").innerHTML=xmlHttp.responseText;

}
}

OK下面这段我以前写过了,不过为了方便还是也写出来了,最后申明一下:本站原创文章转载请注明来: www.111cn.net/phper/php.html

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!