Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
  2. <?php
  3.  
  4. $user = $_GET["korisnik"];
  5. $lozinka = $_GET["pas"];
  6.  
  7. $servername = "localhost";
  8. $username = "root";
  9. $password = "";
  10. $database = "baza";
  11.  
  12. $conn = mysqli_connect($servername, $username, $password, $database);
  13.  
  14. if (!conn)
  15. {
  16. echo "Greška prilikom spajanja na dB!<br>";
  17. }
  18. else
  19. {
  20. echo "Spajanje na dB uspješno!<br>";
  21. }
  22.  
  23. $sql = "SELECT * FROM korisnici WHERE Username='$user' and Pass=$lozinka'";
  24. mysqli_query($conn, "SET NAMES 'utf8'");
  25. $result = $conn->query($sql);
  26.  
  27. echo $result->num_rows;
  28.  
  29. while($row = $result->fetch_assoc())
  30. {
  31. echo "<a href='detail.php?id=" .$row["ID"]."'>".$row["Name"]." </a>";
  32. }
  33.  
  34. $conn->close();
  35.  
  36. ?>
  37.  
  38. <HR>
  39. <H1>I.tehnička škola TESLA</h1>
  40. <H2>Damjan Majić/4.E/B</H2>
  41. <HR>
  42. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement