I am currently trying to build a online login system, where the user can enter a form with a username and password and login.
To do this, I am using the FHttpModule to send a request to a PHP server to verify it. Except, I’m not sure if it’s possible for PHP to communicate back to the client whether the user information is valid or not.
Basically what I’m trying to ask is how would you go about setting up a two way communication system between the client and the database(MYSQL)? Right now, the client can only send, but not receive. I guess this may be more of a design problem, but I’d like to know how some of you guys got around it. Keep in mind I’d like to avoid direct interaction with the database, if at all possible
UPDATED:
Here is the relevant code:
TSharedRef<IHttpRequest> req = FHttpModule::Get().CreateRequest();
req->SetVerb(TEXT("GET"));
req->SetURL(TEXT("http://localhost/index.php"));
req->SetHeader("Content-Type", "text/plain");
req->SetContentAsString(TEXT("?username="+username+"&password="+password));
req->OnProcessRequestComplete().BindUObject(this, &LoginScreen::CompleteHTTPRequest);
if (!req->ProcessRequest()) {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("The request failed"));
} else {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("The request was processed"));
}
The php echos what is needed on the page, and I am attempting to download the page contents in order to retrieve the message. However, for some reason the CompleteHTTPRequest function is not being called.
I’m not really sure what the problem is, as the code is based off an example I saw. Help would be much appreciated.
As a side note, I realize what I’m doing is not secure (GET instead of POST, plain text passwords), but once I have something working I can fix that.