wordpress 資料庫正規化之我思….

在處理wordpress tags/category時………
真的是說不出來的感覺
他把 tage/category分成3個表
第一個表~記錄tags/category的名稱
第二個表~記錄tags/category的種類[tags|category]
第二個表~記錄tags/category與文章的關係(一篇文章可掛在多個分類~使用多個tags)
基本上~只要分2個表就好了…….實在不懂為什麼分成2個表
這樣~也沒有比較會厲害… Read more

wordpress 二次開發

外面一堆文章說wordpress的使用者編碼是MD5
其實~測試的結果是~他可以接受2種編碼
第一種編碼~我不確定是什麼編碼方式~
長的像這樣 $P$BU2RGPBzC0ITA918rljQxn.EYW3ul5/
第二種編碼~MD5 hash
長的像這樣 481ab5322e207670008856dafdb74bda
假設~我們使用MD5編碼去改「忘記」的密碼(mysql/phpmyadmin)
是可以登入的~但是….登入之後~MD5編碼會被改掉
所以…..再用原來的password登入之後~
就會登入失敗~
所以…如果要做二次發的時候
……..怎麼辦咧
還是有可能前台後來進進出出…
只好蠻幹~登入之前這麼做
查看看這個使用者在不在~不在的話~就insert這個使用者
如果在的話….就去更新密碼
但是….問題又來了~
wordpress的使用者權限是記在wp_usermeta中~該不會又要再塞一次值吧!
實在給他#$%^&*()(*&^%$……..遜到爆

DOM-XML issue of PHP

I use a package to generor the rss feed, but it show the message as below.

Warning: require_once(class.DomDocument.inc.php) [function.require-once]: failed to open stream: No such file or directory in…

The it will show me the fatal erro, It could not load file ‘class.DomDocument.inc.php’.
But the file does not include in the package.
And I could run these file in another server, so I guest the question made from a addon of php.

I modify the code to get the debug message:
class.RSSItemList.inc.php
class.ObjectList.inc.php
class.RSSItem.inc.php
class.RSS_V_200.inc.php
class.RSS_V_abstract.inc.php
class.DomDocument.inc.php <—-it does not include this file in the package.

I research the data in the google, someone says that , it need the libxml2 library.
But in the default ver. of apache in the linux platform, it include already.
And I research the others file about the XML and DOM.
Finaly, I got the answer, It need php-domxml addon.
Just install it through yum, and don’t forget restart apache.
Let the apache reload the php.ini , and it will load the addon for php.

command as below.
yum install php-domxml
service httpd restart

Virtual Host to Enablye the Header Rewrite.

If we got the message show as as below, we may not enablye the apache rewrite function.
2009-02-28_071618.png
To enable this function we should modify the httpd.conf.
Add these command line in the virual host block

RewriteEngine On
Options +FollowSymlinks

To save the httpd.conf and Restart the apache.
when you wirte the .htaccess file without errors, and
your will get the rewrite function.
if not, you man find out the issue from the log.

session還是記錄一下時間比較好

在linux平台上進行php程式開發時,session可以指定路徑存放~
而且裡面的內容是純文字檔~
假設在session中記錄了相關的資料~
答案~密碼~動作就被看光光了~
所以~在存在session中的資料~重要的~還是要加密一下~

另外,在某些borswer開啟下~就會記錄開啟的session編號~
所以~如果在session中沒有記錄上次執行的時間
那麼 …session不會timeout~永遠都有效~
這是多麼恐怖的一件事啊~
難怪某社群網站~被我用這種方式打造出來的機器人玩翻掉..
一直timeout也很怪~
那session判斷的程式~也含更新session中時間的功能的話~
也許就不會有這樣的問題了…
只是~會花一點點效能~

被白痴的IE7打敗

我有一個Hosting網站~
今天~我從CPenel 下載了Detial的Web access log來看
很自然的~他給我了一個壓縮下載檔
而裡面的檔名~自然就是xxx.abc.com
我個人的習慣~會把這個檔案解出來
放在桌面上~當然這個xxx.abc.com是文字檔(Unix)
我通常會用notepad++來開啟
好巧不巧…我用IE來開這個網站
不巧~小弟我又是懶人一枚
我就是直接打網址xxx.abc.com
結果…他問我是不是要開啟檔案
哇咧…我才在想~我的網站有防毒的保証
該不會被掛(木)馬了吧~
後來~我懂了~
xxx.abc.com視為執行檔~
沒有輸入”http://”的網址…他會從桌面先找
我就說~怎麼用firefox測都沒有問題~
但是IE測起來有問題…真的是被打敗了
難怪~桌面上東西多~執行起來就很慢