<?php
if (session_status() !== PHP_SESSION_ACTIVE) {
    ini_set('session.gc_maxlifetime', '10800');
    session_set_cookie_params([
        'lifetime' => 10800,
        'path' => '/',
        'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'),
        'httponly' => true,
        'samesite' => 'Lax',
    ]);
    session_start();
}
require_once("config.inc.php");
require_once("database.class.php");
require_once("login.class.php");
require_once("utility.class.php");
require_once("user_setup.class.php");
require_once("product_setup.class.php");
require_once("customer_setup.class.php");
require_once("supplier_setup.class.php");
require_once("customer_category_setup.class.php");
require_once("tax_category_setup.class.php");
require_once("employee_category_setup.class.php");
require_once("employee_setup.class.php");
require_once("employee_setup_mart.class.php");
require_once("employee_authority_setup.class.php");
require_once("expense_category_setup.class.php");
require_once("expense_setup.class.php");
require_once("expense_mart_category_setup.class.php");
require_once("expense_mart_setup.class.php");
require_once("wht_payment_tax.class.php");
require_once("ingredient_stock_adjustment.class.php");
require_once("expense_tax_category_setup.class.php");
require_once("expense_tax_setup.class.php");

require_once("petty_cash_in.class.php");

require_once("purchase_category_setup.class.php");
require_once("purchase_setup.class.php");
require_once("bank_setup.class.php");
require_once("supplier_bank_setup.class.php");
require_once("supplier_payment.class.php");

require_once("stock.class.php");
require_once("production_stock.class.php");
require_once("production.class.php");
require_once("batch_setup.class.php");
require_once("ing_setup.class.php");
require_once("ingredient_category_setup.class.php");
require_once("menu.class.php");
require_once("upload.class.php");
require_once("helper.class.php");
require_once("control.configuration.class.php");
require_once("invoice.class.php");
require_once("invoice_rate.class.php");
require_once("rate_list.class.php");
require_once("payment.class.php");
require_once("purpayment.class.php");
require_once("purchase_Items.class.php");
require_once("refund.class.php");
require_once("ledger.class.php");
require_once("attendance.class.php");
require_once("loan_setup.class.php");
require_once("loan_setup_mart.class.php");

require_once("salary_setup.class.php");
require_once("salary_setup_mart.class.php");

require_once("holiday_setup.class.php");
require_once("leave_setup.class.php");
require_once("statement_bank_setup.class.php");
require_once("bank_transaction_setup.class.php");
require_once("director_setup.class.php");
require_once("production_stock.class.php");
require_once("ingredient_stock.class.php");
require_once("produced_products.class.php");
require_once("product_stock_deductions.class.php");
require_once("delivery_challan.class.php");





class Manager
{


    function __construct()
    {
        if(isset($_SESSION['nextclass']) && $_SESSION['nextclass'] == 1){
            global $db;
            $db = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db->connect();
            global $db1;
            $db1 = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db1->connect();
        }else {
            global $db;
            $db = new Database(DB_SERVERS, DB_USERS, DB_PASS, DB_DATABASES);
            $db->connect();
            global $db1;
            $db1 = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db1->connect();
        }
//        global $db;
//
//        $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
//
//        $db->connect();

        date_default_timezone_set('Asia/Karachi');
    }


}


?>
