Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. $host="localhost";
  4. $username="root";
  5. $password="";
  6. $db_name="Hackit";
  7.  
  8. mysql_connect("$host", "$username", "$password")or die("Connection Failed");
  9. mysql_select_db("$db_name")or die("Connection Failed");
  10.  
  11. $username=$_POST['username'];
  12. $password=$_POST['password'];
  13.  
  14. $username = stripslashes($username);
  15. $password = stripslashes($password);
  16. $username = mysql_real_escape_string($username);
  17. $password = mysql_real_escape_string($password);
  18.  
  19. $sql="SELECT * FROM Users WHERE username='$username' and password='$password'";
  20. $res=mysql_query($sql);
  21.  
  22. $count=mysql_num_rows($res);
  23.  
  24. if($count==1){
  25.  
  26. setcookie("loggedin", time()+36000);
  27. header("location:index.php");
  28. }
  29. else{
  30. echo "Wrong Username or Password";
  31. }
  32.  
  33. ?>
  34. <html>
  35. <body>
  36.  
  37. <center>
  38. <form method="post">
  39. <b>Login Panel</b>
  40. <br />
  41.  
  42. Username:<input name="username" type="text">
  43. <br />
  44.  
  45. Password:<input name="password" type="password">
  46. <br />
  47.  
  48. <input type="submit" name="Submit" value="Login">
  49.  
  50. </form>
  51. </center>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement