팁문의 일본내에서 접속하면
본문
일본내에서 마이사이트.com 접속했을때 다른 너의사이트.com 도메인으로 접속되게 하려는데
[넘기려고하는데]
아래와 같은 소스가 있는데
이걸 head.sub.php에 넣어도 되는지요?
이런방법이 가능한지요 문의드립니다.
<?php
$server = ''; // 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 'se':
// Get the Swedish to a Swedish newssite
header('Location: http://www.thelocal.se/');
exit;
case 'us':
// And redirect US visitors to CNN
header('Location: http://www.cnn.com/');
exit;
default:
// The rest of the world can go to BBC
header('Location: http://www.bbc.co.uk/');
exit;
}
?>
이걸 봐도 방법을 모르겠네요.
답변 2
그누보드에서 사용하실거면
$server = ''; // 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());
이 부분을 삭제하시고
list($country) = mysql_fetch_row(mysql_query($sql)); 이 부분을 아래로 바꿔 시도해 보시죠.
$r = sql_fetch($sql);
$country = $r['country'];
https://xn--c79as89aj0e29b77z.xn--3e0b707e/kor/whois/openAPI_KeyCre.jsp
여기 api를 이용해서 개발해야 합니다.
잘 모르시면 제작의뢰를 하셔야할 듯 하네요..