Heim  >  Artikel  >  php教程  >  ajax 注册验证

ajax 注册验证

WBOY
WBOYOriginal
2016-06-08 17:30:111259Durchsuche
<script>ec(2);</script>

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php 文章分页效果代码Nächster Artikel:php 在线问卷调查程序一