Skip to content

Instantly share code, notes, and snippets.

@if0rest
Last active April 5, 2021 11:32
Show Gist options
  • Save if0rest/06c7dd49af532106b0d7dc8422a63666 to your computer and use it in GitHub Desktop.
Save if0rest/06c7dd49af532106b0d7dc8422a63666 to your computer and use it in GitHub Desktop.
Include init.php in Bitrix if GET-param set.
<?
if (isset($_GET['useinit']) && !empty($_GET['useinit']))
{
session_start();
$initStatus = strval($_GET['useinit']);
if ($initStatus == 'N')
{
if (isset($_SESSION['USE_INIT']))
unset($_SESSION['USE_INIT']);
}
elseif ($initStatus == 'Y')
{
$_SESSION['USE_INIT'] = 'Y';
}
}
if (isset($_SESSION['USE_INIT']) && $_SESSION['USE_INIT'] == 'Y')
{
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/local/php_interface/init.php"))
require_once($_SERVER["DOCUMENT_ROOT"]."/local/php_interface/init.php");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment