Advertisement
Guest User

Untitled

a guest
Jan 7th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8. <head>
  9. <meta charset="UTF-8">
  10. <title></title>
  11. </head>
  12. <body>
  13. <h1>Logovanje</h1><br>
  14. <form method="GET" action="index.php">
  15. Username <input type="text" name="ime"><br>
  16. Password <input type="password" name="sifra"><br>
  17. Zapamti lozinku <input type="checkbox" name="sacuvaj"><br>
  18. <input type="submit" name="subm" value="Log in">
  19. </form>
  20. <?php
  21. if(isset($_GET['subm']))
  22. {
  23. $fajl= 'nalozi.xml';
  24. $xml= simplexml_load_file($fajl);
  25.  
  26. foreach ($xml->user as $osoba)
  27. {
  28. if($osoba['aktivan']==1 && $osoba->username==$_GET['ime'] && $osoba->password==$_GET['sifra'])
  29. {
  30. setcookie('email', $_GET['ime'], time()+86400*3);
  31. if(isset($_GET['sacuvaj']))
  32. setcookie ('sifra', $_GET['sifra'], time()+86400*3);
  33.  
  34. header("Location:uspesna.php");
  35. }
  36. }
  37. }
  38. else if(isset ($_COOKIE['email']))
  39. {
  40. $_GET['ime']=$_COOKIE['email'];
  41. if(isset($_COOKIE['sifra']))
  42. $_GET['sifra']=$_COOKIE['sifra'];
  43. }
  44. ?>
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement