|
Posted by Erwin Moller on 02/17/06 12:21
Stefan Bellon wrote:
> Erwin Moller wrote:
>
>> $myLines = file('path/to/.htaccess');
>> foreach($myLines as $oneLine){
>> echo htmlentities($oneLine)."<br>";
>> }
>>
>> Does that show correctly?
>
> This does print the content correctly, yes, thanks a lot. However, if I
> want to parse (and replace) the content using ereg_replace I get funny
> results as the bracket < seems to be represented as < internally.
> So, when trying to get at the filename, I need to do something like
>
> ereg_replace("<Files (.*)>", "\\1", htmlentities($line))
>
> Wow. Is this the easiest way of filtering out the information? All I
> want to do is build a list of "who may access which file according to
> the information inside the .htaccess file".
>
Hi,
No, it is not the easiest way, but it shows the output right to the browser.
If you use < and > in your output, your webbrowser will interpret that as a
tag.
adding htmlentities replaces the <> (and other problematic characters) by
their HTMLequivalents.
You can do what you were trying to do, but I cannot help you with the
regexp, because I suck at regexpr.
So my response was just a warning to use htmlentities whenever you are
feeding information to a browser, because of the unexpected result you get
when you do not.
Of course: Looking in the source (view source) of the page could help too.
Regards,
Erwin
Navigation:
[Reply to this message]
|