Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <div class="nav-login">
  2. <form action="login.inc.php" method="post">
  3.  
  4. <input type="text" name="username" placeholder="Username"/><br/>
  5.  
  6. <input type="password" name="password" placeholder="Password" /><br/><br/>
  7.  
  8. <button type="submit" name="submit">login</button>
  9. </form>
  10. </div>
  11.  
  12. <?php
  13.  
  14. if (empty($_POST['username']) || empty($_POST['password'])) {
  15. echo "Username or Password invaild !";
  16. } else {
  17.  
  18. $conn = mysqli_connect('localhost', 'root', '', 'system');
  19. if (!$conn){
  20. die("Connection failed: " . mysqli_connect_error());
  21. } else {
  22. $username = $_POST['username'];
  23. $password = $_POST['password'];
  24. $query = "SELECT * FROM user WHERE uid='$username' AND pwd='$password';";
  25. $result = mysqli_query($conn, $query);
  26. if(mysqli_num_rows($result) > 0) {
  27. $row = mysqli_fetch_array($result);
  28. header('Location: profile.php?id=segev');
  29. } else {
  30. header('Location: index.php?login=eroor');
  31. }
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement