Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Prevent a direct access to the template index.php

General discussions related to php

Moderators: macek, egami, gesf

Prevent a direct access to the template index.php

Postby carwenia » Thu Jan 30, 2014 8:20 am

root\index.php
Code: Select all
<?php
if (version_compare(PHP_VERSION, '5.3.1', '<'))
{
        die('Your host needs to use PHP 5.3.1 or higher to run this form!');
}
define('_Allow', 1);
$template="template_1";
header("Location:templates/".$template."/");
?>

root\templates\template_1\index.php
Code: Select all
<?php
defined('_Allow') or die("access denied");
echo "template 1";
?>

The result of course is :"access denied"..Would you help me to fix this please? i need to pass through index.php (root file) and prevent the direct acess to the file index.php(root\templates\template_1).

Thank you.
carwenia
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Jan 30, 2014 4:47 am

Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron