<?php include"config.php";//session_start();//初始化变量session$name=$_POST["name"]; $password=$_POST["password"];$sql="select * from admins where name='{$name}' and password ='{$password}'"; echo $sql;$smt=$pdo->prepare($sql);$smt->execute();$row=$smt->fetch();if($row){ $_SESSION['name ']=$row['name']; echo"<script>alert('登录成功')</script>"; echo"<script>location='index.php'</script>"; }else{ echo"<script>alert('cuwu')</script>"; //echo"<script>location='denglu.php'</script>";}?>