Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> php logowanie
czarkowy
post
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 1
Dołączył: 6.08.2017
Skąd: sdsadada

Ostrzeżenie: (0%)
-----


Siemka,
zrobiłem logowanie w php i jest mały problem, otóż za każdym raze jest niepoprawne logowanie, nie ważne czy dobry login i hasło czy zły

index.php
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <meta charset="UTF-8">
  4. <title>Home Page</title>
  5. <link rel="stylesheet" href="index.css">
  6. <link rel="stylesheet" href="register.css">
  7. </head>
  8.  
  9. <form class="form-contener" action="signin.php" mathod="POST">
  10. <input type="text" class="inputText" name="username" placeholder="Your username">
  11. <input type="password" class="inputText" name="pass" placeholder="Your password">
  12. <button type="submit" class="inputSubmit" name="login">Sign In</button>
  13. </form>
  14.  
  15. </body>
  16. </html>


signin.php
  1. <?php
  2.  
  3. include 'db_connect.php';
  4.  
  5. $username = isset($_POST['username']) ? $_POST['username'] : "";
  6. $pass = isset($_POST['pass']) ? $_POST['pass'] : "";
  7.  
  8. $sql = "SELECT * FROM users WHERE username = '$username' AND pass = '$pass'";
  9.  
  10. $result = mysqli_query($conn, $sql);
  11.  
  12. if(!$row = mysqli_fetch_assoc($result)) {
  13. echo "Niezalogowany";
  14. } else {
  15. echo "Zalogowany";
  16. }


o co moze chodzic? :_:
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
viking
post
Post #2





Grupa: Zarejestrowani
Postów: 6 381
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Uruchomiłeś ten kod? Z dokumentacji: A string that contains one or more characters which specify the types for the corresponding bind variables. Ile masz bind values? Ja tam widzę 4. Najpierw podstawiasz zmienne, potem je tworzysz.
Definicja: bool mysqli_stmt_execute ( mysqli_stmt $stmt )

Ten post edytował viking 8.08.2017, 06:51:38
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 02:46