Web visitors are redirected to regional asp, ms - structured development database
hexasoft uses sdn. Bhd. (645996 - k) 1-2-15 jalan mayang Fahd mayang just one day shopping bandar bayan baru 11950, Penang, Malaysia. (Sales@ip2location.com) when it is useful to redirect visitors to a different web page is the default based on the place of origin of visitors. A practical purpose is to redirect visitors to a Web page and the visitor is recognized by the language. This article demonstrates how to build this system using the asp (server-side scripting language), and ms - structured (database lookup address to the nation). Let& 39;s look at a simple case studies. Xyz company is a multi - people with major clients in the United States and Japan. The company& 39;s official website, in both English and Japanese language development. Visitors to the main page and the English language is the primary language of Japan. Switch to suit the changing options. Japan is a potential danger that exists when visiting a Web site in English and do not understand that sueopseup to navigate. So, a simple solution to help redirect traffic to the development of the Internet, send all of the company xyz country, and Japan to the Japanese language site. Meanwhile, the rest of this drive traffic in the world& 39;s corporate Web site into English. This tutorial, we ip2location ip - countries using the database to look up the address of origin of visitors to the country. Instead of loading the entire database to record 50000 +, we have to simplify this tutorial, and a range of different premise that the world& 39;s only two addresses. 0.0.0.0 addresses - 126.255.255.255 sent from the United States. Meanwhile, the address 127.0.0.0 - 255.255.255.255 occurs in Japan. We are here to create database tables, " ip2location " " ipcountry " It addresses a range of two records.
step 1: Structured Query Analyzer starts. Create a database connection to the database & 39; ip2location & 39; writing ip2location; ip2location use; Step 2: Create a table to create a table & 39; ipcountry & 39; [dbo]. [Ipcountry] ([] [ipfrom confiscation] is not zero, an 0 [ipto [float], [] [countryshort nvarchar] (2), [] [countrylong nvarchar] (64)) Phase 3, moved to the [state] . False records to the database inserts. Ipcountry insert values (0, 2130706431, & 39; America & 39;, & 39; America & 39;); ipcountry insert values (2130706432, 4294967295, Japan & & 39; 39;, & 39; Japan & 39;);
the version of the full-ip - country, and the database is used in the suit. 49/year subscription http://ip2location.com dollars. The full version of the ip2location ip - countries to the database, the database import procedure is a simple process using a conversion services ms (dts) - The English thought the Web page said sql.
let http://www . google.com http://www.google.co.jp Japanese as a Web page. We implemented a simple script that detects the origin of visitors default.asp. In the case of the Japanese visitors (address range is 127.0.0.0 - 255.255.255.255), in the following pages to redirect visitors to our Web site in Japan, the United States otherwise. Simple? Here is the code and the role of feedback explanation
default.asp <% faint connection, mydns, mysql, rs & 39; connect to the database structure. NOTE: Replace the server name, user name and password to use the gaphapnida. Connection set server.createobject = = " mydsn driver (" adodb.connection ") = (structured server); server = server; uid = user name; pwd = password; database = & ip2location ; quot; connect. Opening address of the visitor to search mydns & 39; and translating it to the address number ipno dot2longip = & 39; (request.servervariables (" remote addr ")) structured query into effect to the range of views Where countryshort mysql = " ipcountry address, and select & quot; & ipno & " ipfrom and between ipto " server.createobject set rs = (& quot ; adodb.recordset ") rs.open mysql, & 39; connection to assign a reference to the country by name countryname rs = & 39; (" countryshort ") to close free Nothing sets the connection is set to rs.close conn.close rs = = connection, if anything countryname = " Japan & quot; & 39; Japanese visitors from Japan & 39; google site Response.Redirect to redirect the " http://www.google.co.jp" visitors are not from someone else& 39;s site to redirect the Japan International & 39; google & Response.Redirect quot; http://www.google.com" if the final feature dot2longip (byval dottedip) faint ago, the position; prevpos faint, if dottedip Num = = " " or so other dot2longip = 0 People for instr 1 to 4 Position = (1 + prevpos, dottedip, ". ", 1) if the rank = 4 + 1 = Len (dottedip) End If Num = int (mid ( dottedip, prevpos + 1, Position - prevpos - 1)) = prevpos dot2longip Position = ((256) * (Department of Defense Num 256 (4 - 2))) + dot2longip end, and then, if the final feature is >
place% The script is the script defaults to the Web site. Before you move through the screening of all visitors to be redirected to the appropriate Web page. chang olexa
Bookmark it:
Saturday, March 29, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment