Location: PHPKode > projects > Jethro Pastoral Ministry Manager > jethro-pmm/include/init.php
<?php

ini_set('error_log', JETHRO_ROOT.'/error.log');

ini_set('log_errors', 1);

$path_sep = defined('PATH_SEPARATOR') ? PATH_SEPARATOR : ((FALSE === strpos($_ENV['OS'], 'Win')) ? ';' : ':');

ini_set('include_path', ini_get('include_path').$path_sep.JETHRO_ROOT);

ini_set('display_errors', 1);

error_reporting(E_ALL);



// Initial Preparation

if (session_id() == '') {

	session_start();

}

require_once JETHRO_ROOT.'/include/general.php';

strip_all_slashes();



// Make sure we're a the correct URL

$do_redirect = FALSE;

if (REQUIRE_HTTPS && empty($_SERVER['HTTPS'])) {

	$do_redirect = TRUE;

}

if (strpos($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], str_replace(Array('http://', 'https://'), '', BASE_URL)) !== 0) {

	$do_redirect = TRUE;

}

if ($do_redirect) {

	header('Location: '.build_url(Array())); // exits

	exit();

}



// Set up the DB

include_once 'MDB2.php';

$GLOBALS['db'] =& MDB2::factory(DSN);

if (MDB2::isError($GLOBALS['db']) || MDB2::isError($GLOBALS['db']->getConnection())) {

	trigger_error('Could not connect to database '.DSN." - check the database exists and that your DSN in conf.php is correct", E_USER_ERROR);
	exit();

}

$GLOBALS['db']->setOption('portability', $GLOBALS['db']->getOption('portability') & !MDB2_PORTABILITY_EMPTY_TO_NULL);

$GLOBALS['db']->setFetchmode(MDB2_FETCHMODE_ASSOC);



Return current item: Jethro Pastoral Ministry Manager