masal_eser Posted March 11, 2008 Share Posted March 11, 2008 I’m using a html file as a DirectoryIndex and I want to execute php code on my html file. I have the following line in my configuration file: AddType application/x-httpd-php .html And my index.html file contain this lines: <html><body><h1>Restricted Area</h1> <?php if ($_SERVER["SSL_CLIENT_S_DN_CN"] == '[email protected]' or ………………..) { die '<ul><li><a href="../">Parent Directory</a><br><br></li><li><a href="Journal.pdf">Journal</a></li><li><a href="credentials.html">Credentials</a></li></ul>'; } else { die '<h1>You Don't Have Acccess To This Area.</h1>'; } ?> </body></html> But I’m getting error. The page just prints all the codes after the </ul>. Can anyone help me? Link to comment https://forums.phpfreaks.com/topic/95695-how-to-execute-php-code-on-a-html-file/ Share on other sites More sharing options...
trq Posted March 11, 2008 Share Posted March 11, 2008 What is this or................... thing? if ($_SERVER["SSL_CLIENT_S_DN_CN"] == '[email protected]' or ………………..) And can you please use tags when posting code. Link to comment https://forums.phpfreaks.com/topic/95695-how-to-execute-php-code-on-a-html-file/#findComment-489938 Share on other sites More sharing options...
masal_eser Posted March 11, 2008 Author Share Posted March 11, 2008 Sorry, I'm just new here. This .................. means that I have several $_SERVER["SSL_CLIENT_S_DN_CN"] checks. <html><body><h1>Restricted Area</h1> <?php if ($_SERVER["SSL_CLIENT_S_DN_CN"] == '[email protected]' or ………………..) { die '<ul><li><a href="../">Parent Directory</a> </li><li><a href="Journal.pdf">Journal</a></li><li><a href="credentials.html">Credentials</a></li></ul>'; } else { die '<h1>You Don't Have Acccess To This Area.</h1>'; } ?> </body></html> Link to comment https://forums.phpfreaks.com/topic/95695-how-to-execute-php-code-on-a-html-file/#findComment-489945 Share on other sites More sharing options...
chris_rulez001 Posted March 11, 2008 Share Posted March 11, 2008 i think what your trying to do is put php code in a .html file, to execute php code the file name needs to be .php. Link to comment https://forums.phpfreaks.com/topic/95695-how-to-execute-php-code-on-a-html-file/#findComment-489953 Share on other sites More sharing options...
trq Posted March 11, 2008 Share Posted March 11, 2008 Well, there is an error in this line.... die '<h1>You Don't Have Acccess To This Area.</h1>'; Needs to be.... die "<h1>You Don't Have Acccess To This Area.</h1>"; Also, if your going to post problematic code to a forum, its best to post the exact code. You never know, you maye have removed the error with your or .............. bit, we can't tell. Link to comment https://forums.phpfreaks.com/topic/95695-how-to-execute-php-code-on-a-html-file/#findComment-489958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.