Got a little further, players can upload and download tracks online with php/mysql. First make a new table in mysql. With whatever hosting company you use, they probably have a utility to help. Then added this section to the masterserver function_user.php file
if (substr($password,0,8) == "_Custom_")
{
// insert data into table
$query = str_replace("\r", "'", $email);
$result = mysql_query($query);
$result_string = str_replace("\r", "'", $email);
return;
}
Its basically just passing custom data in place of where the players email and password go. I could not get it to pass the quote ' character, so I use a \r instead and then convert that to ' in the php. Its not 'secure' yet either, if someone wanted to, they could hack another players tracks.
In the GC gui script for uploading
if (GetControl("CheckOnlineTracks").GetChecked())
{
String TrackData = ItemName + "~" + ItemPosition.x + "~" + ItemPosition.y + "~" + ItemPosition.z + "~" + ItemRotation.x + "~" + ItemRotation.y + "~" + ItemRotation.z + "~~";
String SQLSend = "INSERT INTO race_tracks_data (track_id, TrackData) VALUES (" + trackindex + " , \r" + TrackData + "\r)";
OnlineAccountRegister( GetSaveGameVariableString("UserName"), "_Custom_", SQLSend);
String result3;
while (result3.IsEmpty())
{
Delay( 0.1);
result3 = OnlineAccountGetRegisterResponse();
}
k++;
thisForm.GetControl("TrackFileDialog").SetTextPlain( "Uploading Item: " + k);
}
And finally for the GC gui downloading
String SQLSend = "SELECT * FROM race_tracks WHERE file_name=\r" + thisForm.GetControl( "TrackList").GetListItemText( index) + "\r LIMIT 1";
OnlineAccountRegister( GetSaveGameVariableString("UserName"), "_Get_Tracks_", SQLSend);
String resultindex;
while (resultindex.IsEmpty())
{
Delay( 0.1);
resultindex = OnlineAccountGetRegisterResponse();
}
int i, j, k, l, m;
String trackindex, trackname;
for (i = 0; i < resultindex.GetLength(); i++)
{
for (j = i + 1; j < resultindex.GetLength(); j++)
{
if (resultindex[j] == 45)
{
trackindex = resultindex.SubString( i, j - i);
i = j + 1;
break;
}
}
}
trackname = thisForm.GetControl( "TrackList").GetListItemText( index);
for (i = 0; i < trackname.GetLength(); i++)
{
if (trackname[i] == 93)
{
trackname = trackname.SubString( i + 2, trackname.GetLength());
break;
}
}
trackname = trackname + " - Downloaded";
String trackFile = "[savegame]/" + trackname + ".track";
OptionsFile track("Track");
track.New( trackFile);
String ItemName;
Vector ItemPosition;
Vector ItemRotation;
SQLSend = "SELECT * FROM race_tracks_data WHERE track_id=\r" + trackindex + "\r";
OnlineAccountRegister( GetSaveGameVariableString("UserName"), "_Get_Track_Data", SQLSend);
String datafeed;
while (datafeed.IsEmpty())
{
Delay( 0.1);
datafeed = OnlineAccountGetRegisterResponse();
}
String dataline;
for (i = 0; i < datafeed.GetLength(); i++)
{
for (j = i + 1; j < datafeed.GetLength(); j++)
{
if (datafeed[j] == 124)
{
dataline = datafeed.SubString( i - 1, j - i);
//print(dataline);
m = 1;
String datapoint;
for (k = 0; k < dataline.GetLength(); k++)
{
for (l = k + 1; l < dataline.GetLength(); l++)
{
if (dataline[l] == 126)
{
datapoint = dataline.SubString( k - 1, l - k);
k = l + 1;
if (m==1)
{
ItemName = datapoint;
m++;
}
else if (m==2)
{
ItemPosition.x = datapoint.ToFloat();
m++;
}
else if (m==3)
{
ItemPosition.y = datapoint.ToFloat();
m++;
}
else if (m==4)
{
ItemPosition.z = datapoint.ToFloat();
m++;
}
else if (m==5)
{
ItemRotation.x = datapoint.ToFloat();
m++;
}
else if (m==6)
{
ItemRotation.y = datapoint.ToFloat();
m++;
}
else if (m==7)
{
ItemRotation.z = datapoint.ToFloat();
m++;
}
//print(datapoint);
break;
}
}
}
track.AddVariable( ItemName,ItemPosition);
track.AddVariable( ItemName + "R",ItemRotation);
track.Save();
i = j + 1;
break;
}
}
}
thisForm.Hide();
LoadGame("../worlds/DragTrack.wld", "../scripts/builder.gsl");
LoadTrack( "[savegame]/" + trackname + ".track");
GetControl("FPS").GetControl("FileName").SetTextPlain( "File Name: " + thisForm.GetControl( "TrackList").GetListItemText( index));