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...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...