Advertisement
gergelusz

Untitled

May 11th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $error='';
  4. if (isset($_POST['submit'])) {
  5. if (empty($_POST['username']) || empty($_POST['password'])) {
  6. $error = "Username or Password is invalid";
  7. }
  8. else
  9. {
  10.  
  11. $username=$_POST['username'];
  12. $password=$_POST['password'];
  13.  
  14. $connection = mysql_connect("localhost", "root", "");
  15.  
  16. $username = stripslashes($username);
  17. $password = stripslashes($password);
  18. $username = mysql_real_escape_string($username);
  19. $password = mysql_real_escape_string($password);
  20.  
  21. $db = mysql_select_db("adatbazis", $connection);
  22.  
  23. $query = mysql_query("select * from login where password='$password' AND username='$username'", $connection);
  24. $rows = mysql_num_rows($query);
  25. if ($rows == 1) {
  26. $_SESSION['login_user']=$username;
  27. header("location: profile.php");
  28. } else {
  29. $error = "Felhasznalonev vagy ";
  30. }
  31. mysql_close($connection);
  32. }
  33. }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement