Original geschrieben von Manofwar am 20-12-2006 15:55
also ich brauch ja dann trim()
also ich brauch ja dann trim()
if (preg_match_all($regex,$zeile,$matches,PREG_SET_ORDER))
{
foreach($matches as $match)
{
$input['playername'][] = $zeile;
}
}
/*Datei auswählen*/
$datei = fopen($logfilename,'r');
/*Absuche nach relevanten Daten*/
while (!feof($datei))
{
$zeile = fgets($datei,1024);
$regex = "/^Playername *: /iU";
$regex1 = "/^Kills *: /iU";
$regex2 = "/^Deaths *: /iU";
if (preg_match_all($regex,$zeile,$matches,PREG_SET_ORDER))
{
foreach($matches as $match)
{
$input['playername'] = $zeile;
}
}
if (preg_match_all($regex1,$zeile,$matches,PREG_SET_ORDER))
{
foreach($matches as $match)
{
$input['kills'] = $zeile;
}
}
if (preg_match_all($regex2,$zeile,$matches,PREG_SET_ORDER))
{
foreach($matches as $match)
{
$input['deaths'] = $zeile;
}
}
}
fclose($datei);
$values = array();
for ($i = 0; $i < sizeof ($input['playername']); $i++)
{
$values[] = "('" . $input['playername'][$i] . "',
'" . $input['kills'][$i] . "',
'" . $input['deaths'][$i] . "')";
}
/*löschen von Playername etc.*/
foreach($values as $key=>$wert)
{
$values[$key] = str_replace(array(' '),'_',$wert);
$values[$key] = str_replace(array('Playername','Kills','Deaths',':'),'',$values[$key]);
echo $values[$key] ;
}
$regex = "/^Playername *: /iU";
$regex1 = "/^Kills *: /iU";
$regex2 = "/^Deaths *: /iU";
Kommentar