Advertisement
Guest User

validateLogin.php

a guest
Apr 16th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. /*
  3. Name: Justin Frye
  4. Project: Create an online bookstore
  5. Purpose: Stores createAccount into database
  6. Course: CSC 242-010 - Spring 2016
  7. Date: April 14, 2016
  8. Due Date: April 18, 2016
  9. */
  10.  
  11. //DATABASE CONNECTION
  12. //define parameters
  13. $DB_HOST='localhost';
  14. $DB_USER='jfrye031';
  15. $DB_PASS='q5tavacA';
  16. $DB_NAME='bookstore_jfrye031';
  17.  
  18.  
  19. //connect to the database
  20. $db = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
  21. //END DATABASE CONNECTION
  22.  
  23.  
  24.  
  25. $email = $_POST['Email'];
  26. $password = $_POST['Passwd'];
  27.  
  28. //attempts to login with the given email & password
  29. $q = mysql_query("select * from Customer where Email='email' and Passwd='password'")
  30. or die(mysql_error());
  31.  
  32. $res = mysql_fetch_row($q);
  33.  
  34. if($res)
  35. {
  36. header('location:websiteHome.php');
  37. }//end if
  38. else
  39. {
  40. echo 'Invalid Email and/or Password. Please try again';
  41. }//end else
  42.  
  43.  
  44. //close the database
  45. $db->close();
  46. ?>
  47. <html>
  48. <head><title> Checking the login.. </title>
  49.  
  50. </head>
  51.  
  52. <body>
  53.  
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement