Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <style type="text/css">
- .darkblue
- {
- background-color:#FFFFFF;
- color:white;
- }
- .darkblue A:link{color:white}
- .darkblue A:visited{color:white}
- .darkblue A:active{color:white}
- </style>
- </head>
- <?
- $page_title='CADFind: Customer Login';
- include ('includes/header.php');
- include ('includes/menu.php');
- // Check for admin_submit, ie a admin has tried to login
- if(isset($_POST['member_submit'])) // || isset($_POST['member_submit']))
- {
- // Check for entered email address
- if(empty($_POST['username'])) //&& empty($_POST['member_email'])
- {
- // Enter email error to array
- $errors[] = 'You forgot to enter your email address';
- }
- else
- {
- // Assign username variable
- $em = $_POST['username'];
- }
- // Check for entered password
- if(empty($_POST['password']))
- {
- // Enter password error to array
- $errors[] = 'You forgot to enter your password';
- }
- else
- {
- // Assign password variable
- $pw = $_POST['password'];
- }
- // If there are no errors, ie the form is filled in correctly
- if(empty($errors))
- {
- // Create query
- $query2 = "SELECT member_no FROM cust WHERE username='$un' AND password='$pw'";
- // Run the query
- $result2 = @mysql_query($query2);
- // Fetch the result and assign to variable
- $row = mysql_fetch_array($result2, MYSQL_ASSOC);
- $id = $row['id'];
- // Check member exists, ie row was returned
- if($row)
- {
- // Redirect the user to logged in page
- header("Location: cust_portal.php?id=$id");
- }
- else
- {
- // Query failed to return result, ie there was no match for provided fields. Output errors message to the user
- echo ' <p class = "txtBold"> ERROR <br> The following errors occured </p>';
- echo ' <center> Your password does not match the username address you have provided <br> Please try again...';
- // Create back button
- echo '<br><br> <a href = "cust_login.php"> Back </a> </center>';
- //echo '<p class = "txtBold">' .mysql_error(). '<br> Query: ' .$query1. '</p>';
- // Kill the script to prevent displaying form
- exit();
- }
- }
- else
- {
- echo ' <p class = "txtBold"> ERROR <br> The following errors occured </p>';
- foreach($errors as $msg)
- {
- // Print each error out
- echo "<center> - $msg <br> ";
- }
- echo ' <p> Please try again... </p> ';
- // Create back button
- echo ' <a href = "cust_login.php"> Back </a> </center>';
- // Kill the script, no further processing required
- exit();
- }
- }
- // End of PHP Script
- echo '
- <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="400">
- <div id="divLogin">
- <form method="post" action="cust_login.php"><br>
- <h2 align="center"><font face="Calibri" color="#000000">Please login here</h2></font>
- <table align="center" height="50%">
- <tr>
- <td>
- <table border="0" cellpadding="5" bgcolor="#0D3B73">
- <tr>
- <td><font face="Calibri" color="#FFFFFF">Username:</font></td>
- <td><input type="text" name="username" id="txt"></td>
- </tr>
- <tr>
- <td><font face="Calibri" color="#FFFFFF">Password:</font></td>
- <td><input type="password" name="password" id="txt"></td>
- </tr>
- <tr>
- <td colspan="2" align="right">
- <input type="submit" value="Login" />
- <input type = "hidden" name = "cust_submit" value = "TRUE"/>
- </td>
- </tr>
- <tr>
- <td colspan="2" align="right"><a href="admin_login.php">
- <font face="Calibri" color="#FFFFFF">Admin Login</font></a></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </form>
- </div>
- <div id="divLoginError" style="display: block">
- </div>
- </table>
- ';
- include ('includes/footer.php');
- ?>
Add Comment
Please, Sign In to add comment