dissipate

  

 

<?php
    session_start();
    // $_SESSION[\'login\']=11;
    echo $_SESSION[\'login\'];
?>

 

 

<?php
    // var_dump($_GET);
    echo \'<br/>\';
    $username=$_GET[\'username\'];
    $password=$_GET[\'password\'];
    $link=mysqli_connect(\'localhost\',\'root\',\'cruces\',\'abate\');
    $sql="select * from users where username=\'$username\' and password=\'$password\'";
    $result=mysqli_query($link,$sql);
    // print_r($result);
    echo \'<br/>\';
    $data=mysqli_fetch_all($result,MYSQLI_ASSOC);
    echo count($data);
    echo \'<br/>\';
    if(count($data)){
        header(\'location: ./home.html\');
      }else{
        echo \'login failed\';
    }
?>    

 

 

login:

 

<?php
  $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)){
    session_start();
    $_SESSION[\'login\']=11;
    $_SESSION[\'username\']=$data[0][\'username\'];
    header(\'location: ./index.php\');
    var_dump($data);
  }else{
    echo \'failed !\';
  }

 

分类:

技术点:

相关文章:

  • 2021-06-04
  • 2021-11-17
  • 2022-02-12
  • 2022-12-23
  • 2022-02-07
猜你喜欢
  • 2022-02-14
  • 2021-12-23
  • 2021-08-15
  • 2022-12-23
  • 2021-07-05
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案