$lines = file('/usr/sbin/chatstats/CHATstats.dat'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line) { $stats = explode(" ",$line); $toptalkers .= $stats[4]." ".$stats[0].":"; $allstars .= $stats[6]." ".$stats[0].":"; } $toptalker = explode(":", $toptalkers); $allstar = explode(":", $allstars); rsort($toptalker,SORT_NUMERIC); rsort($allstar,SORT_NUMERIC); foreach ($toptalker as $key => $ttalker) { $statsperson = explode(" ",$ttalker); if ($statsperson[1] == $username) { $ttpos = $key - 1; $ttwords = $statsperson[0]; } } foreach ($allstar as $key2 => $astar) { $statsperson2 = explode(" ",$astar); if ($statsperson2[1] == $username) { $aspos = $key2; $aswords = $statsperson2[0]; } } foreach ($lines as $exstat) { $exstats = explode(" ",$exstat); if ($exstats[0] == $username) { $bans = $exstats[9]; $banned = $exstats[11]; $kicks = $exstats[8]; $kicked = $exstats[10]; } }