
<?php 
$env = "stag";

$PIXEL_ID= "2701598046523398";
$TAG_SNIPPET= "&gtm_auth=8IeIuZV3TKLxZF7lye_7gQ&gtm_preview=env-7";
$STRIPE_PUBLIC_KEY= "pk_test_D2zvuqPsbYu0X6F1EuO2hIJd00cJcE6PqZ";
$CYBERSOURCE_FORM_POST = "https://testsecureacceptance.cybersource.com/pay";
$CYBERSOURCE_ACCESS_KEY = "e7bfa2b48d4a3219af362691602e03a1";
$CYBERSOURCE_PROFILE_ID = "D9E7D755-F098-4EA6-A69B-A92527D92C61";
$upload_php = "https://upload.1ticks.com/1ticks_upload_stg.php";
$upload_host = "https://upload.1ticks.com";
$upload_path = "1ticks_stg/";
if ($env=="dev") {
  $base_uri = "/1ticks/web/";
  $apiEndpoint = 'https://inbots.io/ttt/api/public/api/';
  $session_path = "/1ticks/";
  $host_url = "https://inbots.io";
} elseif ($env == "stag") {
  $base_uri = "/ticktactoe/staging/1ticks/web/";
  $apiEndpoint = 'https://inbots.io/ttt/api/public/api/';
  $session_path = "/ticktactoe/staging/1ticks/";
  $host_url = "https://www.signhub.io";
} elseif ($env == "prod") {
  $base_uri = "/web/";
  $apiEndpoint = 'https://app.1ticks.com/1ticks/api/public/api/';
  $session_path = "/";
  $host_url = "https://1ticks.com";

  $upload_php = "https://upload.1ticks.com/1ticks_upload.php";
  $upload_host = "https://upload.1ticks.com";
  $upload_path = "1ticks/";
  
  $PIXEL_ID= "333265147353064";
  $TAG_SNIPPET= "&gtm_auth=gQhtSZgndDDjYZK41r06Vg&gtm_preview=env-2";
  $STRIPE_PUBLIC_KEY= "pk_live_KAlvqaHLm2AB4koP5AxdzVyi00zvy39ial";
  $CYBERSOURCE_FORM_POST = "https://secureacceptance.cybersource.com/pay";
  $CYBERSOURCE_ACCESS_KEY = "7eb05a237c30377a8d8fd169b7daf86e";
  $CYBERSOURCE_PROFILE_ID = "691E17D8-86BC-41B8-BBD1-7528F762E70F";
} elseif ($env == "localhost") {
  $base_uri = "/sites/webview/1-single-vue/1ticks/web/";
  $apiEndpoint = 'https://inbots.io/ttt/api/public/api/';
  $session_path = "/sites/webview/1-single-vue/1ticks/";
  $host_url = "http://localhost";
}

function gen_uuid() {
  $data = openssl_random_pseudo_bytes(16);
  $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
  $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
  return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}

if(isset($_COOKIE["__esales_gid"])||isset($_SESSION['__esales_gid'])) {
  setcookie("__esales_gid", $_COOKIE["__esales_gid"], strtotime( '+2 years' ), $session_path);
} else {
  $guest_id = gen_uuid();
  setcookie("__esales_gid", $guest_id, strtotime( '+2 years' ), $session_path);
  $_SESSION['__esales_gid'] = $guest_id;
}
$_gid = $_COOKIE["__esales_gid"] ?? $_SESSION['__esales_gid'];
?>