Jump to content

Recommended Posts

Hey.

I got a file like this:

#First line some random comment
someplayername=Stealing 
andanother=\u00A7cAsshat

The filetype is .properties

So, how could I read the file, so the player name, the word before the "=" would be stored somewhere and displayed, and the reason, which is after = would be stored and displayd on the page. That's a banlist of a Minecraft server, so It would be a table like "Player name: john" Reason: "Asshat" also, as you can see the Asshat has "\u00A7c" i'm not sure what "language" or "markup" it is, but i know it stands for light red color. So the script should ignore the light red tags if possible.

Thanks in advance.

or try something like this (example only.)

 

<?php

$content = file_get_contents('http://www.sparkfun.com/commerce/product_info.php?products_id=9279');

preg_match('#<tr><th>(.*)</th> <td><b>price</b></td></tr>#', $content, $match);
$price = $match[1];

preg_match('#<input type="hidden" name="quantity_on_hand" value="(.*?)">#', $content, $match);
$in_stock = $match[1];

echo "Price: $price - Availability: $in_stock\n";
?>

 

or try something like this (example only.)

How is this at all relevant to anything we're discussing?  This parses two distinct values from an HTML document.  The question is on parsing an entire document formatted like an INI file.

Ok, this is my code:

$ini_array = parse_ini_file("$file");

foreach($ini_array as $bans){
echo "<tr>";
echo "<td><i should get the username here></td>";
echo "<td>$bans</td>";
echo "</tr>";
}

I'm totally terrible with arrays, how can I get the username there? :D

Heres a piece of the array:

Array ( [gamegazelle] => Grief [JamesRB] => Grief)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.