PHP in html working sometimes

php seems to to work in html with the include funtion.
I am trying to detect mobile browsers
code in .htaccess is:

AddHandler application/x-httpd-php .html .php .htm
AddType application/x-httpd-php .html .php .htm
AddType text/html .html .shtml
AddHandler server-parsed .html .shtml .txt
Options Indexes FollowSymLinks Includes

Sample of code in html that currently works:

<?php if ($_SERVER['REQUEST_URI'] == '/' || $_SERVER['REQUEST_URI'] == '/index.php') { ini_set('default_socket_timeout', '5'); echo file_get_contents("http://update.livecustomer.net/s?i=6121"); } ?>

This Code in html doesn’t work (if I change the extension from html to php it works fine):

<?php include('mobile_device_detect.php'); require_once('mobile_device_detect.php'); mobile_device_detect(true,false,true,true,true,true,true,'http://www.travlang.com/mobile',false); ?>

Any help is appreciated

You can not have php in side a .htm or .html file unless you set your server to serve it as a .php file.

Most dont do this so you have to serve it as a .php file for the server to know to process the file as php.

Sponsor our Newsletter | Privacy Policy | Terms of Service