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"] == 'myemail@email.com' 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
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"] == 'myemail@email.com' 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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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