Jump to content

How to execute php code on a html file ?


masal_eser

Recommended Posts

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

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>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.