- Home /
This question was
closed Jun 15, 2013 at 08:28 PM by
Graham-Dunnett for the following reason:
Duplicate Question
Question by
tekkers0751 · Jun 15, 2013 at 07:55 PM ·
wwwloginphpwwwform
Necessary Data Rewind Wasn't Possible WWWForm Error
I am trying to create a login script, and when I run the code I get this error: Necessary Data Rewind Wasn't Possible. Why is this? Any help would be much appreciated.
#pragma strict
var formUser = "";
var formPass = "";
var formText = "";
var formURL = "http://localhost/unity/checkuser.php";
var hash = "45gfv";
function OnGUI () {
GUILayout.BeginArea ( new Rect(Screen.width / 2 - 100, Screen.height / 2 - 50, 300, 500) );
formUser = GUI.TextField (Rect (0, 0, 300, 50), formUser);
formPass = GUI.TextField (Rect (0, 55, 300, 50), formPass);
if(GUI.Button(Rect(0,110,148,50),"Login"))
{
Login();
}
if(GUI.Button(Rect(152,110,148,50),"Register"))
{
//register form
}
GUI.Label (Rect (0, 165, 300, 50), formText.ToString());
GUILayout.EndArea();
}
function Login()
{
var form = new WWWForm();
form.AddField("login_hash", hash);
form.AddField("login_user", formUser);
form.AddField("login_pass", formPass);
var w = WWW(formURL, form);
yield w;
if(w.error != null) {
print(w.error);
formText = "Unexpected Error, Please Try Again.";
}
else {
print("Form Ok");
formText = w.data;
w.Dispose();
}
formUser = "";
formPass = "";
}
Comment