[PHP] header下載檔案 搭配資料庫
Posted on May 26, 2007
| 1 minutes
| 184 words
| appleboy
剛剛在 ECstart 看到有人詢問 header檔案下載錯誤 發現網站義工有回答到這個function,所以就紀錄下來了
function dl_file($file){
//First, see if the file exists
if (!is_file($file)) { die("404 File not found!"); }
//Gather relevent info about file
$len = filesize($file);
$filename = basename($file);
$file_extension = strtolower(substr(strrchr($filename,"."),1));
//This will set the Content-Type to the appropriate setting for the file
switch( $file_extension ) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "
[Read More]wordpress 留言被灌爆 – plugin – WP-ImgCode mod
Posted on May 21, 2007
| 1 minutes
| 34 words
| appleboy
今天有人問我,blog留言版被灌爆,都是廣告信,我想說 wordpress 不是有內建一個外掛 Akismet 這個外掛可以擋掉很多spam,讓你的留言版不至於有廣告信,不過還是可以加上留言版的驗證圖形,這樣會更安全一點。 今天找到一個國人改寫的 WordPress plugin – WP-ImgCode mod 這個還不錯用,安裝方式如下
安裝啟用
- 將解壓縮出來的 wp-imgcode 資料夾放到 WordPress 的 plugin 資料夾,預設為 wp-content/plugins。
- 在控制台中啟用這個 plugin。
加入驗證碼
- 開啟目前使用佈景的相關檔案,例如 comments.php。
- 在要顯示驗證碼的地方,加上這個程式碼:
ID); ?>
明天在去搞定別人的網站吧~ 先紀錄一下~
[PHP] 如何切割中文標題
Posted on May 19, 2007
| 1 minutes
| 166 words
| appleboy
今天看到酷!學園討論區,php版有人問說要如何切割中文字,結果我自己以前弄的一個function就貼了上去,如下
function cut_word($text, $num){
if(strlen($text) > $num) {
for($i=0;$i<$num;$i++) {
$ch=substr($text,$i,1);
if(ord($ch)>127) $i++;
}
$text= substr($text,0,$i).".";
}
return $text;
}
[Read More]替代役不平等待遇 (續) 替代役長官 (廖秘書)
Posted on May 14, 2007
| 1 minutes
| 8 words
| appleboy
廖秘書是在成功嶺把我錄取的人,也是他的惡夢開始,回想起來:在我2006年2月9號入伍,然後經過一個禮拜,劉專門委員(目前為整理組組長)來到成功嶺來找尋他們所要的人才,當時我記的很清楚,口口聲聲說要linux人才,資訊類,可是我做了一年多,只有我這個替代役是在從事資訊服務,其他資訊類專長的替代役,全部都拿去鍵打資料,相當浪費替代役人才,在成功嶺退伍前,國史館台灣文獻館 來到成功嶺挑選人才,我還記的很清楚,我是被劉專門委員挑上的,可是在這短短的一年多,我跟他幹上好幾次,這裡不多說了,之後還要寫一篇for him。
[Read More]替代役不平等待遇?替代役長官 (黃秘書)
Posted on May 6, 2007
| 1 minutes
| 7 words
| appleboy
替代役其實是一個蠻好的職位,可以不必去軍隊裏面,又可以貢獻給國家,可是很多單位申請替代役,好像都搞錯方向,把我們當勞工在操,什麼事情都叫替代役做,然後正職公務人員很涼,天天沒事做,看報紙,泡茶?說實在替代役的義務是輔助性質,也就是說幫正職公務人員處理一些雜事,可是好像本單位『國史館台灣文獻館』不是這樣認為,單位主管除了平實請替代役幫忙修電腦之外,下班之後還叫替代役去單位主管家裡修電腦,甚至幫忙下載東西,我想這是不太對的吧?
[Read More][FreeBSD] Smokeping 安裝 架設
Posted on April 28, 2007
| 1 minutes
| 156 words
| appleboy
昨天看到 sayya 的 firedragen 個人版,看到 smokeping 的一些圖片,還蠻帥的,就想到要架設來玩看看 安裝方式如下:
[FreeBSD][root][ ~ ]# cd /usr/ports/net/smokeping/ 進去之後
make install clean 然後底下是安裝好之後的訊息
NOTE: A set of sample configuration files have been installed: /usr/local/etc/smokeping/config /usr/local/etc/smokeping/smokemail /usr/local/etc/smokeping/basepage.html /usr/local/etc/smokeping/tmail You *MUST* edit these to suit your requirements. Please read the manpages ‘smokeping_install’ and ‘smokeping_config’ for further details on installation and configuration. If you are upgrading from a previous version of Smokeping, the manpage ‘smokeping_upgrade’ may be of help.
[Read More]WordPress plugin fckeditor
Posted on April 18, 2007
| 1 minutes
| 14 words
| appleboy
[DNS] Domain Name transfer From DreamHost to Godaddy 教學
Posted on April 16, 2007
| 1 minutes
| 60 words
| appleboy
目前我自己的Domain : wu-boy.com,已經快過期了,到2007.04.30就到了,在網路上常常看到一堆文章寫 dreamhost 的不好,底下列了幾篇 DreamHost Sucks ! 搶救 xdite.net 所用的奇技淫巧
[Read More][Mysql] 資料庫備份[big5]utf8轉換成utf-8
Posted on April 8, 2007
| 1 minutes
| 77 words
| appleboy
其實在很多opensource底下的套裝軟體,資料庫預設都是用 utf8,我想這會造成在 phpMyAdmin 底下看到亂碼,然後自己之前也有遇到問題,然後又在網路上看到這篇 搶救 xdite.net 所用的奇技淫巧 裡面所寫的備份方式跟我在轉換 phpBB2 跟自己的 wordpress 一樣 大同小異,我還在想說有更好的解法說,看來是沒有,在 wordpress 底下,只能利用後台的資料庫備份,不然用phpMyAdmin的話,我想你備份出來也是沒用。
[Read More][SQL] SQL 進階搜尋寫法~ 一個很簡單的問題
Posted on April 6, 2007
| 1 minutes
| 144 words
| appleboy
最近在幫 國史館台灣文獻館 寫館內搜尋系統,然後遇到一個問題,晚上跟 sayya裡的大大 ghost 搞了很久,也佔用 ghost 大大很多時間,在這裡先感謝他大力相助~,他還說 這是他解決最久的問題,哈哈,問題如下
我先列出3個表格的欄位跟一些值 table1 class_id, class_title 1 name1 2 name2 table2 class_id, series_name 1 000001 1 000002 1 000003 2 001001 2 001002 2 001003 table3 group_id, group_name 1 000001 1 000002 1 000003 1 000004 2 001001 2 001002 2 001003 如果想要 table1 跟 table2 結合 只要下 sql語法一
############
ex: Select * From table1 as t1, table2 as t2 where t1.class_id = t2.
[Read More]