ok so when I open my URL is opened in my browser i am getting:
Warning: mysql_connect(): Connection timed out
Connected successfullyinsert into Users values (NULL, ‘Array’, ‘Array’ ‘Array’);
tho in unity I am getting this:
error 404 The requested URL was not found on this server.
(WWW) in the link doesn’t also seem to make a difrance
the link I am using is the same as the one in my browser.
I’ve spent the last 2 days trying to find an answer no threads i have found have presented an answer,
they all just go round in circles without explaining whats going on.
i don’t get why i am getting 404 when it loads in my browser.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LoginRegister : MonoBehaviour {
public string UserLoginURL = "http://mysite.com/login.php";
public string UserRegiesterURL = "http://mysite.com/register.php";
public string Username = "";
public string Pass = "";
public string Email = "";
//fetched from mysql
public Text XPText;
public Image XPbar;
public Text GoldText;
public Text LevelText;
public Text UsernameText;
public Text RankText;
public Text Recorcess;
//setactive when loggedin
public GameObject Logedin;
public GameObject Logedout;
public GameObject AccountSucsess;
//input by player
public Text InputUsername;
public Text InputPassword;
public Text InputEmail;
//------------------------------------------------------------------------------------
public void Loggin()
{
Username = InputUsername.text;
Pass = InputPassword.text;
Debug.Log ("" + Username + Pass + Email); // make sure string is acualy their.
StartCoroutine(LoginUser(Username, Pass));
}
//------------------------------------------------------------------------------------
public void Register()
{
Username = InputUsername.text;
Pass = InputPassword.text;
Email = InputEmail.text;
StartCoroutine(RegisterUser(Username, Pass, Email));
Debug.Log ("" + Username + Pass + Email); // make sure string is acualy their.
}
//------------------------------------------------------------------------------------
IEnumerator LoginUser(string User, string Pass ) {
WWW Login = new WWW (UserLoginURL + "Username" + Username + "Pass" + Pass + "Email" + Email);
yield return Login;
if (Login.error == null) {
// display resaults: ???
string[] splits = Login.text.Split (new char[]{ '>' });
UsernameText.text = splits [0];
GoldText.text = splits [1];
XPText.text = splits [2];
LevelText.text = splits [3];
Recorcess.text = splits [4];
RankText.text = splits [5];
Logedout.SetActive (false);
Logedin.SetActive (true);
} else {
Debug.Log ("" + Login.text); // show me the echo
}
}
//------------------------------------------------------------------------------------
IEnumerator RegisterUser(string User, string Pass, string Email ) {
WWW Register = new WWW (UserRegiesterURL + "Username" + Username + "Pass" + Pass + "Email" + Email);
yield return Register;
if (Register.error == null) {
AccountSucsess.SetActive (true);
Debug.Log ("account Created" + Register.text); // show me the echo
} else {
Debug.Log ("Error" + Register.text); // show me the echo
}
}
} // END OF CLASS //--------------------------------------------------------------------