"; echo "window.location.href='$url';"; echo ""; } function get_user_ip() { if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { $_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"]; $_SERVER["HTTP_CLIENT_IP"] = $_SERVER["HTTP_CF_CONNECTING_IP"]; } $client = @$_SERVER["HTTP_CLIENT_IP"]; $forward = @$_SERVER["HTTP_X_FORWARDED_FOR"]; $remote = $_SERVER["REMOTE_ADDR"]; if (filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif (filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else $ip = $remote; return $ip; } $redirect = null; if (!empty($_GET["link"])) { $_GET["link"] = preg_replace("/[^ a-zа-яё_\d]/ui", "", trim(htmlspecialchars(strip_tags($_GET["link"])))); $host = Config::DATABASE["IP"]; $dbname = Config::DATABASE["DB"]; $user = Config::DATABASE["USER"]; $password = Config::DATABASE["PASSWORD"]; $dsn = "pgsql:host=$host;dbname=$dbname"; $options = [ PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ]; $pdo = new PDO($dsn, $user, $password, $options); function query($query, $array = "") { global $pdo; $sql = $pdo->prepare($query); $array ? $sql->execute($array) : $sql->execute(); return $sql; } $check = query("SELECT * FROM kl_admin_links WHERE to_url = ? LIMIT 1", [$_GET["link"]]); if ($check->rowCount()) { query("UPDATE kl_admin_links SET view = view+1 WHERE to_url = ?", [$_GET["link"]]); switch (strtolower($_GET["link"])) { case "tanksmain": $reader = new Reader("GeoLite2-Country.mmdb"); $record = $reader->country(get_user_ip()); $code = $record->country->isoCode; if (in_array($code, ["RU", "BY"])) { $redirect = "aflink.ru/g/zbb199rkbm005a9b2a0dda24595e24/?erid=LatgC9tB8&subid=tanks_kl"; } else { $redirect = "dorinebeaumont.com/g/g5n0gm7s2q005a9b2a0df047b2a6da/?subid=tanks_eu_kl"; } break; case "tanksgp": $reader = new Reader("GeoLite2-Country.mmdb"); $record = $reader->country(get_user_ip()); $code = $record->country->isoCode; if (in_array($code, ["RU", "BY"])) { $redirect = "aflink.ru/g/zbb199rkbm005a9b2a0dda24595e24/?erid=LatgC9tB8&subid=tanks_gp"; } else { $redirect = "dorinebeaumont.com/g/g5n0gm7s2q005a9b2a0df047b2a6da/?subid=tanks_eu_gp"; } break; case "shipsmain": $reader = new Reader("GeoLite2-Country.mmdb"); $record = $reader->country(get_user_ip()); $code = $record->country->isoCode; if (in_array($code, ["RU", "BY"])) { $redirect = "aflink.ru/g/2wqws90yhf005a9b2a0d3525d9077f/?erid=LatgBc3mD&subid=ships_kl"; } else { $redirect = "fxxag.com/g/40f3crspww005a9b2a0d9dc87d04abaf9d7d72b9/?subid=ships_eu_kl"; } break; case "shipsgp": $reader = new Reader("GeoLite2-Country.mmdb"); $record = $reader->country(get_user_ip()); $code = $record->country->isoCode; if (in_array($code, ["RU", "BY"])) { $redirect = "aflink.ru/g/2wqws90yhf005a9b2a0d3525d9077f/?erid=LatgBc3mD&subid=ships_gp"; } else { $redirect = "fxxag.com/g/40f3crspww005a9b2a0d9dc87d04abaf9d7d72b9/?subid=ships_eu_gp"; } break; default: $redirect = $check->fetch(PDO::FETCH_OBJ)->from_url; } }; } redirect("https://" . $redirect);