Reply to Re: Parsing .htaccess file

Your name:

Reply:


Posted by Erwin Moller on 10/22/15 11:39

Stefan Bellon wrote:

> Hi all!
>
> I want to parse the contents of an .htaccess file from within PHP. The
> contents of the .htaccess file looks like this:
>
> <Files foobar.tar.gz>
> AuthType Basic
> AuthUserFile /foobar
> AuthName "Foobar"
> <Limit GET>
> Require user FOOBAR
> </Limit>
> </Files>
>
> And so on. When I read in that file with the following code:
>
> $fd = fopen(".htaccess", 'rb');
> while (!feof($fd)) {
> $line = fgets($fd, 1024);
> echo "|".$line."|\n";
> }
> fclose($fd);
>
> Then I get empty lines for those lines containing <Files ...>,
> <Limit ...> and so on. How can I get at those lines as well?
>
> What I need to know is basically the information "which user can access
> which file?"
>


Hi,

Maybe you are in htmlcontext?

What does this produce?

$myLines = file('path/to/.htaccess');
foreach($myLines as $oneLine){
echo htmlentities($oneLine)."<br>";
}

Does that show correctly?

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация