用mysql的trigger完成ping service

因為進行wordpress的二次開發
無法自動進行PING的動作
所以~花了時間去研究一下 mysql 的trigger要怎麼做
目前可以做到的~
在新增文章~或是更新文章的時候~
會自動新增(修改)另一個資料表
只要一個小程式~就可以判斷哪些文章還沒有PING過~
或是那一篇文章~修改過了~待PING

玩起來~還蠻有趣的~
今天~晚上算是玩樂~
而不是工作~哈哈

PHP 亂數密碼產生器

Sample 1:
function randStr($len=6)
{
$chars=’ABDEFGHJKLMNPQRSTVWXYabdefghijkmnpqrstvwxy23456789#%*’;
// characters to build the password from
mt_srand((double)microtime()*1000000*getmypid());
// seed the random number generater (must be done)
$password=”;
while(strlen($password)<$len)
$password.=substr($chars,(mt_rand()%strlen($chars)),1);
return $password;
}

Sample 2:
function generatorPassword()
{
$password_len = 7;
$password = ”;

// remove o,0,1,l
$word = 布啦布啦布啦 , , Leave a comment

joomla 測試~

看到它的架構~
感覺起來~真的蠻不錯的~
但是….這個CMS級的系統~
拿來當Blog~功能卻不怎麼樣….
xml-rpc上傳圖片會失敗….
中文化…其實還好…
後台管理蠻複雜的~
不適合給一般使用者使用
倒是很多學校~大型公司使用
小公司哦….那就算了唄…

中文化小組說~他唸起來像「君啦」
可是~唸起來應該像~「豬母啦」~
哈哈~以後就叫他豬母系統好了….

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