Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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.  
  14. /* If username and password match with those in database, user is take to the members area */
  15. if(isset($count) == 1) {
  16. $_SESSION['username'] = $_POST['username'];
  17. Header("location: members.php");
  18.  
  19. }
  20. /* Otherwise , user is redirected to the login form */
  21. else
  22. {
  23. ?>
  24. <html>
  25. <body>
  26. <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  27. <table border="0">
  28. <tr>
  29. <td>Username: </td><td><input type="text" name="username" />
  30. </td>
  31. </tr>
  32. <tr>
  33. <td>Password: </td><td><input type="password" name="password" />
  34. </td>
  35. </tr>
  36. <tr>
  37. <td>
  38. </td>
  39. <td><input type="submit" name="submit" value="Login" />
  40. </td>
  41. </tr>
  42. <tr>
  43. <td><a href="signup.php">Signup</a>
  44. </td>
  45. </tr>
  46. </table>
  47. </form>
  48. </body>
  49. </html>
  50. <?php
  51. }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement