try this... obviously you'll need to adapt it for you exact needs but it works for me
modlist.txt :
Code:
admin1
admin2
admin3
~
mod1, Modification X version 3
mod2, Modification Y version 2
mod3, Modification Z version 5
~
halfmod1, Halfmod A version 2
halfmod2, Halfmod B version 7
halfmod3, Halfmod C version 3
phpfile
PHP Code:
<?php
/* first read in modlists.txt */
if ( !$modlist = file_get_contents ( "modlist.txt" ) )
{
echo "something went wrong...";
}
else
{
$allthree = explode( "~", $modlist );
$admins = explode( "\n", $allthree[0] );
$fullmods = explode( "\n", $allthree[1] );
$halfmods = explode( "\n", $allthree[2] );
/* add all admins to associative array */
for ( $i = 0; $i < sizeof($admins) -1; $i++) // remove trailing newline
{
$trimmed = trim($admins[$i]);
$adminsAA[$trimmed] = $trimmed;
}
/* add all fullmods to associative array */
for ($i = 0; $i < sizeof($fullmods); $i++)
{
$fullmods[$i] = explode( ",",$fullmods[$i] );
}
for ($i = 1; $i < sizeof($fullmods) - 1; $i++) // remove leading newline
{
$trimmed = trim($fullmods[$i][1]);
$fullmodsAA[$fullmods[$i][0]] = $trimmed;
}
/* now add all halfmods to associative array */
for ($i = 1; $i < sizeof($halfmods); $i++) // remove leading newline
{
$halfmods[$i] = explode( ",",$halfmods[$i] );
}
for ($i = 1; $i < sizeof($halfmods); $i++)
{
$trimmed = $halfmods[$i][1];
$halfmodsAA[$halfmods[$i][0]] = $trimmed;
}
}
if ( !$playerlistTXT = file_get_contents ( "playerlist.txt" ) )
{
echo "something went wrong...";
}
else
{
$playersArray = explode( "\n", $playerlistTXT);
for ( $i = 0; $i < sizeof($playersArray); $i++)
{
$playersArray[$i] = explode ( "\t", $playersArray[$i] );
$name = trim($playersArray[$i][0]);
$team = trim($playersArray[$i][1]);
$score = trim($playersArray[$i][2]);
$kills = trim($playersArray[$i][3]);
$deaths = trim($playersArray[$i][4]);
$ping = trim($playersArray[$i][5]);
/* this will make any admins bolded */
if(!$adminsAA[$name] == "")
$name = "<b> " . $name . " </b>";
/* add the stuff you want to do with the modification stuff here
ie
if(!$fullmodsAA[$fullmod] == "")
$fullmod = "<b> " . $fullmodsAA[$fullmod] . "</b>";
if(!$halfmodsAA[$fullmod] == "")
$halfmod = "<b> " . $halfmodsAA[$fullmod] . "</b>";
*/
echo $name . ", " . $team . ", " . $score . ", " . $kills . ", " . $deaths . ", " . $ping . "<br />";
$query = "INSERT INTO status (name, team, score, kills, deaths, ping) values ($name, $team, $score, $kills, $deaths, $ping)";
/* if (!mysql_query($query) */
}
}
?>