Highscore Table

Post your own tutorials, guides and demos.

Post » Sat Nov 15, 2008 4:21 am

To view it with a browser could you insert it into an Iframe?
Also would it be possible to do this using a flatfile?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Nov 15, 2008 8:59 am

[quote="Gullanian":22z75iw3]Good tutorial but keep in mind that if the user finds out the URL the form is posted to (fairly easy to do) then they can "post" their own high scores, as a hack. But as a foundation for a high score board or a high score board for simple games it's a good introduction tutorial![/quote:22z75iw3]
Yeah, I know. But that's easily solved by using some kind of encryption technique that would send a random number to the server along with another one that would be based on the old one (if the generated number is 3, and the "encryption" would be something like (4 + X) * X ^ 3 then the second number would be 9261) and the PHP page could then check if the correct function was used.

[quote="newt":22z75iw3]To view it with a browser could you insert it into an Iframe?
Also would it be possible to do this using a flatfile?[/quote:22z75iw3]
The iframe shouldn't be much harder than

[code:22z75iw3]<iframe name="score">score.php</iframe>[/code:22z75iw3]
But using flatfiles with PHP is a bit more complicated, though fully possible. I will see if I can write you an example later.
B
2
G
4
Posts: 15
Reputation: 1,080

Post » Sat Nov 15, 2008 1:21 pm

[quote:2l0pjuwa]But using flatfiles with PHP is a bit more complicated, though fully possible. I will see if I can write you an example later.[/quote:2l0pjuwa]

Great, no hurries tho. Im using one of those "free hosters" with no database, so that would work well with this.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Dec 13, 2008 4:12 pm

Sorry for the long wait, school have kept me busy. I have managed to make a mod on my script that uses a flat file instead of a regular database. I'm not really sure of how well it works since I haven't been able to test it properly with Construct since MediaFire keeps removing my .cap files :(. Anyways, here's the code:

[code:18ymezra]<?
// File details
$file = "scores.db";

// Loads the database file and sorts it
$file_read = file($file);
sort($file_read, SORT_NUMERIC);
$file_read = array_reverse($file_read);

// Checks if everything has been submitted
if (isset($_POST['name']) && isset($_POST['score'])) {

// Loads the database file
$file_open = fopen($file, 'a');

$name = $_POST['name'];
$score = $_POST['score'];

// Stores the IP adress of the submitted score (in case of cheating)
$ip = $_SERVER['REMOTE_ADDR'];

// Submits the info
$file_content = "\n" . $score . "\t" . $name . "\t" . $ip;
fwrite($file_open, $file_content);

// Closes the file
fclose($file_open);
}

// Displays names and score
$count = 0;

foreach($file_read as $line) {
$file_score = explode("\t", $line);
?>
<b>#<?= ++$count ?></b>&nbsp;|&nbsp;Name:&nbsp;<?= $file_score[1] ?>&nbsp;|&nbsp;Score:&nbsp;<?= $file_score[0] ?><br />
<?
}
?>[/code:18ymezra]
If anyone wants to correct it or upload another working .cap example please feel free to do so.
Oh, right, the database file is named scores.db (just create a blank text file and rename it)
B
2
G
4
Posts: 15
Reputation: 1,080

Post » Sat Dec 13, 2008 6:54 pm

Thanks will give it a try.
Looks a lot easier than with mysql.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sun Feb 01, 2009 1:54 am

Download link wont work :S
B
27
S
3
G
5
Posts: 172
Reputation: 3,628

Post » Thu Feb 05, 2009 3:33 pm

[quote="l33twash0r":1piqxrig]Download link wont work :S[/quote:1piqxrig]
Yeah, I know, MediaFire has removed it two times now and I don't have a backup to replace it with :(
B
2
G
4
Posts: 15
Reputation: 1,080

Post » Tue Jun 02, 2009 3:57 am

You should host it with dropbox or something.
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Wed Jun 03, 2009 2:51 pm

[quote="alspal":1dpzyncm]You should host it with dropbox or something.[/quote:1dpzyncm]

Thanks, never thought of that.

Fix'd:
http://dl.getdropbox.com/u/1011792/Example.cap
B
2
G
4
Posts: 15
Reputation: 1,080

Post » Fri Jun 05, 2009 5:06 pm

[quote:1opebff4]System: Group "nick ja score on" is activated
> nickDisable
> lootaAppend text "asdasdasdasd" + " " + score 0 .Text + " " + nick 1 .Text + " " + "asdasd"
> SendDisable
> hashAppend text MD5 0 .MD5String(loota 1 .Text)
> SendSet button text to "Sending"
> HTTPGet from URL "http://retard-ed.net/hiscore/kehari2.6/SendScore.php?Score="+ score 0 .Text + "&amp;Nick="+ nick 1 .Text +"&amp;HASH=" +hash 2 .Text
> SystemDisable group "nick ja score on"
> SCOREXXXSet 'score' to 0
> anticheat2Set 'real' to 0
> SCOREXXXSet 'Anti' to 0
> SCOREXXXSet 'score2' to 0
[/quote:1opebff4]

I modified few lines that contains info whats isnt public becous of m5 hashing but my hiscore works something like that.
B
27
S
3
G
5
Posts: 172
Reputation: 3,628

PreviousNext

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests