AloneZ

Untitled

Apr 20th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2. require 'conect.php';
  3.  
  4. $servername = "127.0.0.1";
  5. $usernamee = "root";
  6. $passwordd = "";
  7. $dbname = "ssrpdb";
  8.  
  9. $conn = new mysqli($servername, $usernamee, $passwordd, $dbname);
  10. if(isset($_POST["login"]))
  11. {
  12. $username = $_POST["username"];
  13.  
  14. $sql = "SELECT Username FROM characters WHERE Username ='$username'";
  15. $result = $conn->query($sql);
  16. if ($result->num_rows > 0)
  17. {
  18. $sql = "SELECT * FROM characters WHERE Username ='$username'";
  19. $result = $conn->query($sql);
  20. if ($result->num_rows > 0)
  21. {
  22.  
  23. Foreach($result as $row)
  24. {
  25. $id = $row['ID'];
  26. $_SESSION['usuarioID'] = $id;
  27. }
  28. $_SESSION['usuarioNome'] = $username;
  29. $_SESSION['usuarioPass'] = $password;
  30.  
  31.  
  32. header('Location: ../../home.php');
  33. }
  34. else
  35. {
  36. echo "Senha incorreta";
  37. }
  38. }
  39. else
  40. {
  41. echo"Não existe esse usuário no banco";
  42. }
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment