Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2. include_once('_head.php');
  3.  
  4. if(isset($_POST['submit'])){
  5. /* Post entered data */
  6. $username = $_POST['username'];
  7. $password = md5($_POST['password']);
  8.  
  9. /* Check if data is in the database*/
  10. $query=mysql_query("SELECT * FROM users where username='$username' AND password='$password'");
  11. $count=mysql_num_rows($query);
  12.  
  13. /* If username and password match with those in database, user is take to the members area */
  14. if($count == 1) {
  15. $_SESSION['username'] = $_POST['username'];
  16. Header("location: members.php");
  17. }
  18. }
  19. /* Otherwise , user is redirected to the login form */
  20. else
  21. {
  22. ?>
  23. <html>
  24. <body>
  25. <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  26. <table border="0">
  27. <tr>
  28. <td>Username: </td><td><input type="text" name="username" />
  29. </td>
  30. </tr>
  31. <tr>
  32. <td>Password: </td><td><input type="password" name="password" />
  33. </td>
  34. </tr>
  35. <tr>
  36. <td>
  37. </td>
  38. <td><input type="submit" name="submit" value="Login" />
  39. </td>
  40. </tr>
  41. <tr>
  42. <td><a href="signup.php">Signup</a>
  43. </td>
  44. </tr>
  45. </table>
  46. </form>
  47. </body>
  48. </html>
  49. <?php
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement