Advertisement
Guest User

asdasdasdasdasd

a guest
May 23rd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> test cookies</title>
  5. <meta charset="UTF-8">
  6. <link rel="stylesheet" type="text/css" href="styl.css">
  7.  
  8. </head>
  9. <body>
  10. <div>
  11. <?php
  12. include_once 'baza.php';
  13. include('form.php');
  14. if(isset($_POST['login']) or isset($_POST['password'])){
  15. if( empty($_POST['login']) or empty($_POST['password'])){
  16. echo "błąd danych";
  17. }
  18. else
  19. {
  20. $con = Connect();
  21. $pass = $_POST['password'];
  22. $login = $_POST['login'];
  23.  
  24. $sql = "select id, nick, pass from User where nick = '$login' and pass = '$pass'";
  25.  
  26. $result = mysqli_query($con, $sql);
  27. if(!$result){
  28. echo mysqli_error($con)."<br>";
  29. }else{
  30. $i = 0;
  31. while($row = mysqli_fetch_assoc($result)){
  32. if($i < 1){
  33. session_start();
  34. echo $row['id']." ";
  35. echo $row['nick']."<br>";
  36. $_SESSION['id'] = $row['id'];
  37. $_SESSION['user'] = $row['nick'];
  38. $_SESSION['pass'] = $row['pass'];
  39. echo "<a href=\"show.php\"> Przejdz dalej </a>";
  40. $i++;
  41. }
  42.  
  43. }
  44. }
  45.  
  46.  
  47.  
  48. // include('connect.php');
  49. // $log = $_POST['login'];
  50. // $pass = $_POST['password'];
  51.  
  52. // mysqli_close($conn);
  53.  
  54. }
  55. }
  56. ?>
  57. </div>
  58. </body>
  59. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement