hi all
So i am using this code http://www.unifycommunity.com/wiki/index.php?title=Server_Side_Highscores . Database and php side seems to work fine, but when i launch a game i get - There was an error posting the high score. FTP response failed. What cold be the problem?
FTP is wierd since that script doesn’t use ftp at all.
Can you post the full error ?
Ah i wound error, i changed a code a bit.
private var secretKey=“1345”;
var addScoreUrl=“What happened to the old ZXQ website? | ZXQ”;
var highscoreUrl=“What happened to the old ZXQ website? | ZXQ”;
var name: String;
var score: int;
function Start() {
// getScores();
postScore(“Henry”,3210); <----------------------------------------error
}
function postScore(name:String, score:int){
var hash=md5.Md5Sum(name + score + secretKey);
var highscore_url = addScoreUrl + “name=” + WWW.EscapeURL(name) + “&score=” + score + “&hash=” + hash;
// Post the URL to the site and create a download object to get the result.
hs_post = WWW(highscore_url);
yield hs_post;
if(hs_post.error) {
print(“There was an error posting the high score” + hs_post.error);
}
}
but still i dont quite understand haw can i post something.
Well, according to the error in the screen shot, your error is on line 24 specifically… I tried counting your lines, but it appears there is no Line 24. What is on that line in your script?
Also, I would remove all the information like the secret key and stuff from your code… never know where malicious users might reside and it is irrelevant to the problem.
line 24 is this one → if(hs_post.error) {
now there is no more this ftp error, but posting still don’t work. or i am doing something wrong…
Oh… I see the error now…
WWW.error is a string, not a boolean. try changing the conditional to something like this:
if(hs_post.error == null)
{
Debug.Log(hs_post.error);
}
it should be :
www.error != null
no use checking for an error when it’s null
If your using the Display Portion of the Wiki.
Be aware that there is an XSS Hole in the Code.
Research: Cross Site Scripting
Good call… sorry, brain fart. haha