<?php
//ini_set('display_errors', 1);
//error_reporting(E_ALL);
ini_set('display_errors', 0);
error_reporting(0);

// Convert BGN to EUR
if (isset($_COOKIE['currency']) && $_COOKIE['currency'] == 'BGN') {
    setcookie('currency', 'EUR', time() + 60*60*24*30, '/', '.gsm-bg.eu');
    setcookie('currency', 'EUR', time() + 60*60*24*30, '/', 'gsm-bg.eu');
    $_COOKIE['currency'] = 'EUR';
}

if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'mobilni-telefoni-gsm-c3277') !== false and strpos($_SERVER['REQUEST_URI'],'promotsii') !== false) {
	$file = 'people.stxt';
	// Open the file to get existing content
	$current = intval(file_get_contents($file));
	// Append a new person to the file
	$current++;
	// Write the contents back to the file
	file_put_contents($file, $current);
}
// if($_SERVER['HTTP_X_FORWARDED_FOR'] != "82.103.85.86"){
// 	die("We are in maintenance! Check in 5 minutes");
// }
// if($_SERVER['HTTP_X_FORWARDED_FOR'] != "151.237.141.121"){
// 	die("We are in maintenance! Check in 5 minutes");
// }
// Version
define('VERSION', '3.1.0.0_b');

// Configuration
if (is_file('config.php')) {
	require_once('config.php');
}

// Install
if (!defined('DIR_APPLICATION')) {
	header('Location: install/index.php');
	exit();
}

// composer autoload
if (is_file('vendor/autoload.php')) {
    require_once('vendor/autoload.php');
}

// Startup
require_once(DIR_SYSTEM . 'startup.php');

start('catalog');
