<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Azan 黃贊臣 &#187; PHP</title>
	<atom:link href="http://tommy.ironman.tw/category/program/php-program/feed/" rel="self" type="application/rss+xml" />
	<link>http://tommy.ironman.tw</link>
	<description>網頁設計文章的蒐集與整理</description>
	<lastBuildDate>Sun, 18 Dec 2011 15:59:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>如何使用獲取用戶IP地址的三個屬性以得到使用者的真實IP(HTTP_X_FORWARDED_FOR,HTTP_VIA,REMOTE_ADDR)</title>
		<link>http://tommy.ironman.tw/get_user_ip_use_http_x_forwarded_for_http_via_remote_addr/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=get_user_ip_use_http_x_forwarded_for_http_via_remote_addr</link>
		<comments>http://tommy.ironman.tw/get_user_ip_use_http_x_forwarded_for_http_via_remote_addr/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 11:04:58 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[HTTP_VIA]]></category>
		<category><![CDATA[HTTP_X_FORWARDED_FOR]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[REMOTE_ADDR]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=3344</guid>
		<description><![CDATA[有些人會使用proxy這個方法來達到網頁加速的目的，但是這麼一來也間接地讓php傳統的偵測ip方式無法偵測到使用者真實的ip。而如果有心人士要攻擊網站，又走proxy的話，這時怎麼得到他的真實ip呢？ 你可以透過以下的方法來偵測： &#60;?php if (!empty($_SERVER[&#39;HTTP_CLIENT_IP&#39;])) $ip=$_SERVER[&#39;HTTP_CLIENT_IP&#39;]; else if (!empty($_SERVER[&#39;HTTP_X_FORWARDED_FOR&#39;])) $ip=$_SERVER[&#39;HTTP_X_FORWARDED_FOR&#39;]; else $ip=$_SERVER[&#39;REMOTE_ADDR&#39;]; echo $ip; ?&#62; &#160; &#160; 一、沒有使用代理服務器的情況： &#160; &#160; &#160; REMOTE_ADDR = 您的 IP &#160; &#160; &#160; HTTP_VIA = 沒數值或不顯示 &#160; &#160; &#160; HTTP_X_FORWARDED_FOR = 沒數值或不顯示 二、使用透明代理服務器的情況：Transparent Proxies &#160; &#160; &#160; REMOTE_ADDR = 最後一個代理服務器 IP &#160; &#160; &#160; HTTP_VIA = 代理服務器 IP &#160; &#160; [...]]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/get_user_ip_use_http_x_forwarded_for_http_via_remote_addr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>可以在前端實現的幾個地理位置小功能</title>
		<link>http://tommy.ironman.tw/can-be-achieved-in-front-of-a-small-number-of-geographical-features/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=can-be-achieved-in-front-of-a-small-number-of-geographical-features</link>
		<comments>http://tommy.ironman.tw/can-be-achieved-in-front-of-a-small-number-of-geographical-features/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 05:17:44 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Google Gears]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[YQL]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=3220</guid>
		<description><![CDATA[原文網址：http://www.oncoding.cn/2010/geo-location-frontend/ 在Smashing Magazine上看到這篇Entering The Wonderful World of Geo Location，介紹了獲取並處理用戶地理位置的應用和方法，很有意思。結合原文的內容，加上之前的一些應用，整理了幾個可以完全在前端實現的地理位置相關小功能。 1.通過IP獲取用戶位置 很多時候需要通過IP判斷用戶的位置，通常的辦法是通過自己的後臺程式查詢資料庫得到。如果用戶位置只是應用在前端，或者有其他的特殊原因(比如，懶:)，也有一些其他辦法來快速的獲取用戶位置。 maxmind.com提供了一個服務，通過引入一個js檔(http://j.maxmind.com/app/geoip.js)，可以把他判斷到的用戶的國家、城市、經緯度等資訊加入到頁面中來。下面是從青島訪問這個js檔返回的內容： 我們就可以利用這些資訊做很多東西了：DEMO 另外，騰訊也有一個類似的介面，位址為 http://fw.qq.com/ipaddress，可以得到訪問者的省、市資訊，返回的格式如下： 具體的應用可以看這裏： 斷橋殘雪WordPress天氣插件 2.W3C共用位置介面 HTML5加入了的貢獻地理位置的瀏覽器API介面，目前firefox3.5等瀏覽器已經支援這一功能。 用法： 看 DEMO 3. Google Gears 的 Geolocation API Google Gears是主要提供本地存儲功能的瀏覽器擴展，新版本的Gears中，加入了判斷用戶地理位置的API，通過IP、WIFI熱點等判斷位置。不過Gears的使用似乎並不太廣泛(Chrome內置了Gears，其他瀏覽器需要安裝)，國內的地理位置資訊也不夠豐富，所以這個應用目前只可作為參考。 使用Gears的基本方法看這裏，引入gears_init.js，使用Geolocation API的程式為： 更多內容參考這篇文章：使用Gears獲取當前地理位置，以及DEMO。 4.逆經緯度解析 通過瀏覽器API等方式得到經緯度後，有時需要得到對應的城市名，這就是逆經緯度解析。 google maps api提供了一些經緯度解析方法，如果我們不想引入龐大的api，可以直接使用他的請求位址，通過jsonp方式得到google的經緯度解析資料。jsonp請求位址形式為： http://ditu.google.cn/maps/geo? output=json&#38;oe=utf-8&#38;q=緯度%2C經度 &#38;key=你申請到的key &#38;mapclient=jsapi&#38;hl=zh-CN&#38;callback=myfunction 參數q為經緯度，參數callback為回調函數名。 可以看下這個位址的返回結果，資料非常豐富，並且還是中文的： Yahoo提供的介面 雅虎提供了一些經緯度查詢介面，可以使用YQL查詢。 查詢語句為： 用法： // 08 encodeURIComponent(yql)+'&#038;format=json&#038;diagnostics='+ 09 'false&#038;callback='+callback; 10 11 [...]]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/can-be-achieved-in-front-of-a-small-number-of-geographical-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用Duplicate Post外掛複製WordPress文章或分頁</title>
		<link>http://tommy.ironman.tw/duplicate-post-wordpress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=duplicate-post-wordpress</link>
		<comments>http://tommy.ironman.tw/duplicate-post-wordpress/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 17:25:53 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Duplicate Post]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=3020</guid>
		<description><![CDATA[有時我們的Wordpress文章只需改部分內容，不需要變動很多的時候，就可利用這個Wordpress的外掛 Duplicate Post 複製文章或分頁 軟體名稱：Duplicate Post 軟體版本：1.1.1 軟體語言：英文 軟體性質：免費軟體 系統支援：此為WordPress網站的外掛程式，支援WP 2.7以上版本 官方網站：按這裡 軟體下載：按這裡 安裝教學：按這裡 安裝並啟用後，會出現在2個地方： 1.後台List頁面Duplicate按鈕連結 2.編輯頁面的位置 當點擊 Duplicate 按鈕的時候，對應的文章或者分頁就會被複製成另外一篇文章或者分頁，並在“編輯頁面”打開。複製好的文章或者分頁，除了 URL 之外，其他的內容（包括標籤、摘要、分類等）都和被複製的文章或者頁面是一模一樣的。]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/duplicate-post-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP限制顯示字數語法，中英文混雜時不亂碼</title>
		<link>http://tommy.ironman.tw/php-syntax-restrictions-in-words-in-english-and-chinese-will-not-garbled-mixed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-syntax-restrictions-in-words-in-english-and-chinese-will-not-garbled-mixed</link>
		<comments>http://tommy.ironman.tw/php-syntax-restrictions-in-words-in-english-and-chinese-will-not-garbled-mixed/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 16:03:48 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[程式設計]]></category>
		<category><![CDATA[mb_substr]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[strlen]]></category>
		<category><![CDATA[UTF-8]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=2999</guid>
		<description><![CDATA[這是在UTF-8網頁編碼的環境下使用，我參考神隱部落所修改的PHP限制顯示字串語法，原作者的語法我使用後發現，當實際字數少於需要顯示的字數的時候，後面3個...還是會出現?? 原來是寫成 if (strlen($a) > $b) echo "..."; 照理說應該這樣字數應該能夠比較才對， 不知是變數$b沒有轉成數字型態還是怎樣，所以我將strlen($a) > $b 改為 strlen($a) > strlen($sub_content) 2個變數都先用strlen取得字串長度，再進行比較，就正常了， 而且不會有中英文混雜時亂碼的問題]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/php-syntax-restrictions-in-words-in-english-and-chinese-will-not-garbled-mixed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP判斷Client端瀏覽器是否為IE6.0</title>
		<link>http://tommy.ironman.tw/http_user_agent-check-msie-6-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=http_user_agent-check-msie-6-0</link>
		<comments>http://tommy.ironman.tw/http_user_agent-check-msie-6-0/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 15:49:12 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[HTTP_USER_AGENT]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=2991</guid>
		<description><![CDATA[IE6.0實在是所有網頁設計者的夢靨，有些頁面如IE6.0不支援，乾脆直接跳出警告或轉頁，底下是偵測Client端瀏覽器版本是否為IE6.0 如果去掉6.0的話就只檢查是不是IE]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/http_user_agent-check-msie-6-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP與ASP的response.end相同語法為...</title>
		<link>http://tommy.ironman.tw/php-exit-asp-response-end/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-exit-asp-response-end</link>
		<comments>http://tommy.ironman.tw/php-exit-asp-response-end/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 17:17:16 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[exit]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[response.end]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=2730</guid>
		<description><![CDATA[老師說學寫程式的第一步就是...要會除錯， 剛剛找了半天，原來PHP與ASP的response.end(終止程式碼執行) 相同的語法為： 超簡單的~~=.="]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/php-exit-asp-response-end/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>受保護的文章：Ajax Push – 創造即時聊天室</title>
		<link>http://tommy.ironman.tw/ajax-push/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ajax-push</link>
		<comments>http://tommy.ironman.tw/ajax-push/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 01:46:10 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ajax Push]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=2675</guid>
		<description><![CDATA[受保護的文章不會產生摘要。]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/ajax-push/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP過濾特定的HTML標籤</title>
		<link>http://tommy.ironman.tw/strip-selected-tags/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strip-selected-tags</link>
		<comments>http://tommy.ironman.tw/strip-selected-tags/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 07:55:20 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[strip_selected_tags]]></category>
		<category><![CDATA[函數]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=1832</guid>
		<description><![CDATA[有時候如果需要在網站上放留言版供網友留言，但有些HTML標籤如&#60;br/&#62;換行要讓他有作用，又要避免一些特定的HTML標籤會讓有心人士做壞事，例如在留言內容夾雜&#60;a href&#62;&#60;img&#62;等標籤，讓人不小心連結過去而中毒，這時就可以加入這個函式：  在要顯示訪客留言的欄位呼叫這個函式，與要過濾的特定標籤，這樣比較靈活，例如只要過濾不讓連結與圖片的HTML標籤有效，就在$your_text,之後加上要過濾的標籤名稱a,img... 傳進涵式後，標籤會轉為陣列逐一過濾  註：要讓輸入文字時按Entert產生的“\n”轉變成換行的&#60;br/&#62;，可能還需要再包入 nl2br 這個函式，例如：  nl2br 是 PHP 內建的涵式，直接呼叫就可以了 參考資料：http://tw.php.net/manual/en/function.strip-tags.php]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/strip-selected-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>讓information_schema資料庫在 PHPMyAdmin中不顯示</title>
		<link>http://tommy.ironman.tw/hidden-information_schema-phpmyadmin/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hidden-information_schema-phpmyadmin</link>
		<comments>http://tommy.ironman.tw/hidden-information_schema-phpmyadmin/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 16:18:19 +0000</pubDate>
		<dc:creator>Azan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[information_schema]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://tommy.ironman.tw/?p=1766</guid>
		<description><![CDATA[在默認的情況下，裝完PHPMyAdmin之後，不管用什麼樣的帳號登錄，都會 顯示information_schema這個資料庫，但是我們又不能對這個資料庫進行操作，只能查看它，這個資料庫裏面存放的是資料庫的表名、資料類型、訪問許可權等，大家都想把這個資料庫隱藏掉，不要顯示出來，其實PHPMyAdmin提供這項功能。]]></description>
		<wfw:commentRss>http://tommy.ironman.tw/hidden-information_schema-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

