diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-04-13 22:21:07 +1000 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-04-13 22:21:07 +1000 |
| commit | b8951025635edc3c291d39bbab9f248e8c3de720 (patch) | |
| tree | 1362e4efd96652d058ed1f4b4e56370aa43c64fc /inc | |
| parent | a9bdc6eeb7f6dfa462d0400c51ffd37f562a8be2 (diff) | |
block loading include files directly
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/config.php | 6 | ||||
| -rw-r--r-- | inc/database.php | 5 | ||||
| -rw-r--r-- | inc/display.php | 6 | ||||
| -rw-r--r-- | inc/functions.php | 6 | ||||
| -rw-r--r-- | inc/mod.php | 7 | ||||
| -rw-r--r-- | inc/template.php | 9 | ||||
| -rw-r--r-- | inc/user.php | 6 |
7 files changed, 40 insertions, 5 deletions
diff --git a/inc/config.php b/inc/config.php index bde1c6ee..58b6a860 100644 --- a/inc/config.php +++ b/inc/config.php @@ -588,4 +588,10 @@ // Link imageboard to your Google Analytics account to track users and provide marketing insights. // $config['google_analytics'] = 'UA-xxxxxxx-yy'; + + if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { + // You cannot request this file directly. + header('Location: ../', true, 302); + exit; + } ?>
\ No newline at end of file diff --git a/inc/database.php b/inc/database.php index 21fabe71..88ca1c0d 100644 --- a/inc/database.php +++ b/inc/database.php @@ -1,4 +1,9 @@ <?php + if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { + // You cannot request this file directly. + header('Location: ../', true, 302); + exit; + } function sql_open() { global $pdo, $config; diff --git a/inc/display.php b/inc/display.php index 9ba5cac6..1b5e98f7 100644 --- a/inc/display.php +++ b/inc/display.php @@ -1,4 +1,10 @@ <?php + if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { + // You cannot request this file directly. + header('Location: ../', true, 302); + exit; + } + /* Stuff to help with the display. */ diff --git a/inc/functions.php b/inc/functions.php index 2a45c606..7ec58e79 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1,4 +1,10 @@ <?php + if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { + // You cannot request this file directly. + header('Location: ../', true, 302); + exit; + } + loadConfig(); function loadConfig() { diff --git a/inc/mod.php b/inc/mod.php index 274159ba..78351ba7 100644 --- a/inc/mod.php +++ b/inc/mod.php @@ -1,5 +1,10 @@ <?php - + if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { + // You cannot request this file directly. + header('Location: ../', true, 302); + exit; + } + // Creates a small random string for validating moderators' cookies function mkhash($length=12) { // The method here isn't really important, diff --git a/inc/template.php b/inc/template.php index e0761d6a..e966a057 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1,8 +1,9 @@ <?php
-
- // PHP Template Preprocessor by Savetheinternet
- // http://codecanyon.net/user/Savetheinternet
- // savetheinternet@n0v4.com
+ if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
+ // You cannot request this file directly.
+ header('Location: ../', true, 302);
+ exit;
+ }
// -----------------------------------------------------
// Standard configuration
diff --git a/inc/user.php b/inc/user.php index 1c05b3a1..223eba64 100644 --- a/inc/user.php +++ b/inc/user.php @@ -1,4 +1,10 @@ <?php + if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { + // You cannot request this file directly. + header('Location: ../', true, 302); + exit; + } + // 'false' means that the user is not logged in as a moderator $mod = false; |
