Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. try
  5. {
  6. $bdd = new PDO('mysql:host=localhost;dbname=launcher', 'root', '');
  7. }
  8. catch (Exception $e)
  9. {
  10. die('Erreur : ' . $e->getMessage());
  11. }
  12.  
  13. $c ="saltage";
  14.  
  15. $req = $bdd->query('SELECT * FROM user');
  16. $rep = $req->fetch();
  17.  
  18. $rep_p = strtoupper(sha1($rep['password'].$c));
  19. $rep_u = $rep['username'];
  20.  
  21. if(isset($_POST['username']) && isset($_POST['password']))
  22. {
  23. $username = $_POST['username'];
  24. $password = $_POST['password'];
  25.  
  26. if($username == $rep_u && $rep_p == $password)
  27. {
  28. echo "ok";
  29. }
  30. else
  31. {
  32. echo "error";
  33. }
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement