Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. /* Session */
  4.  
  5. session_start(); //Nicht vergessen
  6. $name = $_POST['email'];
  7.  
  8.  
  9. //Session registrieren
  10. $_SESSION['username'] = $name;
  11.  
  12. /* Session end */
  13.  
  14. $username = filter_input(INPUT_POST, 'email');
  15. $password = filter_input(INPUT_POST, 'password');
  16. if (!empty($username)){
  17. if (!empty($password)){
  18. $host = "127.0.0.1";
  19. $dbusername = "Webinterface";
  20. $dbpassword = "KrstpSx1JFfW7Cxb";
  21. $dbname = "Webinterface";
  22.  
  23. /* $hash = crypt($dbpassword); */
  24.  
  25.  
  26. // Create connection
  27. $conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
  28.  
  29. if (mysqli_connect_error()){
  30. die('Connect Error ('. mysqli_connect_errno() .') '
  31. . mysqli_connect_error());
  32. }
  33. else{
  34. $sql = "SELECT * FROM login WHERE password='$password' AND email='$username'";
  35. $result = $conn->query($sql);
  36. $count = mysqli_num_rows($result);
  37. if($count === 1){
  38. header('Location: home.php');
  39. }else {
  40. echo "Wrong Logindata. - ".$count;
  41. }
  42.  
  43. /*if (){
  44. }
  45. else{
  46. echo "Error: ". $sql ."
  47. ". $conn->error;
  48. }
  49. $conn->close();
  50. }*/
  51. }
  52. }
  53. else{
  54. echo "Password should not be empty";
  55. die();
  56. }
  57. }
  58. else{
  59. echo "E-Mail should not be empty";
  60. die();
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement