Dynamic007

Untitled

Apr 9th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <body style="background: black; font-family:arial; color:white;">
  2. <script>setTimeout(function() { window.location = "index.html"; }, 2000); </script>
  3. <?php
  4. session_start();
  5. //echo getcwd();
  6. $servername = "localhost";
  7. $username = "root";
  8. $password = "";
  9. $dbname = "musicclub";
  10.  
  11. // Create connection
  12. $conn = new mysqli($servername, $username, $password, $dbname);
  13. // Check connection
  14. if ($conn->connect_error) {
  15.     die("Connection failed: " . $conn->connect_error);
  16. }  
  17.  
  18. $username = $_POST['name'];
  19. $password = $_POST['pass'];
  20.  
  21. if(isset($_GET['login'])) {
  22.    
  23.     $sql = "SELECT * FROM users WHERE name = '$username' AND pass = '$password';";
  24.     $result = $conn->query($sql);
  25.     $_SESSION['name'] = $username;
  26.     if ($result->num_rows > 0) {
  27.         header('Location: main.php');
  28.         die;
  29.     }
  30.     echo "Invalid Password...";
  31.    
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. ?>
Add Comment
Please, Sign In to add comment