Hey guys and gals, I can't seem to figure out the second part of the preg_match_all to array here
$contents = fread($fp, filesize("tempfile") );
$contents = str_replace("\0","", $contents);
preg_match_all("/TOST Protect: Ident: ([^ ]*) - ([^- ]*) - ([0-9\.]*)/", $contents, $matches);
foreach($matches[1] as $key => $value) { //3
$name = $matches[1][$key];
$ip = $matches[3][$key];
$id = $matches[2][$key];
echo "<br>" .$name. " || " .$ip. " || " .$id. "<br>";
}
What it's matching Part 1
from
TOST Protect: Ident: SomeName - SomeID1111 - 69.76.000.00
outputs....
SomeName || 69.76.000.00 || SomeID1111
I'm trying to match Part 2 and put this into the array as follow's
Here is the text I want to match after this text
Player name : SomeName
match after PlayerName : "SomeName"
match result is in my array
$playername = $matches[4][$key];
TOST Protect: * - Player IP : 69.76.000.00
Player IP : 69.76.000.00
match after Player ip: " 69.76.000.00"
match result is in my array
$playerip = $matches[5][$key];
and so on... with the following
TOST Protect: * - Player Ping : 64
TOST Protect: * - Player P/L : 0
TOST Protect: * - Type : Illegal Tweak : graphics - Code: CC - SRD
TOST Protect: * - Debugmsg : D3DDrv.D3DRenderDevice False
TOST Protect: * - TimeStamps : 133.3
Part 1 and 2 in it's entirity reads as follows. *Note all of these values change from each log file except whats constant for example,
TOST Protect: Ident: ValueChanges - ValueChanges - ValueChanges
TOST Protect: * -------------------------------- *
TOST Protect: * CLIENT CHEAT WARNING *
TOST Protect: * -------------------------------- *
TOST Protect: * - Player name : ValueChanges
TOST Protect: * - Player IP : ValueChanges
TOST Protect: * - Player Ping : ValueChanges
TOST Protect: * - Player P/L : ValueChanges
TOST Protect: * - Type : ValueChanges
TOST Protect: * - Debugmsg : ValueChanges
TOST Protect: * - TimeStamps : ValueChanges
TOST Protect: * -------------------------------- *
preg_match_all puts the changing values into each array
*/<---------working fine------------>*/
$name = $matches[1][$key];
$ip = $matches[3][$key];
$id = $matches[2][$key];
*/<---------Continue Array------------>*/
$playername = $matches[4][$key];
$playerip = $matches[5][$key];
$playerping = $matches[6][$key];
$playerpacketloss = $matches[7][$key];
$type= $matches[8][$key];
$debug = $matches[9][$key];
$stamp = $matches[10][$key];
Thx Everyone
Bimmer