Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Design

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-03-2008, 01:01 PM
Novice Webmaster
 
Join Date: Feb 2008
Location: malaysia
Posts: 25
Rep Power: 0
aiyoo is on a distinguished road
Automatically redirected depending on the IP location. How to do it?.

when we are in malaysia, surf google.com, we are automatically redirected to google.com.my

how to do this?..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-03-2008, 01:29 PM
iamfreelancer's Avatar
Vibrate your Brain Please
 
Join Date: Sep 2005
Location: in my body lar...
Posts: 1,254
Rep Power: 66
iamfreelancer will become famous soon enough iamfreelancer will become famous soon enough
goto FREE Updated IP to Country Database

download their ip database and source code... its all ready for u to use also.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-03-2008, 05:41 PM
calvynlee's Avatar
Blogging Moderator
 
Join Date: Jul 2006
Location: LittlePenang.com
Posts: 1,700
Rep Power: 64
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
different country google give different search result, I am using proxy to access other country google
__________________
I blog my IT Engineer LIFE at iCalvyn.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 13-03-2008, 12:26 AM
New kid on the block
 
Join Date: Mar 2008
Location: KL
Posts: 3
Rep Power: 0
happgolucky is on a distinguished road
easiest way

when google.com.my pops up just type in the search

example if you want new zealand

just type 'google new zealand'

then click the first result it should be for new zealand google.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 21-03-2008, 01:09 PM
Novice Webmaster
 
Join Date: Jul 2007
Location: Malaysia
Posts: 80
Rep Power: 0
kaisology is on a distinguished road
wow...u guys ever used that script before? for developing big international websites?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 22-03-2008, 01:08 AM
hashie's Avatar
Inspired Webmaster
 
Join Date: Jun 2007
Location: Kuala Lumpur
Posts: 165
Rep Power: 21
hashie is on a distinguished road
haha, and he is so rich to purchase every country's domain for his website from .com.my buy til .com.isr (isreal) ? hahahaha..

but that's a way, search from internet, find out the IP range for each country.

1) create a database eg: "IPLocation" using mysql and connect the database.

2) then create IPcountry table eg.

create TABLE IPcountry
(
ipstart DOUBLE NOT NULL,
ipend DOUBLE NOT NULL,
country_S VARCHAR (2) NOT NULL,
country_L VARCHAR (100) NOT NULL,
PRIMARY KEY(ipstart, ipend)
);

3) then import eg "ipcountry.csv" database into the table
eg.
INSERT INTO IPcountry Values (XXXXX, XXXXXX, 'MAS', 'Malaysia');
INSERT INTO IPcountry Values (XXXXX, XXXXXX, 'SG', 'Singapore');

xxxxx represents the ip range.

then, create ur website eg. index.php

<?php

// Retrieve visitor IP address
$ipadd = getenv(REMOTE_ADDR);

// Convert IP address to IP number for querying database
$ipno = ipconv($ipadd);

// Connect to the database server
$link = mysql_connect($mysql_server)
or die("Could not connect to MySQL database");

// Connect to the IPLocation database
mysql_select_db("IPLocation") or die("Could not select database");

// SQL query string to match the recordset that
// the IP number fall between the valid range

$query = "SELECT * FROM IPcountry WHERE $ipno <= ipend AND $ipno>=ipstart";

// Execute SQL query
$result = mysql_query($query) or die("IPLocation Query Failed");

// Retrieve the recordset (only one)
$row = mysql_fetch_object($result);

// Keep the country information into two different variables
$country_S = $row->country_S;
$country_L = $row->country_L;

// Free recordset and close database connection
mysql_free_result($result);
mysql_close($link);

// If the visitors are from SG, redirect them to SG site
if ($countrySHORT == "MAS") {
Header("Location: http://www.hash.com.my");
} else {
// Otherwise, redirect them to SG site
Header("Location: http://www.hash.com.sg");
}
exit;
// Function to convert IP address (xxx.xxx.xxx.xxx) to IP number (0 to 256^4-1)
function ipconv ($IPaddress)
{
if ($IPaddress == "") {
return 0;
} else {
$ips = split ("\.", "$IPaddress");
return ($ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0] * 256 * 256 * 256);
}
}
?>

Guess this would probably works...u may try it.
__________________
Hash here..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 22-03-2008, 11:57 AM
mysticmind's Avatar
Super Moderator
 
Join Date: Jun 2001
Location: Mystic Kingdoms
Posts: 2,687
Rep Power: 145
mysticmind will become famous soon enough mysticmind will become famous soon enough
Send a message via Yahoo to mysticmind
Quote:
Originally Posted by calvynlee View Post
different country google give different search result, I am using proxy to access other country google
you dont have to.

for using .com not .com.my use this address:
Code:
http://www.google.com/ncr
NCR = no country redirection

if you wanted to browse other country google ,
just use their address.. as : google.cn google.jp
__________________
Personal's Blog! - Malaysian Artist!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to turn off "Automatically retrieve titles from external links"? wilfred FeedBack & Suggestion 3 03-07-2007 02:05 PM
1U Co-location RM 200 only mizan Other Webmaster-related Services and Promotion 0 22-06-2004 10:19 PM
Location hftey Mamak Stall 0 01-03-2004 12:07 PM
how to make function that automatically parse url full time kille Website Programming 6 08-11-2002 05:59 PM
http://www.location.com.my LocationDotCom Websites Review and Suggestion 4 18-06-2002 09:00 PM


All times are GMT +8. The time now is 03:53 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61