Guest User

Untitled

a guest
Apr 5th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. $query = sqlsrv_query("select * from sessions where password='$password' AND username='$username'");
  2. $rows = sqlsrv_num_rows($query);
  3. if ($rows == 1) {
  4. $_SESSION['login_user']=$username;
  5. header("location: profile.php");
  6. } else {
  7. $error = "Username or Password is invalid";
  8. }
  9.  
  10. $serverName = "serverNameinstancename";
  11. $connectionInfo =
  12. array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
  13. $conn = sqlsrv_connect( $serverName, $connectionInfo);
  14.  
  15. $params = array($username, $password);
  16. $stmt = sqlsrv_query
  17. ($conn,
  18. 'select * from sessions where password=? AND username=?',
  19. $params);
Add Comment
Please, Sign In to add comment