Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php include "dbConfig.php";
  2.  
  3. $msg = "";
  4. if (isset($_POST['user']) and isset($_POST['pass'])) {
  5.  
  6. $name = $_POST["user"];
  7. $pass = $_POST["pass"];
  8. $sql = "SELECT * FROM tblUser WHERE struserCode = '$name' AND strUserPass = '$pass'";
  9. $query = mysql_query($sql) or die(mysql_error());
  10. $count = mysql_num_rows($query);
  11.  
  12. if ($name == '' || $password == '') {
  13. $msg = "You must enter all fields";
  14. }
  15.  
  16. else {
  17. if ($count == 1){
  18. $_SESSION['struserCode'] = $username;
  19. header('Location: boot.php');
  20. }
  21. else {
  22. echo "Invalid Login Credentials.";
  23. }
  24. }
  25. }
  26.  
  27. $msg = "Username and password do not match";
  28.  
  29. ?>
  30.  
  31. $username = "root";
  32. $password = "";
  33. $hostname = "localhost";
  34. $output = '';
  35.  
  36. //connection to the database
  37. $dbhandle = mysql_connect($hostname, $username, $password)
  38. or die("Unable to connect to MySQL");
  39.  
  40. $selected = mysql_select_db("homework",$dbhandle)
  41. or die("Could not select examples");
  42.  
  43. <button type="submit" class="submit" name = "submit" action = "boot.php">>> </button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement