Donation Goal
Donate Now Goal amount for this year: 799 USD, Received: 100 USD (13%)
Please donate to help support this website. The funds will be used to purchase owned license of LiteSpeed Web Server Enterprise (2-CPU). It provides superior performance in terms of raw speed, scalability and anti-DDoS capabilities.

Parsing PHP in HTML or HTM Files

Posted By Raymond In Category: Computer

Mar
7
2007

I have a client with thousands of HTML files with contact form embedded to it. However it doesn’t have CAPTCHA function to prevent spam. A CAPTCHA (an acronym for “Completely Automatic Public Turing Test to Tell Computers and Humans Apart”) is a type of challenge-response test used in computing to determine whether or not the user is human. An example of CAPTCHA is like the image below. The numbers and letters are random each time you refresh the page.
Captcha on HTML

Now my client’s inbox is exploded with hundreds of spam emails everyday. To fix this problem, I have to include a new CAPTCHA function into the HTML files. Problem is, can HTML files parse PHP? Usually if you want to parse PHP codes, it will have to be .php extension for the webserver to identify that it’s a PHP file. So after added the CAPTCHA function, I have to rename all thousands of HTML files to PHP extension.

Thankfully I can save all the trouble of renaming thousands of HTML files to PHP by editing the .htaccess file. Here’s how I did it to parse PHP in HTML or HTM files.


Go to your WWW root, usually it looks like this:
path: /home/username/public_html

Look for the file named .htaccess. If it’s not there, create a blank page using NotePad and save it as .htaccess

Now edit this file by adding the following lines:

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

Save and close the .htaccess file. Upload it to your webserver (to your WWW root) and that’s it! Now your webserver will parse PHP codes even in HTML files!


Related posts:
  • Internet Explorer browser auto popup ads “/normal/yyy65.html”
  • Find any files in RapidShared and Fixdown
  • Register and get a Live.com or localized Live account
    • paul
    • http://www.raymond.cc/ Raymond

      I found this days ago but haven’t tried to see if it works or not.
      I thought that the TEAM PARADOX ’07 is the one who cracked the Vista using OEM Emulation? How come it’s Pantheon?

    • paul

      yes paradox made it. just thought youd make a blogpost about it.. lol

    • http://pxlbuzzard.com Pxl_Buzzard

      Hey Ray, how did you make the file without a name? My FTP or computer won’t let me make a file without a name, like a.htaccess or something like that. Any fixes?

    • http://www.raymond.cc/ Raymond

      Pxl_Buzzard, how about this trick?

      Create a file called htaccess.txt on your computer, upload it to your webserver and then rename it to .htaccess?

    • http://www.fnfzone.com fnfzone

      I am facing different problem. I can not parse .php file in to .html pages. Anybody can help me ?

    • arlindo

      preciso implementar um Captcha em minha pagina…
      ha uma serie de Captcha disponiveis na net, mas
      pode me indicar onde encontro os caminhos para isso?
      Como configuro meu formulario (HTML) para receber o captcha?
      obrigado

    Copyright © 2005-2012 - Raymond.CC Blog