Posts

Codeigniter 上傳縮圖 檔案沒出來但處理為 TRUE

$CI->load->library('image_lib',$img_resize_config); 照上面寫的話, Codeigniter 縮圖只會處理一次 要處理多張的話 要拆開寫如下 $CI->load->library('image_lib' ); $CI->load->initialize($img_resize_config); 但是我不管怎麼試就是縮圖出不來, 而且 $CI->image_lib->resize(); 一直都是正確的 TURE 值 後來才發現問題在第二行,改成如下搞定 $CI-> image_lib ->initialize($img_resize_config); 完整的縮圖  helper function 如下 function thumbMaker($data = array()){ $CI =& get_instance(); $img_resize_config['image_library'] = 'gd2'; $img_resize_config['source_image'] = $data['upload_data']['full_path']; $img_resize_config['new_image'] = './pimage/1111'.'002.jpg'; $img_resize_config['create_thumb'] = TRUE; $img_resize_config['maintain_ratio'] = TRUE; $img_resize_config['width'] = 100; $img_resize_config['height'] = 100; $CI->load->library("image_lib"); $CI-> image_lib ->in...

[Codeiginter] 首頁可開,其他項目 404 error

原因: http://localhost 可開,但將檔案移至 http://localhost/new 則只能開啟首頁,其他項目 404 error 主要是 .htaccess 檔路徑設定問題,改為以下紅字可解決     RewriteBase / new     RewriteRule ^(.*)$ / new/ index.php?/$1 [L]

[Codeiginter] Your system folder path does not appear to be set correctly

Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php 在安裝 Codeigniter 時,不知道為什麼出現這個問題,檢查後 解決方法是:確定 system 資料夾有正確上傳並上傳到與 index.php 同位置。不知是主機問題還是 filezilla 的問題,system 資料夾就是會一直 missed 掉。

Ping Bot列表

Ping List: Yahoo http://api.my.yahoo.com/rss/ping?u= Google http://blogsearch.google.com/ping?url= Blog Ping List: Yahoo http://tw.search.yahoo.com/free/request Windows Live http://search.msn.com.tw/docs/submit.aspx?url= Google http://www.google.com/addurl?q= Static Ping Site: http://pingomatic.com/ http://pingoat.com/

在SugarCRM環境中 install 安裝 KnowledgeTree

原本SugarCRM的打包版就已經安裝好Apache、PHP、MySQL了,使用iNETDocs必須要再安裝KnowledgeTree,但KnowledgeTree的Sources版安裝方式實在是非常的不友善。 引述KnowledgeTree Wiki裡的 KnowledgeTree 3.5.* - Performing a Source Only Install 引述 KnowledgeTree 知識管理平台 - Boaz-momo's Weblog 先至 SourceForge Download 最新版本的 KnowledgeTree Source版,我抓到的版本是3.5.4a,在SourceForge裡的KnowledgeTree不是正式版也不是試用版,是完全免費的Community版本。 解壓縮到SugarCRM內的htdocs資料夾下,我的路徑為C:\Program Files\sugarcrm\htdocs\kt 先按照官方wiki說的run一次setup看看。 http://localhost/kt/setup/ 結果跳出 500 Internal Server Error 的訊息。 根據apache裡的error.log找到的結果如下 [Fri Jan 09 16:56:45 2009] [alert] [client 127.0.0.1] C:/Program Files/sugarcrm/htdocs/kt/.htaccess: Invalid command 'ExpiresActive' , perhaps mis-spelled or defined by a module not included in the server configuration 所以去KnowledgeTree的目錄裡找到.htaccess檔,將 ExpiresActive 屬性註解掉,包括下列一排的 ExpiresByType 也一併註解掉。 再run一次setup看看。 http://localhost/kt/setup/ 我的狀況是,跳到 404 Not Found 。 此時要去knowledgeTree裡找到config資料夾內的config.ini,我的路徑是C:\Program Files\sugarcrm\htdocs\k...

php反斜線處理

將特殊字元轉成HTML碼 $text =htmlspecialchars(" a href= ' test '> Test < /a > " , ENT_QUOTES); &lt ; a href= &#039 ; test &#039 ; &gt ; Test &lt ; /a &gt ; 將空白與換行轉成HTML碼 $text = "Good morning! \n "; $text = str_replace(' ', ' &nbsp ; &nbsp ; ', nl2br($text) ); echo $text; // Good &nbsp ; &nbsp ; morning! <br / > 避免SQL Injection安全隱憂 mysql_real_escape_string($password) //$password = "' OR ''='"; $password -> \' OR \'\'=\' SQL Injection attacks will not work. magic_quotes_gpc 表單中文字包含 ' " \ magic_quotes_gpc自動加上\ -> \' \" \\ 最好視為預設關閉 function myStripslashes($text) { if (get_magic_quotes_gpc()) $text = stripslashes($text); return $text; } $text = myStripslahes($_POST['text']); 手動加上 addslashes(String) 手動去掉 stripslashes(String) Conclude: 接收表單資料後使用4回覆原始資料 而後使用3寫入MySQL(加上反斜線) 從MySQL拿出資料先stripslashes 再使...

分散PageRank的流量統計工具

Image
其實不管是StatCounter也好、Yahoo奇摩站長工具也好,在每一頁都附加的語法可以統計各種流量,但是如果這個語法在常見的<script>之外還多了一個小小的<a>時,這個時候,不管你網站中每一頁面的PageRank有多少,都一定會稀釋掉某一種程度的PageRank分數給這個流量統計網站。 StatCounter 的流量統計程式碼 換句話說,如果網站之中有越多的外部連結時,這個網頁的PageRank值就會越來越少;而指向自己的網站越多(推薦鏈結),PageRank值當然也就會越高,這也就不難怪為什麼 StatCounter 的PageRank值可以高達到9,和全美最大的sns交友網站 Facebook 平起平坐了。因為只要使用了他們所提供的流量統計工具,每個人每個網頁都將會Feedback一個Link給它。 在國內類似的流量統計工具, Yahoo奇摩站長工具 也有使用這樣的方法。 Yahoo奇摩站長工具 的流量統計程式碼 也許有些人會只留下<script>的程式碼,讓這個外部鏈結取消掉,但是在這樣做之前,最好還是先確定一下是否有違反他們的使用規範比較好。東西再好用也得要用得安心嘛。 相關閱讀: MESON 手札 - 單車 相機 部落格:Google Page Rank=5 背後代表什麼意義 ?