Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. // mysql_config.php
  2. <?php
  3. // MYSQL Konfigurationsdatei
  4.  
  5. mysql_connect("localhost",
  6. "root","","infected_s1");
  7.  
  8.  
  9. ?>
  10.  
  11.  
  12.  
  13.  
  14. //login.html - nur das formular
  15. <form action="login.php" method="post">
  16.         <p>Username:
  17.   <input name="username" type="text" id="username"/>
  18.         </p>
  19.         <p>Password: <input name="password" type="password" id="password"/>
  20.         </p>
  21.         <p>&nbsp;</p>
  22.         <p>
  23.           <input type="submit" name="submit" id="submit" value="Login" />
  24.         </p>
  25.         <p> <br />
  26.         </p>
  27.       </form></p>
  28.  
  29.  
  30.  
  31.  
  32. // login.php
  33. <?php
  34.       include('include/mysql_config.php');
  35.  
  36.       $username = htmlspecialchars($_POST['username']);
  37.       $password = htmlspecialchars(md5($_POST['password']));
  38.      
  39.       if (empty($username) or empty($password)) {
  40.           echo 'Es wurde nichts eingegeben<br><a href="login.html">Zur&uuml;ck</a>';
  41.       }
  42.        
  43.    
  44.       $sql_loginabfrage ="SELECT * FROM `user` WHERE `Username` = '" . $username . "' AND `Password` = '" .$password . "'";
  45.        
  46.       if(mysql_query($sql_loginabfrage) == true) {
  47.  
  48.          echo 'Du bist erfolgreich eingeloggt als: ' . $username;
  49.       } else {
  50.           echo 'Benutzerdaten oder Kennwort falsch. Bitte überprüfen Sie ihre Eingaben';
  51.       }
  52.  
  53.      
  54.      
  55.      
  56.  
  57.       ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement