<?

//db configuration
$dirServer = dirname(__FILE__) . '/';
require_once $dirServer . 'config.inc.php';
require_once $dirServer . '../constants.php';
require_once $dirServer . '../lib/adodb/adodb.inc.php';
//require_once $dirServer . '../lib/adodb/adodb-pager.inc.php';
//require_once $dirServer . '../lib/adodb/class.synPager.php';
require_once $dirServer . '../lib/adodb/adodb-errorhandler.inc.php';
require_once $dirServer . '../lib/nusoap/nusoap.php';
require_once $dirServer . '../lib/floapi/floAPI.php';
require_once $dirServer . '../agi/agifunction.php';

//error_reporting(E_ALL); # report all errors 
//ini_set("display_errors", "0"); # but do not echo the errors
//define('ADODB_ERROR_LOG_TYPE',3);
//define('ADODB_ERROR_LOG_DEST',$dirServer.'err.log');

$db = NewADOConnection('mysql');

//connect to Database
$result=@$db->Connect($synDbHost, $synDbUser, $synDbPassword, $synDbName);

//if some configuration fails... reconfigure the parameter
if ($result===false) {die("no db configuration done");}

//some db settings...
$db->SetFetchMode(ADODB_FETCH_ASSOC);

//if the DB is empty, populate it!
$a = $db->MetaTables();
if ($a!==false AND count($a)==0) {error_log("database empty?");} 

//bypass the registrer globals problem
if (!ini_get('register_globals')) {
  $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);

  if (isset($_SESSION)) {
    array_unshift($superglobals, $_SESSION);
  }

  foreach ($superglobals as $superglobal) {
    extract($superglobal, EXTR_SKIP);
  }
}


?>