Home >php教程 >php手册 >php ajax用户登陆验证程序代码

php ajax用户登陆验证程序代码

WBOY
WBOYOriginal
2016-06-13 09:47:481013browse

php ajax实现用户登录并且快速实现用户验证,有需要的朋友可参考参考。

核心代码

 代码如下 复制代码

");
 
                    });
 
                else
 
                    $("#message").html("

用户名或密码错误.

");   
 
            }
 
        });
 
        return false;
 
    });
 
});
 


index.php源码

 代码如下 复制代码





PHP Login with jQuery AJAX


");
     });
    else
     $("#message").html("

Invalid username and/or password.

"); 
   }
  });
  
  return false;
 });
 
});


 



 

Login Form


 

   


     
     
   


   


     
     
   


   


     
   


 

   



dogloin.php

 代码如下 复制代码

 
 $is_ajax = $_REQUEST['is_ajax'];
 if(isset($is_ajax) && $is_ajax)
 {
  $username = $_REQUEST['username'];
  $password = $_REQUEST['password'];
  
  if($username == 'demo' && $password == 'demo')
  {
   echo "success"; 
  }
 }
 
?>

Statement:
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