- Home /
WWW Class is acting up
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)
Answer by N1warhead · Apr 25, 2017 at 05:27 AM
Omg every time I ask a question i figure it out within 5 minutes, after searching for hours.....
Sorry guys.
Turns out - don't ever use public variables for things you don't need too, because as usual - I forget they don't update values in the inspector once it's added to object.
Sorry guys.
Hope that helps you for anyone facing this issue.
Your answer
Follow this Question
Related Questions
Why isn't this $_POST working properly? 1 Answer
WWWForm.Addfield not able to post data to server 1 Answer
wwwform send an array the right way! 0 Answers
Use the data received from WWW in UI 1 Answer
Problem using WWW with PHP and MYSQL 3 Answers