BF2 Statistics:Size Append
Contents |
Introduction
I know I'm not the only person using the Stats Gathering page to create my own unlock server, etc. To that end, I thought it would be helpful to others to see a code snippet I put together that automatically appends the byte size line to the end of BF2Web queries, i.e. "$ 47 $
". I'm following this rule from the Stats Gathering page:
The last line of the returned data starts with a $ followed by the number of bytes in the message (without tabs, newlines, or the length itself), followed by a final $.
I'm also assuming that, like the rest of the data, this is seperated by tabs. This file is part of an ongoing effort to make my 'fake' scripts as real (and thus effective over time/patches) as possible.
Usage
Somewhere in your php delivery script, insert "require('outputhandler.php');
" or whatever you should decide to name the file. Remove any of the existing fake byte size lines in your output scripts, as this will be automatically appended after all echoing/printing/outputting is done.
outputhandler.php
<?php ob_start('output_handler'); ob_implicit_flush(); function output_handler($output) { $output .= "$\t". strlen(preg_replace('/[\t\n]/', , $output)) ."\t$\n"; return $output; } ?>
External Links
dontcamp.com/code/ - This will be the most up-to-date revision of the script, since it's a symbolic link to the script in use.