| 1 | = 2009-03-21 = |
| 2 | |
| 3 | == Debian == |
| 4 | |
| 5 | * [http://packages.debian.org/lenny/dbconfig-common dbconfig-common] - common framework for packaging database applications |
| 6 | * 如果 deb 套件會使用到 SQL 資料庫的話,可以相依這個套件,然後透過 dbconfig-common 來做資料庫的設定。 |
| 7 | * 參考打包範例 [http://packages.debian.org/lenny/webcalendar webcalendar] |
| 8 | |
| 9 | == Web Service == |
| 10 | |
| 11 | * [備忘] Apache 要啟用 .htaccess 的話,必須在設定中加上 |
| 12 | {{{ |
| 13 | AllowOverride ALL |
| 14 | }}} |
| 15 | * [備忘] 有些網頁還是維持 Big5 的字集,如果做轉換不方便的話,可以在 Apache 設定檔中,針對該目錄加入 |
| 16 | {{{ |
| 17 | AddDefaultCharset Big5 |
| 18 | }}} |
| 19 | |
| 20 | == Active Directory / LDAP / PHP == |
| 21 | |
| 22 | {{{ |
| 23 | function ldap_auth($adhost, $port, $uid_field, $basedn, $binddn, $passwd, $userid, $userpasswd) { |
| 24 | global $msg, $db, $default_prefix, $default_prefix_id ; |
| 25 | $ds = @ldap_connect($adhost, $port) ; // must be a valid LDAP server! |
| 26 | if ($ds) { |
| 27 | $r = @ldap_bind($ds, $binddn, $passwd); |
| 28 | if(!$r){ alert_err("binding failed !!"); } |
| 29 | // Search usrname entry |
| 30 | $sr = @ldap_search($ds, $basedn, "(".$uid_field."=".$userid.")"); |
| 31 | $user_arr = @ldap_get_entries($ds, $sr) ; |
| 32 | //echo print_r($user_arr) ; exit ; |
| 33 | if ($user_arr["count"] == "1") { |
| 34 | $user_binddn = $user_arr[0]["dn"] ; |
| 35 | $ub = @ldap_bind($ds, $user_binddn, $userpasswd) ; |
| 36 | if(!$ub) { alert_err($msg["ad_passwd_err"]); } |
| 37 | } else { alert_err($msg["ad_search_err"]) ; } |
| 38 | ldap_close($ds); |
| 39 | return true ; |
| 40 | } else { |
| 41 | alert_err("Unable to connect to LDAP server") ; |
| 42 | } |
| 43 | }}} |