Free Online High Scores Service

Miscellaneous Forums/General Discussion/Free Online High Scores Service

I've made a website that game programmers can read/write high scores to: http://scores.paulleduc.com
Anyone can sign up and it's free (and fast). Basically, you can create tables, which are named after your game, which have the scores saved into them. You can edit and delete these tables, and you can edit and delete the scores. It's all fairly basic, you are limited to 3 different fields: name, score, and country(and time submitted of coarse). I must admit, it's not THAT secure, someone would have to know your username, access password, and location of the file, to submit a fake entry. If you have any questions or would like to report a bug (there's bound to be some), post them in this thread. It's about a weeks worth of work.

EDIT:
Oh, and I'm currently working on the 'public table' thing. I'm reaaally busy though, so I won't get a chance to work on it any time soon.

Looks nice, thanks a lot!
But I would like to check the scores without sending the password. Feels a bit more secure if I knew my password wasn't sent as soon as somebody wanted to know the scores. You could maybe add this as an option that is off by default?

Thanks for this service, I'm thinking of adding this to one of my games.

Edit: Another suggestion: Add some space between the tables and the google adds below. Makes everything a bit more readable, imo.

Edit2: Found a bug. I didn't check the country checkbox when I created a table, but I can still send countries when adding a score entries. And it shows up in the list. I think you should strip out the unneeded info, or reject the score. (rejection would be best, imo.)

Thanks :)

I would like to check the scores without sending the password. Feels a bit more secure if I knew my password wasn't sent as soon as somebody wanted to know the scores. You could maybe add this as an option that is off by default?


That's a good point, I'll do that.

Another suggestion: Add some space between the tables and the google adds below. Makes everything a bit more readable, imo.


I'll do that too.

Found a bug. I didn't check the country checkbox when I created a table, but I can still send countries when adding a score entries. And it shows up in the list. I think you should strip out the unneeded info, or reject the score. (rejection would be best, imo.)


The reason I put the 'choose your fields' thing in there was to know what to show on the future public tables. But yeah, rejecting entries that don't input the right info is a good idea, I'll get on that too.

Here is a quick example how to read scores, if anyone is wondering:
Print "Fetching highscores..."

Local scoreserver:tstream = ReadStream("http::scores.paulleduc.com/members/your_member_name/your_table.php?password=your_password")
If Not scoreserver Then
	Print "Unable to connect to scoreserver!"
	End
EndIf

Local buffer:String

While Not Eof( scoreserver )
	buffer :+ ReadLine( scoreserver )
Wend

CloseStream( scoreserver )


Print "Parsing..."

Local score_list:tlist = CreateList()

While Len(buffer) > 0
	Local i = Instr( buffer+"<br>", "<br>" )
	
	If i Then
		score_list.addlast( buffer[..i-1] )
		buffer = buffer[i+3..]
	EndIf
Wend

Print "The scores:"

For Local score:String = EachIn score_list
	Print score
Next


To submit scores just add the &name=myname&score=myscore&country=mycountry stuff at the end of the stream address.



Edit:
Code example a bit more advanced now.

And another suggestion. A setting that limits the ammount of scores returned when fetching the list. Entries that isn't included in the list should probably still be in the table on the server. Is there a limit for how many is alowed?

-Added breaks before the google ads
-Took out password requirement for reading scores

EDIT: You'll have to make a new table for that change to take effect.

A setting that limits the ammount of scores returned when fetching the list. Entries that isn't included in the list should probably still be in the table on the server. Is there a limit for how many is alowed?


There is no limit to how many scores you can write, I figure I'd let the people decide how many scores they want to show by putting it in their code.

There is no limit to how many scores you can write, I figure I'd let the people decide how many scores they want to show by putting it in their code.

And that is what I like to hear. :) But the limit of returned entries was mainly for making things go smoother in case a table contains hundreds or thousands of entries.

Btw, I'm getting a 500 internal server error now. Server down?

Here is the latest code if somebody wants it.
Rem
	publish_score()

	Publish a score at scores.paulleduc.com

	variable overview:
		username				Your username for the site
		table_name			The table you want to publish a score on
		table_password		The password for the table and NOT your own password for the site!
		name					Player name
		score				Player score
		country				Player country
		server_response		After this function is called, this variable holds the response the server
							replied with. If this function returnes false this variable will hold the
							error message.
							
							name,score and country may be Null if the table doesn't use them. 
							However, they cannot 							all be Null.
EndRem
Function publish_score:Int( username:String, table_name:String, table_password:String, name:String, score:String, country:String, server_response:String Var )

	If Not name And Not score And Not country Then 
		server_response = "name, score and country were all Null"
		Return False
	EndIf

	Local address:String = "http::scores.paulleduc.com/members/"+username+"/"+table_name+".php?password="+table_password

	If name Then address:+"&name="+name
	If score Then address:+"&score="+score
	If country Then address:+"&country="+country
	
	Local scoreserver:tstream = ReadStream(address)	
	If Not scoreserver Then 
		server_response = "Unable to connect to scores.paulleduc.com"
		Return False
	EndIf
	
	server_response = ReadLine( scoreserver )
	
	CloseStream( scoreserver )
	
	Return True
EndFunction



Rem
	fetch_highscores()
	
	Fetch a highscore list from scores.paulleduc.com
	
	Variable overview:
		username				Your username for the site
		table_name			The table you want to fetch scores from
		table_password		The password for the table and NOT for the site.
							This may be Null if the table doesn't need a password.
EndRem
Function fetch_highscores:tlist( username:String, table_name:String, table_password:String )

	Local address:String = "http::scores.paulleduc.com/members/"+username+"/"+table_name+".php"
	
	If table_password Then
		address:+"?password="+table_password
	EndIf

	Local scoreserver:tstream = ReadStream(address)
	If Not scoreserver Then
		Return Null
	EndIf

	Local buffer:String

	While Not Eof( scoreserver )
		buffer :+ ReadLine( scoreserver )
	Wend

	CloseStream( scoreserver )

	Local score_list:tlist = CreateList()

	While Len(buffer) > 0
		Local i = Instr( buffer+"<br>", "<br>" )
	
		If i Then
			score_list.addlast( buffer[..i-1] )
			buffer = buffer[i+3..]
		EndIf
	Wend
	
	Return score_list

EndFunction


Yeah, I checked with my web host and they said there are no problems, but it's going real slow, and having periodical downs.... It will probably be fully working in an hour or so, this doesn't normally happen.

Oh and thanks for the code. :)

the limit of returned entries was mainly for making things go smoother in case a table contains hundreds or thousands of entries


I see, good idea. So I should limit the scores to about... 50? then people could show from 1 to 50 scores, yet still be quite fast?

So I should limit the scores to about... 50? then people could show from 1 to 50 scores, yet still be quite fast?


I think 10 or 20 is enough, but make this a setting for each table. That would be great. :)

Oh, and the server is back online again.

I think 10 or 20 is enough, but make this a setting for each table. That would be great. :)


Ok, I'll probably get to that tommorow.

Oh, and the server is back online again.


Isn't working for me :( I'll talk to the web host again.

EDIT: Server up again.

EDIT: Down again.

EDIT: They're fixing it.

EDIT: Fixed.

Also, when any information is wrong i would like that the server replied with an error message. Right now it's sending me a 404 html page if i enter the wrong username or tablename, and nothing at all if the password was wrong.

Good job!

Thanks :)

Also, when any information is wrong i would like that the server replied with an error message. Right now it's sending me a 404 html page if i enter the wrong username or tablename, and nothing at all if the password was wrong.


Ok, I'll change the error pages when I get back home.