Advertisement
umasoodch

phpindex

Dec 19th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include('database_1.php');
  4.  
  5. if (isset($_POST['submit']))
  6. {
  7.  
  8. $username = trim($_POST['username']);
  9. $password = trim($_POST['password']);
  10. $query = "SELECT * FROM users WHERE username='$username' AND password = md5('$password')";
  11. $resultnew = mysqli_query($mysqli,$query) or die(mysqli_error());
  12. $num_row = mysqli_num_rows($resultnew);
  13. $row=mysqli_fetch_array($resultnew);
  14. if($num_row ==1)
  15. {
  16. $_SESSION['user_name']=$row['username'];
  17. header('Location:filespage.html');
  18. }
  19. else
  20. {
  21. echo "Invalid login";
  22. }
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement