Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. <?php
  2. include("header.php");
  3. print "<STYLE>body { font-family: georgia; }</STYLE>";
  4.  
  5. // Validation begins
  6. if(!empty($submit))
  7. {
  8. $error = 0;
  9.  
  10. // Check username. not allowed to leave it empty
  11. if(empty($username))
  12. {
  13. $usernameerr = "Please type your username<BR>";
  14. $error++;
  15. }
  16. // Check password. not allowed to leave it empty
  17. if(empty($password))
  18. {
  19. $passworderr = "Please type your password";
  20. $error++;
  21. }
  22.  
  23. // If there's no error
  24. if($error == 0)
  25. {
  26. // compare what the user type in with the data in the database
  27. $result = mysql_query("select * from member where username = '$username' and password = '$password'");
  28. // if the data doesn't match
  29. if(mysql_num_rows($result) == 0)
  30. {
  31. $loginerr = "Username or password is incorrect. Please try again";
  32. }
  33. // if log in successfully, go to 'Home' page
  34. else
  35. {
  36. $data = mysql_fetch_array($result);
  37. session_register("MEMBERNAME");
  38. session_register("MEMBERID");
  39. $MEMBERNAME = $data["memberfname"];
  40. $MEMBERID = $data["memberid"];
  41. header("location: home.php");
  42. }
  43. }
  44. }
  45.  
  46. print "<center>";
  47. // Menu bar
  48. print "<img src='pic/header.jpg' usemap='#Map'>";
  49. print "<map name='Map' id='Map'><area shape='rect' coords='32,-3,457,168' href='index.php' />";
  50. print "<area shape='rect' coords='524,37,624,67' href='howto.php' />";
  51. print "<area shape='rect' coords='655,89,756,120' href='contact.php' />";
  52. print "<area shape='rect' coords='720,21,822,53' href='aboutus.php' />";
  53. print "</map><BR>";
  54.  
  55. print "<TABLE bordercolor='black' cellpadding='10' cellspacing='0' border='1'><TR><TD>";
  56. // Where error message is printed
  57. print "<center>$usernameerr $passworderr $loginerr</center>";
  58.  
  59. // Log in form
  60. print "<FORM>";
  61. print "<img src='pic/loginlabel.jpg' align=absmiddle><img src='pic/usernamelabel.jpg' align=absmiddle>";
  62. print "<input type=text name=username value=$username>";
  63. print "<img src='pic/passwordlabel.jpg' align=absmiddle><input type=password name=password value=$password>&nbsp;&nbsp;";
  64. print "<input type=submit name=submit value=GO>&nbsp&nbsp<a href='register.php'><img src='pic/signupbutton.jpg' align=absmiddle></a>";
  65. print "</FORM></TABLE>";
  66.  
  67. print "<img src='pic/instruction.jpg'>";
  68.  
  69. // footer
  70. print "<img src='pic/footer.jpg'>";
  71. print "</center>";
  72.  
  73. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement