markc Posted October 26, 2003 Posted October 26, 2003 I am using the great php script - aMember for password protection of a directory. I am using the Protection Plugin: php_include with auto_prepend. I created a directory called "protected" in my public_html directory. I then created a simple single web page for testing purposes. The web page works very well in my protected directory. Here is the code for the web page: ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>Test</title> </head> <body> <p>It worked!</p> <p><a href="../amember/plugins/protect/php_include/logout.php"><b>Logout</b></a></p> </body> </html> But when I added the line: ><?xml version="1.0" encoding="US-ASCII"?> to the top of the html code (because my future web page will include xml code) and try to access the web page I get a php parse error: >Parse error: parse error in /home/../public_html/protected/index3.php on line 1 . Here is what is in my .htaccess file (of the protected directory): >AddType application/x-httpd-php .html AddType application/x-httpd-php .htm php_value auto_prepend_file protect.inc.php I also happen to have a .htaccess file in my public_html directory. Does anyone know why when I add the one xml declare line to the top of my html web page that I get a php parse error? Is my server not setup to allow for using xml in a "protected" directory? Thanks Mark Quote
TCH-Don Posted October 26, 2003 Posted October 26, 2003 I seem to remember if you use the XML TAG <? in a php document, you need to turn the php short tag <? off in your php.ini to keep the php engine from becoming confused. for here since you cannot edit php.ini, you should be able to add to .htaccess php_flag short_open_tag Off of course this is from memory You may want to check a book or google. Quote
markc Posted October 27, 2003 Author Posted October 27, 2003 Turtle, I added the suggested line to my .htaccess file and it did get rid of the php parse error. But it then eliminated the login security screen from coming up. The web page is displayed without first making you log into the system using a user name and password. It also caused other problems on the displayed web page. Like my cgi counter (bscounter) did not show up. And some centering of links and buttons (images) done with CSS did not get centered at all. Also some unwanted symbols related to a xml declare line showed up on the web page. But maybe your suggestion is a start on what to modify or test to find a solution. The reason I had to use "index.php" in the protected folder as opposed to "index.html" is because my browser (Netscape) and also while using Internet Explorer did not know what to do with the index.html file. The browser asked me if wanted to save a file instead of serving the web page. It did not recognize a ".html" file. Maybe because of the aMember protection include. Mark Quote
TCH-Don Posted October 27, 2003 Posted October 27, 2003 (edited) Another way that comes to mind is ini_set put in the head of the php document, ini_set('short_open_tag', ' off'); again this is from memory as I am away from home. And the syntax may not be quite right. I know I have read about this not to long ago, so there should be a lot of info on the web about this. please let us know if you get this to work, as I would like to keep this in my notes, as opposed to my CRS memory --------- EDIT ----------------- I did find this <?php echo '<?xml version="1.0" encoding="US-ASCII"?>'; ?>. as a way around the problem. If this works, you may be able to echo your XML statements. Edited October 27, 2003 by turtle Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.