Server Database with txt doc

I know you can get data from websites and stuff. But is there a way I can have text document that only I can update with data that can be updated in game? So for example if somebody made an account on my website and I got the information for the account. Then I added the information to a text file and that file updates over the server so that people can use there login information and sign into the game. Would I need a website for this or could I just use something within unity?

Also I want you to be able to login from a different computer so this has to be over the network.

Or is there another way to go about doing this?

Hi

i solved this problem with php and a little bit of javascript. Write me if you need the php script too. I’ll post my login script for Unity here so you can have a look at it. It’s not very well written but i hope you can get some inputs for your own.

cheerz
Dominik

private var formNick = “”; //this is the field where the player will put the name to login
private var formPassword = “”; //this is his password
private var formNameRegister = “”; //this is the field where the player will put the name to login
private var formEmailRegister = “”; //this is the field where the player will put the name to login
private var formPasswordRegister = “”; //this is his password
var formText = “”; //this field is where the messages sent by PHP script will be in
var formRegisterText = “”;
var URL = “http://INSERT-YOUR_DOMAIN-WITH-YOUR-LOGINSCRIPT-HERE.ch/index.php”; //change for your URL
var hash = “hashcode”; //change your secret code, and remember to change into the PHP file too

var register = “false”;

function Awake(){

//DONT BOTHER THIS ITS JUST FOR THE ANIMATIONS OF THE GUI
GameObject.Find(“LoginScreen”).animation.Play(“LoginScreenFadeIn”, PlayMode.StopAll);
CenterW = Screen.width 0.5;
CenterH = Screen.height
0.5;

}

function onExit(){
Application.Quit();
}

function OpenLoginMenuRegistration () {

//DONT BOTHER THIS ITS JUST FOR THE ANIMATIONS OF THE GUI
GameObject.Find(“LoginScreen”).animation.Play(“LoginScreenFadeOut”, PlayMode.StopAll);
GameObject.Find(“RegistrationScreen”).animation.Play(“RegistrationScreenFadeIn”, PlayMode.StopAll);

}
function CloseLoginMenuRegistration () {

//DONT BOTHER THIS ITS JUST FOR THE ANIMATIONS OF THE GUI
GameObject.Find(“RegistrationScreen”).animation.Play(“RegistrationScreenFadeOut”, PlayMode.StopAll);
GameObject.Find(“LoginScreen”).animation.Play(“LoginScreenFadeIn”, PlayMode.StopAll);

}

function CloseLoginScreen () {

//GameObject.Find(“LoginScreen”).animation.Play(“LoginScreenFadeOut”, PlayMode.StopAll);

}

function callLogin(){
Login();
}

function callRegistration(){
NewEntry();
}

function Login() {

formNick = gameObject.FindWithTag(“EmailInputField”).GetComponent(Text).text;
formPassword = gameObject.FindWithTag(“PasswordInputField”).GetComponent(Text).text;

register = “false”;

var form = new WWWForm(); //here you create a new form connection
form.AddField( “myform_hash”, hash ); //add your hash code to the field myform_hash, check that this variable name is the same as in PHP file
form.AddField( “myform_nick”, formNick );
form.AddField( “myform_registration”, register );
form.AddField( “myform_pass”, formPassword );
var w = WWW(URL, form); //here we create a var called ‘w’ and we sync with our URL and the form
yield w; //we wait for the form to check the PHP file, so our game dont just hang
if (w.error != null) {
print(w.error); //if there is an error, tell us
} else {
print(“Test ok”);
//assume www is the object and is yielded with the value from php bfore this step…
var values : String[ ] = w.text.Split(“*”.ToCharArray());

//here we return the data our PHP told us (i had to split the returns from the php script into an Array)

formText = “Welcome back " + values[1] + " !”;

//here we return the data our PHP told us (everything)

// formText = w.data;

WaitForSeconds (10);

//If login ok then load level

Application.LoadLevel(1);

w.Dispose(); //clear our form in game
}

formNick = “”; //just clean our variables
formPassword = “”;
}

function NewEntry() {

formNameRegister = gameObject.FindWithTag(“NewUserName”).GetComponent(Text).text;
formEmailRegister= gameObject.FindWithTag(“NewUserEmail”).GetComponent(Text).text;
formPasswordRegister = gameObject.FindWithTag(“NewUserPassword”).GetComponent(Text).text;
register = “true”;

var form = new WWWForm(); //here you create a new form connection
form.AddField( “myform_hash”, hash ); //add your hash code to the field myform_hash, check that this variable name is the same as in PHP file
form.AddField( “myform_registration”, register );
form.AddField( “myform_nameRegister”, formNameRegister );
form.AddField( “myform_emailRegister”, formEmailRegister);
form.AddField( “myform_passwordRegister”, formPasswordRegister );

var w = WWW(URL, form); //here we create a var called ‘w’ and we sync with our URL and the form

yield w; //we wait for the form to check the PHP file, so our game dont just hang

if (w.error != null) {
print(w.error); //if there is an error, tell us
} else {
print (w.text);
WaitForSeconds(4);
//assume www is the object and is yielded with the value from php bfore this step…
// formText = w.data; //here we return the data our PHP told us
w.Dispose(); //clear our form in game
}
}