Advertisement
Guest User

asd

a guest
Nov 28th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2. session_start();
  3. function redirect($url){
  4. header('Location:' . $url);
  5. exit();
  6. }
  7. mysql_connect('localhost','Ucenik','bojan123') or die('Pokusaj opet glavonja!');
  8. mysql_select_db('skola');
  9.  
  10.  
  11.  
  12.  
  13. if(isset($_POST['submit'])){
  14. $username = $_POST['username'];
  15. $password = $_POST['password'];
  16. $ime = $_SESSION['name'];
  17.  
  18.  
  19. $query = mysql_query("SELECT * FROM `users` WHERE username='$username' AND password='$password' AND id='$ime'");
  20.  
  21.  
  22. while($info = mysql_fetch_array($query)){
  23. $dusername = $info['username'];
  24. $dpassword = $info['password'];
  25. }
  26.  
  27. if(empty($username) && empty($password)){
  28. echo "Popuni sva polja!";
  29. }elseif($username != $dusername && $password != $dpassword){
  30. echo "Netacno!";
  31. }else{
  32. echo "Tacno!";
  33. }
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. ?>
  42.  
  43.  
  44.  
  45. <form action='login.php' method='POST'>
  46. <input type="text" name='username' placeholder='username'>
  47. <input type='password' name='password' placeholder='password'>
  48. <input type='submit' value='Login IN!' name='submit'>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement