Click to See Complete Forum and Search --> : Auto rank?


mg8
09-21-2003, 07:55 AM
I want to be able to input people's name, then a number associated with them, then rank those people by the number.

So, that the person with the greatest number has 1 next to his name.

Thanks

pyro
09-21-2003, 09:04 AM
We're going to need to know a bit more than you've told us. Are you using a database of flatfile is the biggest thing...

mg8
09-21-2003, 02:51 PM
This is the script:

<?php
set_time_limit(100777);
$firstmarkup = "";
$markup1 = "";
$secondmarkup = "";
$fourthmarkup = "";
echo ("DragonBall Member Update<br><br>");
$names=file("names.txt");
for($i=0;$i<sizeof($names);$i++){
$fname="http://users.ign.com/about/".trim($names[$i]);
$userpage=fread(fopen($fname,"r"),900000);
for($rank=0;$rank<sizeof($names);$rank++) {
$rank++; }
eregi('Posts:</B> </td>
([ ]*)?<td class="BoardRowB">(.*)? <a href(.*)?view latest posts', $userpage,$regs);
$mu[$names[$i]]=$regs[2];
}
arsort($mu, SORT_NUMERIC);
while(list($name,$pc) = each($mu)){
echo <<<END
$firstmarkup $rank $markup1 $pc $secondmarkup$name$thirdmarkup$name$fourthmarkup <br>
END;
}
?>

It reads the file and then stores the number (post count) and then prints it out as well as the name (stored in names.txt). I think I have to make another txt file with the ranks, but I don't know how? :p

Do you see now?