Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?php
  2.  
  3. $verbindung = mysql_connect("localhost", "root" ,"")
  4. or die("keine verbindung m&ouml;glich.Falsches Passwort oder falscher Benutzername");
  5.  
  6. mysql_select_db("test3")
  7. or die ("keine Datenbank mit diesem Namen gefunden");
  8.  
  9.  
  10. $abfrage = mysql_query(" SELECT * FROM user WHERE userid = 1");
  11.  
  12. // $xy = mysql_query("SELECT * FROM `user` WHERE `password` = 'php123'");
  13.  
  14. echo mysql_num_rows($xy);
  15. ?>
  16.  
  17.  
  18.  
  19. <form method="POST" action="">
  20.  
  21. Username: <input type="text" name="username">
  22. Passwort: <input type="text" name="password">
  23. <input type="submit" name="submit" value="login">
  24.  
  25.  
  26. </form>
  27.  
  28. <?php
  29.  
  30. $xy = mysql_query("SELECT * FROM user WHERE username =  '".$_POST['username']."' AND password = '".md5($_POST['password'])."'");
  31.  
  32.  
  33. if (!empty($_POST['username']) && isset($_POST['username'])  )
  34. if (!empty($_POST['password']) && isset($_POST['password'])  )
  35.  
  36. if (mysql_num_rows ($xy) == 1)
  37.     {
  38.         $user = mysql_fetch_object($xy);
  39.         echo 'Willkommen'.$user->username;
  40.     }
  41.  
  42.         else echo 'pw falsch';
  43.  
  44.  
  45.  
  46. echo "ÄÜ";
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. mysql_close($verbindung);
  54.  
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement