2010年11月12日 星期五

[PHP] cache禁止瀏覽器快取網頁 No Cache

資料來源:http://dorothycode.blogspot.com/2010/10/php-cache-no-cache.html

[PHP] cache禁止瀏覽器快取網頁 No Cache
避免proxy或bowser cache住你的網頁。(如此的話使用者看到的都會是舊的畫面)

HTML Meta Tag:
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache"> 舊式寫法,加是為了相容性。
<meta http-equiv="expires" content="0"> 將網頁設做立即過期。
In PHP:
<?php
// Expires in the past
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
// Always modified
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
?>

2010年11月11日 星期四

MySQL安裝完成後服務無法啟動的解決方法

文章來源:MySQL Forums :: InnoDB :: Plugin 'InnoDB' init function returned error.
For Windows OS:

OK, I struggled with this for ages. There are various partial fixes that did not fix it for me on the web, but in the end the following worked:

If you've installed it, then uninstall (an earlier version that had been removed could have left crap that is causing an issue, so best to start off clean). Do this as follows:
- Add/Remove Programs and remove MySQL.
- Delete the Programs File/MySQL folder (it gets left behind)
- Delete the data file (where ever you stored it) #:\MySQL DataFiles > This is assuming you have no data to as yet to worry about!!!!
- Run RegEdit and delete all the MySQL Keys (search and F3) and the half a dozen or so CLSIDs that coe up with just a single non-defailt key for MySQL. You can leave ADOBE\ keys that mention it if you have dreamweaver etc. As allways back up you registry first before choppig it!

OK. Now run te install and go through the config wizard until it fails at the start up. Then close it.

Now open up Services and open MySQL properties - I set it to run under the Administrator account rather than System/ANOther to ensure it had permissions.

Next, go to your new MySQL DataFile and delete 'ibdata1'.
Then go to 'C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data' and delete all tje 'ib_logfile' prefixed files (should be 0 and 1) - useful to notice the .err log here to which is a text file.

Then go back to Services and manually start it and all should be fine.

Hopefully I have saved you a few hourse peeing around with Windows - MySQL Devs, about time this bug was fixed eh? Been hanging around a long while now and the web is chok full of unanswered or half answered requests for help. Remember - some of us have no choice but to use Windows.

2010年11月10日 星期三

邊做邊學 PHP on Windows:在 IIS7 上執行 PHP

以下內文轉載於:Microsoft MSDN 
邊做邊學 PHP on Windows:在 IIS7 上執行 PHP

如何使用 CDO 物件來寄 E-Mail

以下內容轉載自強力鎯頭 の VB 部落
如何使用 CDO 物件來寄 E-Mail

CDO ( Collaboration Data Objects ) 物件 對應檔案 CDOSYS.dll E-Mail 寄送使用;
可應用於 VB ASP .Net 是簡單的信件寄送方式之一

    Dim objCDO As Object
    Dim strCfg As String

    Set objCDO = CreateObject("CDO.Message")
    strCfg = "http://schemas.microsoft.com/cdo/configuration/"

    With objCDO
       
        .Sender = "別胡亂送@OhMyGod.com"
        .From = "誰是寄件者@NoOneKnows.com"
        .To = "要寄給誰@whois.com.tw"

        .Fields("urn:schemas:mailheader:X-Priority") = 1 ' Priority = PriorityUrgent 高優先順序
        .Fields("urn:schemas:mailheader:return-receipt-to") = "誰是寄件者@NoOneKnows.com" ' 要求讀取回條
         ' .Fields("urn:schemas:httpmail:importance") = 2 ' Importance = High
       ' .Fields("urn:schemas:httpmail:priority") = 1 ' Priority = PriorityUrgent
        .Fields.Update ' 更新欄位
       
        .Subject = "沒有主旨(放主題啦)"
       
        .TextBody = "ORZ" ' Text 文字格式信件內容
        ' HTML 網頁格式信件內容
        .HTMLBody = "<HTML>" & _
                                "<BODY>" & _
                                "<table border=""1"" width=""100%"">" & _
                                "<tr><td>I</td><td>am</td><td>Hammer</td><td>!</td></tr>" & _
                                "<tr><td>Who</td><td>r</td><td>u</td><td>?</td></tr>" & _
                                "</table>" & _
                                "</BODY>" & _
                                "</HTML>"
                               
        .AddAttachment "C:\AttFile.zip" ' 附加檔案
       
        .CC = "Xman@yahoo.com.tw"   ' 副本
        .BCC = "SpiderMan@hotmail.com.tw" ' 密件副本
       
        .Configuration(strCfg & "sendusing") = 2 ' Sendusing = SendUsingPort
        .Configuration(strCfg & "smtpserver") = "msa.hinet.net" ' SMTP Server
       ' .Configuration(strCfg & "smtpserverport") = 25 ' SMTP Server Port ( 預設即為 25 )

        ' SMTP Server 如需登錄 , 則需設定 UserName / Password
        ' .Configuration(strCfg & "sendusername") = "UserName" ' Send User Name
        ' .Configuration(strCfg & "sendpassword") = "Password" ' Send Password
       
        .Configuration.Fields.Update ' 更新 (欄位) 組態
       
       ' .DSNOptions = 4 ' 回傳信件傳送狀態
       '  cdoDSNDefault = 0 , DSN commands are issued.
       '  cdoDSNDelay = 8 , Return a DSN if delivery is delayed.
       '  cdoDSNFailure = 2 , Return a DSN if delivery fails.
       '  cdoDSNNever = 1 , No DSNs are issued.
       '  cdoDSNSuccess = 4 , Return a DSN if delivery succeeds.
       '  cdoDSNSuccessFailOrDelay = 14 ,Return a DSN if delivery succeeds, fails, or is delayed.

        .Send ' 傳送
       
    End With
   
    Set objCDO = Nothing


以上內容轉載自強力鎯頭 の VB 部落
其他參考資料:http://www.pro-soho.com/blog/article.asp?id=295


CDO 郵件元件使用方法
Microsoft從Windows Server 2000 及 Windows XP開始內建郵件元件已改為CDO
在之前的系統內建郵件元件則是 CDONTS,各位要注意,以下是CDO的用法

屬性 說明
Subject 郵件的主旨
From 寄件人的電子郵件信箱
To   收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
CC   副本收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
BCC 密送副本收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
TextBody 郵件的本文-純文字模式
HTMLBody 郵件的本文-HTML模式