I am trying to make a login system in java by using the result that a page gives me when getting the page's content over java like when i get the data from
http://localhost/java.php?un=dubking&password=password
when the login credentials are correct that page will only show "true" as html but when i use the array that has the data from that page wich actually has "true" in it in an if statement the if statement doesn't work, is there something I did wrong or is this just not possible in Java?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
class test2 {
public void calc() {
try {
URL yahoo = new URL("http://localhost/java.php?un=" + username + "&password=" + password);
BufferedReader in = new BufferedReader(
new InputStreamReader(yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
// Process each line.
String html = inputLine;
if (html == "true") {
System.out.print("You have successfully logged in.");
} else {
if (html == "false") {
System.out.println("Wrong username or password.");
}
if (html != "true" && html != "false") {
System.out.println("something went wrong.");
System.out.println(html);
}
}
}
in.close();
} catch (MalformedURLException me) {
System.out.println(me);
} catch (IOException ioe) {
System.out.println(ioe);
}
}
}