Guest User

Untitled

a guest
Jul 9th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("inc/config.php");
  4. echo("<link href=\"../css/text.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />");
  5.  
  6. $submit = $_POST['login'];
  7. $username = mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username'])));
  8. $password = md5($_POST['password']);
  9.  
  10. if ($submit){
  11. if((!$username) || (!$password) || ($username=='') || ($password=='')){
  12.  
  13. echo("<META http-equiv='refresh' content='4;URL=index.php'>");
  14. echo'<center>Please enter both - username and password!</center>';
  15.  
  16. }
  17.  
  18. $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '".$username."' AND `password`= '".$password."'") OR die(mysql_error());
  19. $c = mysql_num_rows($sql);
  20.  
  21. if($c > 0){
  22. $r = mysql_fetch_array($sql);
  23. $_SESSION['username'] = $r['username'];
  24.  
  25. echo("<META http-equiv='refresh' content='4;URL=index.php'>");
  26. echo'<center>Login successfull!</center>';
  27.  
  28. }else{
  29.  
  30. echo("<META http-equiv='refresh' content='4;URL=index.php'>");
  31. echo "<center>You couldn't be logged in!</center>";
  32.  
  33. }
  34. }
  35. ?>
Add Comment
Please, Sign In to add comment