Guest User

Untitled

a guest
Feb 28th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. <head>
  2. <style type="text/css">
  3. .darkblue
  4. {
  5. background-color:#FFFFFF;
  6. color:white;
  7. }
  8. .darkblue A:link{color:white}
  9. .darkblue A:visited{color:white}
  10. .darkblue A:active{color:white}
  11.  
  12. </style>
  13. </head>
  14.  
  15. <?
  16. $page_title='CADFind: Customer Login';
  17.  
  18. include ('includes/header.php');
  19. include ('includes/menu.php');
  20.  
  21.  
  22. // Check for admin_submit, ie a admin has tried to login
  23. if(isset($_POST['member_submit'])) // || isset($_POST['member_submit']))
  24. {
  25. // Check for entered email address
  26. if(empty($_POST['username'])) //&& empty($_POST['member_email'])
  27. {
  28. // Enter email error to array
  29. $errors[] = 'You forgot to enter your email address';
  30. }
  31. else
  32. {
  33. // Assign username variable
  34. $em = $_POST['username'];
  35. }
  36.  
  37. // Check for entered password
  38. if(empty($_POST['password']))
  39. {
  40. // Enter password error to array
  41. $errors[] = 'You forgot to enter your password';
  42. }
  43. else
  44. {
  45. // Assign password variable
  46. $pw = $_POST['password'];
  47. }
  48.  
  49. // If there are no errors, ie the form is filled in correctly
  50. if(empty($errors))
  51. {
  52. // Create query
  53. $query2 = "SELECT member_no FROM cust WHERE username='$un' AND password='$pw'";
  54.  
  55. // Run the query
  56. $result2 = @mysql_query($query2);
  57.  
  58. // Fetch the result and assign to variable
  59. $row = mysql_fetch_array($result2, MYSQL_ASSOC);
  60.  
  61. $id = $row['id'];
  62.  
  63. // Check member exists, ie row was returned
  64. if($row)
  65. {
  66. // Redirect the user to logged in page
  67. header("Location: cust_portal.php?id=$id");
  68. }
  69. else
  70. {
  71. // Query failed to return result, ie there was no match for provided fields. Output errors message to the user
  72. echo ' <p class = "txtBold"> ERROR <br> The following errors occured </p>';
  73. echo ' <center> Your password does not match the username address you have provided <br> Please try again...';
  74.  
  75. // Create back button
  76. echo '<br><br> <a href = "cust_login.php"> Back </a> </center>';
  77. //echo '<p class = "txtBold">' .mysql_error(). '<br> Query: ' .$query1. '</p>';
  78.  
  79. // Kill the script to prevent displaying form
  80. exit();
  81. }
  82. }
  83. else
  84. {
  85. echo ' <p class = "txtBold"> ERROR <br> The following errors occured </p>';
  86.  
  87. foreach($errors as $msg)
  88. {
  89. // Print each error out
  90. echo "<center> - $msg <br> ";
  91. }
  92.  
  93. echo ' <p> Please try again... </p> ';
  94.  
  95. // Create back button
  96. echo ' <a href = "cust_login.php"> Back </a> </center>';
  97.  
  98. // Kill the script, no further processing required
  99. exit();
  100. }
  101.  
  102. }
  103.  
  104. // End of PHP Script
  105.  
  106.  
  107. echo '
  108. <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="400">
  109. <div id="divLogin">
  110. <form method="post" action="cust_login.php"><br>
  111. <h2 align="center"><font face="Calibri" color="#000000">Please login here</h2></font>
  112. <table align="center" height="50%">
  113. <tr>
  114. <td>
  115. <table border="0" cellpadding="5" bgcolor="#0D3B73">
  116.  
  117. <tr>
  118.  
  119. <td><font face="Calibri" color="#FFFFFF">Username:</font></td>
  120. <td><input type="text" name="username" id="txt"></td>
  121.  
  122. </tr>
  123. <tr>
  124.  
  125. <td><font face="Calibri" color="#FFFFFF">Password:</font></td>
  126. <td><input type="password" name="password" id="txt"></td>
  127.  
  128. </tr>
  129. <tr>
  130. <td colspan="2" align="right">
  131. <input type="submit" value="Login" />
  132. <input type = "hidden" name = "cust_submit" value = "TRUE"/>
  133. </td>
  134. </tr>
  135. <tr>
  136. <td colspan="2" align="right"><a href="admin_login.php">
  137. <font face="Calibri" color="#FFFFFF">Admin Login</font></a></td>
  138. </tr>
  139.  
  140. </table>
  141. </td>
  142. </tr>
  143. </table>
  144.  
  145. </form>
  146. </div>
  147. <div id="divLoginError" style="display: block">
  148. </div>
  149. </table>
  150. ';
  151.  
  152. include ('includes/footer.php');
  153.  
  154. ?>
Add Comment
Please, Sign In to add comment