Guest User

LOGIN.PHP - THEVIRALHUB.NET

a guest
Jul 11th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. //connect to DATABASE
  3.  
  4. $db = @mysql_connect('localhost','root','');
  5. mysql_select_db('tutorial',$db);
  6. ?>
  7.  
  8. <?php
  9. if(isset($_POST['register'])){
  10. echo "BUTTON PRESSED <br />";
  11. if(!empty($_POST['username']) && !empty($_POST['password'])){
  12. $un = $_POST['username'];
  13. $pw = $_POST['password'];
  14. $get = mysql_query("SELECT username,password FROM users WHERE username='$un' AND password='$pw'");
  15. if($get){
  16. header('Location: index.php');
  17.  
  18. }else{
  19. echo "Oops!";
  20. }
  21. }
  22. }
  23.  
  24. ?>
  25.  
  26. <!--
  27. Login HTmL FORM
  28. -->
  29.  
  30. <form action="" method="POST">
  31. <input type="text" name="username" placeholder="Username" />
  32. <input type="password" name="password" placeholder="Password" />
  33. <input type="submit" name="register" value="register" />
  34.  
  35. </form>
Add Comment
Please, Sign In to add comment