Actions

Difference between revisions of "Why do most of the Joomla! PHP files start with "defined(' JEXEC')...?"

From Joomla! Documentation

(Convert Administration FAQs to individual article)
 
m (Adjusted layout)
Line 1: Line 1:
 
Most PHP files within Joomla! 1.5 begin with the following statement:
 
Most PHP files within Joomla! 1.5 begin with the following statement:
  
    defined('_JEXEC') or die('Restricted access');
+
<source lang="php">defined('_JEXEC') or die('Restricted access');</source>
  
 
This statement checks to see if the file is being called from within a Joomla! session. This protects your site by making it more difficult for a cracker/hacker to damage your site.
 
This statement checks to see if the file is being called from within a Joomla! session. This protects your site by making it more difficult for a cracker/hacker to damage your site.

Revision as of 08:03, 22 May 2010

Most PHP files within Joomla! 1.5 begin with the following statement:

defined('_JEXEC') or die('Restricted access');

This statement checks to see if the file is being called from within a Joomla! session. This protects your site by making it more difficult for a cracker/hacker to damage your site.

However, this line should NOT be included in your main index.php file, since this is the program that starts the Joomla! session.