All pastes #243920 Raw Edit

Untitled

public text v1 · immutable
#243920 ·published 2006-11-09 01:24 UTC
rendered paste body
<pre>
<?php
$filename = 'mattie.lst';
$pl = fopen($filename, "r");
$plcontents = fread($pl, filesize($filename));
fclose($pl);
$serverarray = explode("\n", $plcontents);
for ($i = 0; $i < count($serverarray);$i++) {
  $server = $serverarray[$i];
  shell_exec("/tmp/qstat-2.11/qstat -nh -u -ne -P -$server -Ts blank.tmp -Tp players.tmp -of /tmp/tmps.txt");
  $humancount = 0;
  $botcount = 0;
  $filenames = '/tmp/tmps.txt';
  $fps = fopen($filenames, "r");
  $scontents = fread($fps, filesize($filenames));
  fclose($fps);
  $timearray = explode("\n", $scosntents);
  for ($ia = 1; $ia <= count($timearray);$ia++) {
    $time = $timearray[$ia];
    if ($time != "    -1" && $time != "") {
      $humancount++;
    } else {
      $botcount++;
    }
  }
  if ($humancount == "1") {
    $is = "is";
    $player = "player";
  } else {
    $is = "are";
    $player = "players";
  }
  $botcount = $botcount--;
  echo "There $is $humancount $player and $botcount bots on $server.";
}
?></pre>