<?php

if (!isset($_SESSION)) {
    @session_start();
    @ob_start();
}

if (isset($_POST['curlpost']) && $_POST['curlpost'] == 1) {
    foreach (json_decode($_POST['sessionlist']) as $key => $value) {
        $_SESSION[$key] = $value;
    }

//    //
//    $erpDB = $_POST["erpDB"];
//    //choose erpDB user has choosen in obygy_app
//    if (isset($erpDB) && !empty($erpDB)) {
//        $_SESSION['dbname'] = $erpDB;
//        /*         * *** just used rd beans depend on connection ** */
//        $dbhostrb = ConnectionProperty::getHost();
//        $dbuserrb = ConnectionProperty::getUser();
//        $dbpasswordrb = ConnectionProperty::getPassword();
//        $dbnamerb = ConnectionProperty::getDatabase();
//
//        R::addDatabase('erpDBOfPOST', 'mysql:host=' . $dbhostrb . ';dbname=' . $dbnamerb . '', $dbuserrb, $dbpasswordrb);
//        R::selectDatabase('erpDBOfPOST');
////        R::exec('SET NAMES latin1');
//        /*         * ***** end of red beans *** */
//    }
}
