-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-} elseif (!IS_LOGGED_IN()) {
- $URL = URL."/modules.php?module=index";
- if ($check == "mem_only") $URL .= "&msg=".urlencode(LANG_MEM_ONLY_1.$GLOBALS['module'].LANG_MEM_ONLY_2);
- LOAD_URL($URL);
-}
-
-if ($status != "CONFIRMED") {
- // If the status is different than confirmed move the user away from here
- switch ($status)
- {
- case "LOCKED":
- $ERROR = CODE_ID_LOCKED;
- break;
-
- case "UNCONFIRMED":
- $ERROR = CODE_ID_UNCONFIRMED;
- break;
-
- default:
- $ERROR = CODE_UNKNOWN_STATUS;
- break;
- }
- $URL = URL."/modules.php?module=index&login=".$ERROR;
- LOAD_URL($URL);
-}
-
-// Recheck if he got logged out because bad cookies
-if (!IS_LOGGED_IN())
-{
- $URL = URL."/modules.php?module=index";
- LOAD_URL($URL);
-}
-
-// Load adverstising template
-define('__MEMBER_ADVERT', LOAD_TEMPLATE("member_banner", true));
+if (!defined('__SECURITY')) {
+ die();
+} elseif (!isMember()) {
+ $url = 'modules.php?module=index';
+ if (checkModulePermissions('login') == 'mem_only') $url .= '&code=' . getCode('MODULE_MEMBER_ONLY') . '&mod=' . getModule();
+ redirectToUrl($url);
+} // END - if