Advertisement
Guest User

Login PhP

a guest
Mar 15th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. if(!$_SESSION)
  6. {
  7.    
  8.    
  9. if ($_POST)
  10. {
  11.     if(isset($_POST["button"]) && $_POST["username"] && $_POST["password"])    
  12.     {
  13.         $db = "LOGINDATEN";
  14.  
  15.        
  16.         $username = mysql_real_escape_string($_POST["username"]);
  17.         $password = mysql_real_escape_string($_POST["password"]);
  18.        
  19.        
  20.         $connection = mysqli_connect("localhost","deruser","daspasswort")
  21.        
  22.         if ($connection)
  23.         {
  24.             $selection = mysql_select_db($db);
  25.            
  26.             if($selection)
  27.             {
  28.                
  29.                 $query = "SELECT * FROM users WHERE username ='$username' AND pw = '$password'AND registerDate is NULL";
  30.                
  31.                 $mysql_query = mysql_query ($query);
  32.                
  33.                 $checkuser = mysql_num_rows($mysql_query);
  34.                 echo "test2";
  35.                 if($checkuser)
  36.                 {
  37.                     echo "test";
  38.                     $_SESSION["username"] = $username; 
  39. ?>                 
  40. <script type="text/javascript">
  41. alert("Sie sind nun eingeloggt");
  42. window.location.href = "seite1.php";
  43.  
  44. </script>
  45. <?php  
  46.                 }
  47.                 else
  48.                 {
  49.                     echo "Passwort oder Benutzername falsch";
  50.                 }
  51.             }
  52.         }
  53.        
  54.    
  55.     }
  56.     else
  57.     {
  58.    
  59.     echo "Bitte fuellen Sie alle Felder aus";
  60.     }
  61.  
  62. }
  63. }
  64.  
  65. else
  66. {
  67.     echo "Sie sind bereits eingeloggt";
  68. }
  69. ?>
  70.  
  71. Das ist der Ursprungscode, hab aber da schon feststellen müssen das wohl einige Funktionen Veraltet sind. Wenn ich dir jetzt meine halb Fertigen Codes schicke bringt das wohl auch nicht mehr.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement