Help? *Solved*

Posted by Siert on Aug. 14, 2008, 9:45 p.m.

First of all… 10K!

So my question is whats wrong with this php script?

Quote: highscore.php
<?php

if(isset($_GET["n"]) && isset($_GET["s"]) && isset($_GET["p"]))

{

$file = file("scores.txt");

$higher = 0;

for($f = 0; $f < count($file); $f++)

{

$row = explode("[)><(]",$file[$f]);

$name[] = $row[0];

$score[] = $row[1];

if ($name[$f] == $_GET["n"] && $score[$f]-1+1 <= $_GET["s"]-1+1)

$higher = 1;

}

$rfile = fopen("scorec.txt","w");

$put = 1;

for($a = 0; $a < count($file); $a++)

{

if($score[$a]-1+1 <= $_GET["s"]-1+1 && $put == 1)

{

$row_add = $_GET["n"]."[(><)]".$_GET["s"]."\n";

fwrite($rfile,$row_add);

$put = 0;

}

if($name[$a] != $_GET["n"] || $higher == 0)

{

$row_add = $name[$a]."[(><)]".$score[$a];

fwrite($rfile,$row_add);

}

if($name[$a] == $_GET["n"])

$put = 0;

}

}

?>
Quote: scores.txt
Siert[(><)]10000

Biggs[(><)]9000

Kenon[(><)]8000

Potatoe[(><)]7000

Inky[(><)]6293

Tester[(><)]6000

Serprex[(><)]5000

Buster[(><)]4000

Kilin[(><)]3000

Obelisk[(><)]1000
This is the scorec.txt it creates when the URL is highscore.php?n=Serprex&s=7500&p=password

Quote: scorec.txt
Serprex[(><)]7500

Siert[(><)]10000

[(><)]Biggs[(><)]9000

[(><)]Kenon[(><)]8000

[(><)]Potatoe[(><)]7000

[(><)]Inky[(><)]6293

[(><)]Tester[(><)]6000

[(><)]Serprex[(><)]5000

[(><)]Buster[(><)]4000

[(><)]Kilin[(><)]3000

[(><)]Obelisk[(><)]1000[(><)]
The problem is that it doesn't explode the [(><)]. The first part of the explode is Bigg[(><)]9000. Instead of Bigg then 9000.

Anyone know?

Also, an update on my Coloraze progress.

Zero. I am working on the highscore script (above) and I'm working with darktemp7 on a new file format for faster downloads.

I feel bad because I just got two beta testers and now I got to the slow part of the project and probably wont have anything to give them for a week or two.

Speaking of beta testers, I would like to have one more, volunteers?

Comments

Cesar 16 years, 3 months ago

I was wondering why you there wasn't any updates on coloraze.

Siert 16 years, 3 months ago

Well I want to, but I really can't proceed and try to implement these features later. I would if I could, trust me.

Sadly my revised completion date is today…

RC 16 years, 3 months ago

$row = explode("[)><(]",$file[$f]);

Don't know if this is the problem or not, but maybe this is supposed to be:

$row = explode("[(><)]",$file[$f]);

Unless of course "[)><(]" signifies an explosion.

Siert 16 years, 3 months ago

OMG!, I think thats it!

RC 16 years, 3 months ago

Did that fix the problem?

Siert 16 years, 3 months ago

Yes, thank you.

It worked before, I wonder how I messed it up?

RC 16 years, 3 months ago

Yay!

Bryan 16 years, 3 months ago

Are you going to fancy it up already?