ajax-php login案例

2021-05-31 17:01

阅读:865

YPE html>

标签:default   rgb   result   list   button   on()   else   use   toc   

  

 

HTML


"en">"UTF-8">
    "X-UA-Compatible" content="IE=edge">
    "viewport" content="width=device-width, initial-scale=1.0">
    Document
"./fa/zx">

"display:none;">

username: "text" name="username" autocomplete="off">
password: "text" name="password" autocomplete="off">
"password" style="height:400px;">flajsdlfk
"com">fdlafd
"" name="com">flaksjdfllfasjdf

 

PHP

php
if(!isset($_POST[username]) || !isset($_POST[password])){
    $arr=array(
        "message"=>"error !",
        "code"=>1
    );
    echo json_encode($arr);
    exit;    
}
$username=$_POST[username];
$password=$_POST[password];
$link=mysqli_connect(localhost,root,cruces,abate);
$sql="select * from users where username=‘$username‘ and password=‘$password‘";
$result=mysqli_query($link,$sql);
$data=mysqli_fetch_all($result,MYSQLI_ASSOC);
if(count($data)){
    $arr=array(
        "message"=>success,
        "code"=>0
    );
}else{
    $arr=array(
        "message"=>" login failed",
        "code"=>2
    );
};

echo json_encode($arr);
exit;
?>

 

ajax-php login案例

标签:default   rgb   result   list   button   on()   else   use   toc   

原文地址:https://www.cnblogs.com/dissipate/p/14639532.html


评论


亲,登录后才可以留言!