|
 |
|
ด้วยเรื่อง array_search();...โจทย์คือถ้า url ในหน้าภาษาญี่ปุ่นไม่มี |
|
 |
|
|
 |
 |
|
โจทย์คือถ้า url ในหน้าภาษาญี่ปุ่นไม่มี จะให้ลิ้งก์ไปที่หน้าแรกของภาษาอังกฤษแทน
ใช้ array เก็บชื่อหน้าต่างๆ ที่ไม่มีในภาษาญี่ปุ่น แล้วหาว่ากำลังจะไปที่หน้ารึเปล่า
<?php
$host = $_SERVER['HTTP_HOST'];
$uri = $_REQUEST['pageurl']; //rtrim(dirname(), '/\\');
$page = (string)$uri;
$japlist = array(0, "marketing-resources.php",
"/backlink-checker.php",
"/cloaking-checker.php",
"/google-banned-checker.php",
"/google-datacenter-search.php",
"/google-pagerank-prediction.php",
"/index-checker.php",
"/keyword-density-checker.php",
"/keyword-suggestion-tools.php",
"/link-popularity-check.php",
"/multi-rank-checker.php",
"/pagerank-checker.php",
"/rank-checker.php",
"/search-engine-position.php",
"/search-listings-preview.php",
"/spider-view.php",
"/url-redirect-checker.php",
"/visual-pagerank.php",
"/htaccess-url-rewrite.php",
"/google-adsense-calculator.php",
"/google-adsense-preview.php",
"/link-shortener.php",
"/list-cleaner.php",
"/md5-encrypt.php",
"/unix-time-convertor.php",
"/alexa_traffic_rank.php",
"/browser-details.php",
"/broken-link-checker.php",
"/domain-availability.php",
"/domain-look-up.php",
"/domain-whois.php",
"/ip-location.php",
"/link-price-calculator.php",
"/ping-test.php",
"/reciprocal_link_checker.php",
"/reverse-ip.php",
"/server-status.php",
"/website-speed-test.php",
"/html-optimizer.php",
"/http-headers.php",
"/link-extractor.php",
"/meta-tags-extractor.php",
"/meta-tags-generator.php",
"/source-%20code-viewer.php"
);
if($_REQUEST['country']=='ja'){
$result = [color=green]array_search($page,$japlist);
if ($result === 0) {
header("Location: http://$host");
}
else {
header("Location: http://$host/japan$uri");
}
}
if($_REQUEST['country']=='th'){
header("Location: http://$host/Thailand$uri");
}
if($_REQUEST['country']=='us'){
header("Location: http://$host$uri");
//echo "http://$host$url";
}
?>
แต่ปรากฏว่าทั้งหน้าที่มีและไม่มีกลับโดนลิ้งก์ไปหน้า host หมดเลย
อยากขอความช่วยเหลือหน่อยค่ะ
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-03-25 20:12:42 |
By :
furyo |
View :
2052 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สแปมเปล่าเนี่ย
|
 |
 |
 |
 |
Date :
2009-03-25 22:05:21 |
By :
deawx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เปล่าค่ะ แต่ไม่เคยเขียน php จริงๆ ลองตาม ตย ในเนตแล้วก็ไม่เวิคเลยงง
|
 |
 |
 |
 |
Date :
2009-03-25 22:37:39 |
By :
furyo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|