Jump to content

PHP Killboard - Some editing help


Kimzer

Recommended Posts

<?php
$file = 'C:\wamp\www\Killboard\EPChernarus1\PhitLog.txt';
$searchfor = 'Chernarus';
   header('Content-Type: text/html');
   $contents = file_get_contents($file);
$contents = str_replace("(DayzNorway)", "(DayZNorway.com)", $contents);

   $pattern = preg_quote($searchfor, '/');
$contents = str_replace("DayZ Instance: 11", " Map: Chernarus ", $contents);
   $pattern = "/^.*$pattern.*$/m";
$contents = str_replace("PKILL", "Player Killed", $contents);
$contents = str_replace("CLOG", "Combat Logged", $contents);

if(preg_match_all($pattern, $contents, $matches)){
echo "<strong>";
   echo "<div style ='font:11px/21px Arial,tahoma,sans-serif;color:#2983CB'>Killboard Epoch Chernarus: <br>";
echo '', implode(" <br>", $matches[0]);
echo "</strong>";
   }
else 
{
echo "No kills yet. Looks like everyone is playing nice.";
   }
?>

 

Hey guys, my killboard looks like this. But i need some help here.

I am trying to make it use array_reverse to read it in descending order, this to get the newest kills at the top.

 

I couldnt make it work unfortunately. Could someone clean up the code and make it in descending order for me?

I am sure those str_replace functions can be done in a cleaner way than i did it in :p

 

Kimz

Link to comment
Share on other sites

  • 2 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...