ftp is very slow, why dont you just make a php script, that handles you the information using httprequest get.
When XGamer suggests it will be slow, I assume he is thinking of the circumstance where the database is maintained centrally and the whole database file is downloaded by each client every time there is a database change and queries are then run locally.
This is not just a slow process, it would be agonisingly slow.
If you want the clients to be able to update the database as well, you would need some control (not available in ftp) to ensure that simultaneous updates made by different clients did not overwrite each other when files were uploaded.
In my opinion, that would be totally impractical.
Of course I could be missing something...
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
TXT = app.CreateText( "Username:", 0.85, 0.03, "Left" )
lay.AddChild( TXT )
edt = app.CreateTextEdit( "TestUser", 0.9 );
lay.AddChild( edt );
TXT = app.CreateText( "Useless Data:", 0.85, 0.03, "Left" )
lay.AddChild( TXT )
edtUD = app.CreateTextEdit( "Some Useless Data :D", 0.9 );
lay.AddChild( edtUD );
TXT = app.CreateText( "", 1, 0.05, "Left" )
lay.AddChild( TXT )
btn = app.CreateButton( "Update Data", 0.6, 0.1 );
btn.SetOnTouch( btn_Update_OnTouch );
lay.AddChild( btn );
btn = app.CreateButton( "Get Data", 0.6, 0.1 );
btn.SetOnTouch( btn_Get_OnTouch );
lay.AddChild( btn );
btn = app.CreateButton( "Create User", 0.6, 0.1 );
btn.SetOnTouch( btn_Create_OnTouch );
lay.AddChild( btn );
TXT = app.CreateText( "", 1, 0.05, "Left" )
lay.AddChild( TXT )
txt = app.CreateText( "", 1, 0.5, "Left,Multiline" );
txt.SetBackColor( "#ff222222" );
txt.SetTextSize( 20 );
lay.AddChild( txt );
app.AddLayout( lay );
}
function btn_Update_OnTouch()
{
var url = "http://CraftTime-Network.de/getData.php?get=UpdateData&UselessData="+edtUD.GetText();
SendRequest( url );
}
function btn_Get_OnTouch()
{
var url = "http://CraftTime-Network.de/getData.php?get=GetData";
SendRequest( url );
}
function btn_Create_OnTouch()
{
var url = "http://CraftTime-Network.de/getData.php?get=CreateData&UselessData="+edtUD.GetText();
SendRequest( url );
}
function SendRequest( url )
{
url += "&id=1985298&user=" + edt.GetText();
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() { HandleReply(httpRequest); };
httpRequest.open("GET", url, true);
httpRequest.send(null);
app.ShowProgress( "Loading..." );
}
function HandleReply( httpRequest )
{
if( httpRequest.readyState==4 )
{
//If we got a valid response.
if( httpRequest.status==200 )
{
data = httpRequest.responseText.replace(/#/g, "\n");
txt.SetText( data )
}
//An error occurred
else
txt.SetText( "Error: " + httpRequest.status + httpRequest.responseText);
}
app.HideProgress();
}