Hi!
Hope I got your question right.
You can test $_SERVER['PHP_SELF']
in your crimes.php
if a part of PHP_SELF is 'crimes.php', then the request was to 'crimes.php'
otherwise 'crimes.php' was included from 'index.php'
<?php
// if the string 'crimes.php' is in php_self
if( stristr( $_SERVER['PHP_SELF'], 'crimes.php' )){
header( 'Location: index.php' );
exit();
}
// rest of crimes.php
?>
There are also other $_SERVER['xxxx'] variables you can use
To see what you can use, run a phpinfo();
from within 'crimes.php' and scroll down to bottom to see server variables
Many applications use a constant defined in 'index.php'.
If this constant is not defined, then the page was called directly
and not via 'index.php'
phpBB, index.php
<?php
define('IN_PHPBB', true);
// rest of index.php
?>
Other pages that can not be called directly
<?php
if (!defined('IN_PHPBB')){
exit;
}
// rest of this page
//we can also use a redirect
if (!defined('IN_PHPBB')){
header( 'Location: index.php' );
exit;
}
// rest of this page
?>