Hey guys, I’m completely confused.
I’ve got like 6 PHP Scripts working fine, but this one just doesn’t budge and I’m completely not understanding what’s going on.
The PHP WORKS (ON THE SERVER), but for some reason in Unity I keep getting the error (At the bottom of this question).
Being it works on the server - I am not getting any error_logs to read. It works perfectly fine on the server, but I keep getting some HTML Errors. (When there isn’t even a tiny piece of HTML anywhere).
Here’s the PHP
(I’m doing it the same exact way as I am with other scripts), so I don’t know what’s going on.).
//Connection
$conn = new PDO ("mysql:host=$servername;dbname=$dbName", $server_username, $server_password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//Check Connection
if(!$conn){
die("Connection failed.");
}
$username = ($_POST['usernamePost']);
$password = ($_POST['passwordPost']);
//$ts = gmdate("Y-m-d\TH:i:s\Z");
$rowE = "";
// We select the HASHED password inside the database, then we feed it our password from Unity,
// Then we use password_verify at the bottom to determine if they are matched.
if($stmt = $conn->prepare("SELECT Password FROM Acts WHERE User=:User")){
$stmt->bindParam(":User",$username);
$stmt->execute();
// Result = the HASHED password, this will not give out an unhashed password.
$result = $stmt->fetchColumn();
}
// Now we verify it.
if(password_verify($password,$result)){
// Load the saved data to the users device.
if($stmt = $conn->prepare("SELECT Timestamp FROM Saves WHERE User=:User")){
$stmt->bindParam(":User",$username);
$stmt->execute();
$rowE = $stmt->fetchColumn();
if(!$rowE){
echo'No Data Found.';
}else{
echo $rowE; // <<<<<< THIS WORKS ON SERVER.
}
}
// die('Verified'); // password MATCHES (HASH) (LOGIN SUCCESSFUL!) - Tells Unity.
}else{
die('Incorrect');// Tells Unity it wasn't successful, so to try again.
}
?>
I keep getting this error.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
webmaster@stonervillevalley.warhead-designz.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<p>Additionally, a 500 Internal Server Error
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
UnityEngine.Debug:Log(Object)
<RemoteUplink>c__Iterator0:MoveNext() (at Assets/Imported/Scripts/DataPersistence/LoadGame.cs:56)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)