[轉貼]apache and mod_limitipconn限制每一個IP的連線數量

[轉貼]apache and mod_limitipconn限制每一個IP的連線數量

文章來源: http://gisanfu.pixnet.net/blog/post/13730030-apache-and-mod_limitipconn%E9%99%90%E5%88%B6%E6%AF%8F%E4%B8%80%E5%80%8Bip%E7%9A%84%E9%80%A3%E7%B7%9A%E6%95%B8%E9%87%8F

[轉貼]PHP 爬取需要运行 JS 的页面 (Run JS While Grabing Web Page With PHP)

如果 curl 執行回來的 html 其中的 js 需要執行 才會有正常的頁面回來的話 可以參考看看 phantomjs 這方式

 

來源: PHP 爬取需要运行 JS 的页面 (Run JS While Grabing Web Page With PHP) | Laravel China 社区 – 高品质的 Laravel 开发者社区 – Powered by PHPHub

[轉貼]HTML5中的Web通知桌面通知

if (Notification.permission == "granted") {
    var notification = new Notification("Hi,帅哥:", {
        body: '可以加你为好友吗?',
        icon: 'mm1.jpg'
    });
    
    notification.onclick = function() {
        text.innerHTML = '张小姐已于' + new Date().toTimeString().split(' ')[0] + '加你为好友!';
        notification.close();    
    };
}    

张鑫旭的个人博客_web前端技术文章_简单了解HTML5中的Web Notification桌面通知

來源: 简单了解HTML5中的Web Notification桌面通知 « 张鑫旭-鑫空间-鑫生活

[PHP] 解決+號在get傳輸時變成空白的問題

使用get方式時,參數內容有帶”+”的話,接收方會變成空白 ex:   got.php?a=A+B 則got.php接收的a會得到”A B”,加號會變成空白 解法就是,在帶入a的值時,把”+”取代成”” 這樣接收方就能正確接收加號。

來源: [PHP] 解決+號在get傳輸時變成空白的問題

簡單的處理:
urldecode(str_replace(“+”,”%2B”,urlencode([要處理的])));

Sublime-HTMLPrettify 程式碼整理

因為.php檔案 沒有設定到 必須手動在 html中 補上檔名為 .php的也要整理

安裝方式:
Ctrl+Shift+P or Cmd+Shift+P in Linux/Windows/OS X
type install, select Package Control: Install Package
type prettify, select HTML-CSS-JS Prettify

來源: GitHub – victorporof/Sublime-HTMLPrettify: HTML, CSS, JavaScript and JSON code formatter for Sublime Text 2 and 3 via node.js

PHP Html Purifier 編輯器過濾 xss

剛好我用的是CI..
https://github.com/refringe/codeigniter-htmlpurifier
只是這個範例要安裝composer 然後修改autoload位置..確實過濾的蠻強大的…

另外提醒..光靠前端的js抵禦 是沒意義的喔..

把其中的

require_once APPPATH.'third_party/htmlpurifier-4.8.0-standalone/HTMLPurifier.standalone.php';

修正為

require dirname(dirname(__DIR__)) . '/vendor/autoload.php';

測試方法

$dirty_html = <<<TEST
攻擊字串...etc
TEST;
$this->load->helper('htmlpurifier');
$clean_html = html_purify($dirty_html);
var_dump($clean_html);

來源: refringe/codeigniter-htmlpurifier: A Codeigniter helper to purify html input using the HTMLPurifier standalone class.

Query Explorer — Google Analytics Demos & Tools

使用GA來記錄網站流量已經不稀奇

而這流量能透過 Google Analytics Api 來做抓取

要抓取需要以下動作 :
1.設定金鑰
2.用composer去安裝ga的庫
3.google api開通
4.開始寫程式

閱讀全文〈Query Explorer — Google Analytics Demos & Tools〉

[轉貼]別再手動輸入客戶姓名!5 張圖學會Excel+Word一起用,自動發送大量、客製化Email

大量發送客制化郵件

來源: 別再手動輸入客戶姓名!5 張圖學會Excel+Word一起用,自動發送大量、客製化Email|經理人

mysql大量資料匯入匯出

資料庫資料匯出(dump)
範例:
mysqldump -u test -p testdb > alltable.sql

資料庫資料匯入
範例:
mysql -u test -p testdb < testtable.sql 兩台伺服器要傳遞大檔案時 可以用 //檔案下載 wget 網址 (從A搬到B) 當然要注意 下載完畢記得清除 以免被有心人士下載走重要資料