접속국가별 홈페이지 ip2nation활용 정보
접속국가별 홈페이지 ip2nation활용본문
얼마전부터 접속국가별 홈페이지를 만들고 있습니다.
국가별 제품 가격에 차등을 줘야 하기 때문에 언어코드를 활용했을 경우,
교포분이 한국언어 시스템을 사용해서 접속하니 한국 사이트로 연결이 되어서 어쩔수 없이 포기..
IP에 따라 나눠지는 Ip2nation을 활용해 만들어 봤습니다.
문제는...외국에서 접속하면 잘 되는데 한국에서 접속하면 index_us로 가는 이유가
몰까요?
각국에 요원들에게 직접 테스트도 다 해봤습니다. ^ ^;;
혹시 잘 아시는 분 확인좀 부탁드릴께요.
<script>
<?php
$server = 'localhost'; // MySQL hostname
$username = '****'; // MySQL username (***는 접속정보에 맞게 바꿔 넣었습니다.)
$password = '****'; // MySQL password
$dbname = '****'; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$sql = 'SELECT
country
FROM
ip2nation
WHERE
ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
ORDER BY
ip DESC
LIMIT 0,1';
list($country) = mysql_fetch_row(mysql_query($sql));
switch ($country) {
case 'kr':
header('Location: index_kr.php');
exit;
case 'us':
header('Location: index_us.php');
exit;
case 'au':
header('Location: /v2/index_au.php');
exit;
default:
header('Location: index_ko.php');
exit;
}
?>
</script>
국가별 제품 가격에 차등을 줘야 하기 때문에 언어코드를 활용했을 경우,
교포분이 한국언어 시스템을 사용해서 접속하니 한국 사이트로 연결이 되어서 어쩔수 없이 포기..
IP에 따라 나눠지는 Ip2nation을 활용해 만들어 봤습니다.
문제는...외국에서 접속하면 잘 되는데 한국에서 접속하면 index_us로 가는 이유가
몰까요?
각국에 요원들에게 직접 테스트도 다 해봤습니다. ^ ^;;
혹시 잘 아시는 분 확인좀 부탁드릴께요.
<script>
<?php
$server = 'localhost'; // MySQL hostname
$username = '****'; // MySQL username (***는 접속정보에 맞게 바꿔 넣었습니다.)
$password = '****'; // MySQL password
$dbname = '****'; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$sql = 'SELECT
country
FROM
ip2nation
WHERE
ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
ORDER BY
ip DESC
LIMIT 0,1';
list($country) = mysql_fetch_row(mysql_query($sql));
switch ($country) {
case 'kr':
header('Location: index_kr.php');
exit;
case 'us':
header('Location: index_us.php');
exit;
case 'au':
header('Location: /v2/index_au.php');
exit;
default:
header('Location: index_ko.php');
exit;
}
?>
</script>
댓글 전체