Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query = sprintf("SELECT * from Users where username = ? and password = ?");
- $params1 = array( $username, $password);
- $stmt = sqlsrv_query($conn, $query, $params1);
- if ($stmt === false)
- {
- die(print_r(sqlsrv_errors(), true));
- }
- $Users = array();
- while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
- $username1 = $row['username'];
- $password1= $row['password'];
- }
- $Users["username"] = $username1;
- $Users["password"] = $password1;
- //echo json_encode($Users);
- echo "you are here";
- if ($username1==null)
- {
- return false;
- echo "null values";
- }
- else
- {
- return true;
- if (!empty($_SERVER['HTTP_REFERER']))
- header("Location: ".$_SERVER['HTTP_REFERER']);
- else
- echo "No referrer.";
- }
- echo "nnyou're at the end though";
- sqlsrv_free_stmt($stmt);
- sqlsrv_close( $conn );
- }
- else{
- echo "Connection could not be established.<br />";
- die( print_r( sqlsrv_errors(), true));
- }
- //echo json_encode($Users);
- echo "you are here";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement