2013年11月23日 星期六

2013年11月16日 星期六

preg_match 比對 E-mail 格式


$email = "[email protected]"

preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", $email)

另種比對 email 的方式

filter_var($email, FILTER_VALIDATE_EMAIL)

2013年11月14日 星期四

[部落格介紹] Ant's ATField


分類
心情分享, 3C資訊

網址

php 取得 Cookie 並讀入陣列


<?php

if(strstr($http_header,"Set-Cookie:"))  
            {  
                list($coo,$cookiestring)=explode(" ",$http_header);
                $cookies[] = $cookiestring;
            }

?>

php 使用 fsockopen 取回需登入的網站資料


<?php

$yoursite ="http://website.com"
$name = "name";
$password = "password";

$string=base64_encode($name.":".$password);
$head="GET / HTTP/1.0\r\n\r\n";
$head.="Accept: text/html\r\n";
$head.="Authorization: Basic $string\r\n\r\n";

$fp =fsockopen($yoursite, 80, $errno, $errstr, 30);

if (!$fp) {echo "$errstr ($errno)";
}
else
{
fwrite ($fp, $head);
while (!feof($fp)) echo fgets ($fp,128);
}
fclose ($fp);
?>

PHP fsockopen 去除 Header

<?php

substr($httpdata, strpos($httpdata,"\r\n\r\n")+4);

?>

2013年11月12日 星期二

[部落格介紹] 八克里


分類
生態紀錄

網址

介紹
這是巴克里的布拉格(mtchang's blog)!!記錄雖是零散但卻是最真實的呈現。

jQuery 檢查特定一個單選框, 是否有被點選


Html Code
<input id=name1 type=radio>
<input id=name1 type=radio>

JS Code
if (  $("input[type='radio']").get(1).checked ){
   console.log="checked";
}

2013年11月9日 星期六

2013年11月7日 星期四

Godaddy SSL 更新

從 Godaddy 下載 SSL 檔

一個壓縮檔有兩個檔案

1.[你的域名].crt

2.gd_bundle.crt

將第二個檔案內容增加到第一個

指令
cat gd_bundle.crt >> [你的域名].crt

重新啟動伺服器
nginx restart

參考資料:

Configuring HTTPS servers

http://nginx.org/en/docs/http/configuring_https_servers.html#chains


CentOS 6.4上面的 Nginx + php-fpm + SSL + VirtualHost 設定
http://blog.jangmt.com/2013/04/centos-64-nginx-php-fpm-ssl-virtualhost.html

Godaddy SSL 購買與安裝

http://www.gcos.me/2013-08-08_buy-ssl-from-godaddy.html

鴨七 SSL 憑證購買記
http://blog.yorkxin.org/posts/2009/02/23/buying-a-turbo-ssl-cert

Apache 2.2.17 啟用 SSL
http://chiangchingchi.pixnet.net/blog/post/44718239-apache-2.2.17-%E5%95%9F%E7%94%A8-ssl

Nginx SSL 憑證安裝
http://gs.wis.com.tw/support/support_ssl_53.html

NGINX Http SSL Module
http://wiki.nginx.org/NginxHttpSslModule