Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. $query = sprintf("SELECT * from Users where username = ? and password = ?");
  2. $params1 = array( $username, $password);
  3. $stmt = sqlsrv_query($conn, $query, $params1);
  4. if ($stmt === false)
  5. {
  6. die(print_r(sqlsrv_errors(), true));
  7. }
  8.  
  9. $Users = array();
  10.  
  11. while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
  12.  
  13.  
  14. $username1 = $row['username'];
  15. $password1= $row['password'];
  16.  
  17. }
  18.  
  19.  
  20. $Users["username"] = $username1;
  21. $Users["password"] = $password1;
  22.  
  23. //echo json_encode($Users);
  24. echo "you are here";
  25.  
  26. if ($username1==null)
  27. {
  28. return false;
  29. echo "null values";
  30. }
  31.  
  32. else
  33. {
  34. return true;
  35. if (!empty($_SERVER['HTTP_REFERER']))
  36. header("Location: ".$_SERVER['HTTP_REFERER']);
  37. else
  38. echo "No referrer.";
  39. }
  40. echo "nnyou're at the end though";
  41.  
  42. sqlsrv_free_stmt($stmt);
  43.  
  44. sqlsrv_close( $conn );
  45.  
  46.  
  47.  
  48.  
  49. }
  50.  
  51. else{
  52. echo "Connection could not be established.<br />";
  53. die( print_r( sqlsrv_errors(), true));
  54.  
  55. }
  56.  
  57. //echo json_encode($Users);
  58. echo "you are here";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement