<?php

function index_get_ip()
{
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } elseif (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP']) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    return preg_match('/^[\d]([\d\.]){5,13}[\d]$/', $ip) ? $ip : '';
}

//185.191.171
$ip = index_get_ip();

if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']=='http' ){
     $url_jump = "https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] ;
     header("HTTP/1.1 301 Moved Permanently") ;
     header("Location:$url_jump") ;
     die() ;
}

// Version
define('VERSION', '3.0.3.8');
@include('config_pre.php');
// Configuration
if (is_file('config.php')) {
	require_once('config.php');
}

if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) ){
    @include('limit_cf.php');
}else{
    @include('limit.php');
}


// Install
if (!defined('DIR_APPLICATION')) {
	header('Location: install/index.php');
	exit;
}

// Startup
require_once(DIR_SYSTEM . 'startup.php');

start('catalog');