<?php
/* FILE LOCATION */
#const file_url = "https://cltinspection.app/api/clt_payroll/";

// define('file_loc', $_SERVER['DOCUMENT_ROOT']."api/clt_payroll/");
const file_url = "https://cltinspection.com/api/clt_payroll/";
const file_loc = "../../";
const file_via_url = file_url."files/";
const file_via_loc = file_loc."files/";
const report_via_url = file_url."report/";
const report_via_loc = file_loc."report/";

//For csv download
const report_via_url_csv = file_url."report-csv/";
const report_via_loc_csv = file_loc."report-csv/";
/* FILE LOCATION */

//For not paid csv download
const report_via_url_not_paid_csv = file_url."report-not-paid-csv/";
const report_via_loc_not_paid__csv = file_loc."report-not-paid-csv/";

//For Debit/Credit Report CSV download, May 22
const report_via_url_debit_credit_csv = file_url."report-debit-credit-csv/";
const report_via_loc_debit_credit_csv = file_loc."report-debit-credit-csv/";

//For price list csv download
const report_via_url_price_list_csv = file_url."report-price-list-csv/";
const report_via_loc_price_list_csv = file_loc."report-price-list-csv/";

//Upload Inspector Docs

const docs_via_loc = file_loc."User-Documents/";
const docs_via_url = file_url."User-Documents/";
//Ends here
const site_name = "CLT Payroll";
const site_mail = "noreply@cltinspection.app";
const usr_placeholder_img = "img/user.jpg";
const db_prefix="cltpr_";


//Production DB
$servername = "localhost";
$username = "db_admin";
$password = "iIkqeMWw&.-8";
$dbname = "payroll";


//Dev DB
// $servername = "localhost";
// $username = "cltinspection_payrolldev";
// $password = "NeW&kL-*ay+]";
// $dbname = "cltinspection_payrolldev";


$con = mysqli_connect($servername, $username, $password, $dbname);

mysqli_query($con, 'SET CHARACTER SET utf8');
mysqli_query($con, "SET SESSION collation_connection ='utf8_general_ci'");

if (!$con) {
    echo "Error : Unable to open database";
}


/*
$con = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);

$default_stmt = $con->prepare("SET CHARACTER SET utf8");
$default_stmt->execute();
$default_stmt = $con->prepare("SET SESSION collation_connection ='utf8_general_ci'");
$default_stmt->execute();
*/

/**
 * PHP Error logs location
    * /var/log/apache/error_log is Apache's error log
    * /home/cltinspection/logs/developer_cltinspection_com.php.error.log
 */

 $charset = 'utf8mb4';
$dsn = "mysql:host=$servername;dbname=$dbname;charset=$charset";

$options = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION, // throw exceptions
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,       // fetch as associative array
    PDO::ATTR_EMULATE_PREPARES   => false,                  // use native prepared statements
];

try {
    $pdo = new PDO($dsn, $username, $password);
} catch (PDOException $e) {
    echo "Error : Unable to connect database";
}