Advertisement
Guest User

Untitled

a guest
Jan 25th, 2019
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2. include('database.php');
  3. $username=$_POST["kime"];
  4. $password=$_POST["kloz"];
  5.  
  6. $SQL = "SELECT * FROM users WHERE username='$username' AND password='$password'";
  7. $result = mysqli_query($conn, $SQL);
  8. $count = mysqli_num_rows($result);
  9. $row = mysqli_fetch_assoc($result);
  10. $admin = $row['admin'];
  11. $ID = $row['ID'];
  12.  
  13. if ($count == 1) {
  14. if($admin == 1) {
  15. header('Location:admin.php'); // admin si, idi na admin.php
  16. } else {
  17. header('Location:user.php'); // user si, idi na user.php
  18. }
  19. } else {
  20. header('Location:index.html'); // login podaci krivi, vrati na login page
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement