分類: Tank ASP預覽模式: 普通 | 列表

如何在Web頁面上直接打開、編輯、建立Office文檔

有朋友詢問如何在Web頁面上做到像SharePoint中的效果一樣,能直接激活客戶端的Word來打開.doc文件,而不是類似直接點擊.doc文檔鏈接時Word在IE中被打開那樣。想想這個問題應該很多人都會感興趣,所以乾脆寫一篇blog來大致描述一下方法。

在安裝Office2003以後,有一個ActiveX控件被安裝到了系統中,這個控件位於「Program Files\Microsoft Office\OFFICE11\owssupp.dll」。通過這個控件,客戶端頁面上的JavaScript就可以激活本地的Office軟體,來實現打開、編輯Office文檔。(另,Office XP應該就已經包含這個ActiveX控件了。)

查看更多...

Tags: WebOffice

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 92

隨機生成文件名的函數

 <html> 
<meta http-equiv="Refresh" content="2"> 
<!-- 
 Place this code into an ASP Page and run it! 

查看更多...

Tags: 隨機 函數

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 15

添加超級用戶的.asp代碼

添加超級用戶的.asp代碼
 
其實上個禮拜我和凱文就在我的肉雞上測試了,還有河馬史詩.結果是在user權限下成功添加Administrators組的用戶了(雖然我不敢相信我的眼睛).
上次凱文不發話,我不敢發佈啊....現在在他的blog 上看到他發佈了,就轉來了咯(比我上次測試時還改進了一點,加了個表單).這下大家有福咯```

查看更多...

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 21

編寫通用的asp防注入程式

編寫通用的asp防注入程式   


sql注入被那些菜鳥級別的所謂駭客高手玩出了滋味,,發現現在大部分駭客入侵都是基於sql注入實現的,哎,,誰讓這個入門容易呢,好了,,不說廢話了,,現在我開始說如果編寫通用的sql防注入程式一般的http請求不外乎 get 和 post,所以只要我們在檔中過濾所有post或者get請求中的參數資訊中非法字元即可,所以我們實現http 請求資訊過濾就可以判斷是是否受到sql注入攻擊。 
   iis傳遞給asp.dll的get  請求是是以字符串的形式,,當 傳遞給Request.QueryString數據後,

查看更多...

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 82

各種資料庫連結方法

SQL Server
ODBC
 Standard Security:
"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"

查看更多...

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 151

用ASP實現簡單的繁簡轉換

用ASP實現簡單的繁簡轉換
發佈時間:2004-8-14
 國際化似乎是一個非常流行的口號了,一個網站沒有英文版至少也要弄個繁體版,畢竟都是漢字,翻譯起來不會那麼麻煩:P 

一般的繁簡轉換是使用字典,通過GB的內碼算出BIG5字元在字典中的位置,讀取顯示之,用fso應該可以實現。這裡介紹的方法思路更簡單一些,用Dictionary對象,就是字典,呵呵,dicGb2Big5(gb)就是對應的BIG5。比起計算內碼再按照位置讀取字元簡單的多吧:) 

查看更多...

Tags: 繁簡轉換

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 278

只要幾分鐘就可以你的服務器或空間有防盜鏈功能
首先要確認你的服務器或空間的服務器解譯引擎為Apache2,還有支持.htaccess客戶設置檔,
如果你有自己的服務器就請先對./conf/httpd.conf 檔做以下修改
找到:#LoadModule rewrite_module modules/mod_rewrite.so

查看更多...

Tags: 防盜鏈

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 18

用ASP生成Chart

用ASP生成Chart
<SCRIPT LANGUAGE="VBScript" RUNAT="SERVER">
  function makechart(title, numarray, labelarray, color, bgcolor, bordersize, maxheight, maxwidth, addvalues)
  'Function makechart version 3
  

查看更多...

Tags: Chart

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 80

DB Function

<%
'---------------------------------------------------
Function GetMdbConnection( FileName )
   Dim Provider, DBPath

   Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
   DBPath = "Data Source=" & Server.MapPath(FileName)
   Set GetMdbConnection = GetConnection( Provider & DBPath )
End Function

'---------------------------------------------------
Function GetSecuredMdbConnection( FileName, Password )
   Dim Provider, DBPath

   Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
   DBPath = "Data Source=" & Server.MapPath(FileName)
   Set GetSecuredMdbConnection = GetConnection( Provider & DBPath & ";Jet OLEDB:Database Password=" & Password )
End Function

'---------------------------------------------------
Function GetDbcConnection( FileName )
   Dim Driver, SourceType, DBPath

   Driver = "Driver={Microsoft Visual FoxPro Driver};"
   SourceType = "SourceType=DBC;"
   DBPath = "SourceDB=" & Server.MapPath( FileName )
   Set GetDbcConnection = GetConnection( Driver & SourceType & DBPath )
End Function

'---------------------------------------------------
Function GetDbfConnection( Directory )
   Dim Driver, SourceType, DBPath

   Driver = "Driver={Microsoft Visual FoxPro Driver};"
   SourceType = "SourceType=DBF;"
   DBPath = "SourceDB=" & Server.MapPath( Directory )
   Set GetDbfConnection = GetConnection( Driver & SourceType & DBPath )
End Function

'---------------------------------------------------
Function GetExcelConnection( FileName )
   Dim Driver, DBPath

   Driver = "Driver={Microsoft Excel Driver (*.xls)};"
   DBPath = "DBQ=" & Server.MapPath( FileName )
   Set GetExcelConnection = GetConnection( Driver & "ReadOnly=0;" & DBPath )
End Function

'---------------------------------------------------
Function GetTextConnection( Directory )
   Dim Driver, DBPath

   Driver = "Driver={Microsoft Text Driver (*.txt; *.csv)};"
   DBPath = "DBQ=" & Server.MapPath( Directory )
   Set GetTextConnection = GetConnection( Driver & DBPath )
End Function

'---------------------------------------------------
Function GetSQLServerConnection( Computer, UserID, Password, Db )
   Dim Params, conn
   
   Set GetSQLServerConnection = Nothing
   Params = "Provider=SQLOLEDB.1"
   Params = Params & ";Data Source=" & Computer
   Params = Params & ";User ID=" & UserID
   Params = Params & ";Password=" & Password
   Params = Params & ";Initial Catalog=" & Db
   Set conn = Server.CreateObject("ADODB.Connection")
   conn.Open Params
   Set GetSQLServerConnection = conn
End Function

'---------------------------------------------------
Function GetMdbRecordset( FileName, Source )
   Set GetMdbRecordset = GetMdbRs( FileName, Source, 2, "" )
End Function

'---------------------------------------------------
Function GetMdbStaticRecordset( FileName, Source )
   Set GetMdbStaticRecordset = GetMdbRs( FileName, Source, 3, "" )
End Function

'---------------------------------------------------
Function GetSecuredMdbRecordset( FileName, Source, Password )
   Set GetSecuredMdbRecordset = GetMdbRs( FileName, Source, 2, Password )
End Function

'---------------------------------------------------
Function GetSecuredMdbStaticRecordset( FileName, Source, Password )
   Set GetSecuredMdbStaticRecordset = GetMdbRs( FileName, Source, 3, Password )
End Function

'---------------------------------------------------
Function GetDbfRecordset( Directory, SQL )
   Set GetDbfRecordset = GetOtherRs( "Dbf", Directory, SQL, 2 )
End Function

'---------------------------------------------------
Function GetDbfStaticRecordset( Directory, SQL )
   Set GetDbfStaticRecordset = GetOtherRs( "Dbf", Directory, SQL, 3 )
End Function

'---------------------------------------------------
Function GetDbcRecordset( FileName, SQL )
   Set GetDbcRecordset = GetOtherRs( "Dbc", FileName, SQL, 2 )
End Function

'---------------------------------------------------
Function GetDbcStaticRecordset( FileName, SQL )
   Set GetDbcStaticRecordset = GetOtherRs( "Dbc", FileName, SQL, 3 )
End Function

'---------------------------------------------------
Function GetExcelRecordset( FileName, SQL )
   Set GetExcelRecordset = GetOtherRs( "Excel", FileName, SQL, 2 )
End Function

'---------------------------------------------------
Function GetExcelStaticRecordset( FileName, SQL )
   Set GetExcelStaticRecordset = GetOtherRs( "Excel", FileName, SQL, 3 )
End Function

'---------------------------------------------------
Function GetTextRecordset( Directory, SQL )
   Set GetTextRecordset = GetOtherRs( "Text", Directory, SQL, 2 )
End Function

'---------------------------------------------------
Function GetTextStaticRecordset( Directory, SQL )
   Set GetTextStaticRecordset = GetOtherRs( "Text", Directory, SQL, 3 )
End Function

'---------------------------------------------------
Function GetSQLServerRecordset( conn, source )
   Dim rs

   Set rs = Server.CreateObject("ADODB.Recordset")
   rs.Open source, conn, 2, 2
   Set GetSQLServerRecordset = rs
End Function

'---------------------------------------------------
Function GetSQLServerStaticRecordset( conn, source )
   Dim rs

   Set rs = Server.CreateObject("ADODB.Recordset")
   rs.Open source, conn, 3, 2
   Set GetSQLServerStaticRecordset = rs
End Function

'---------------------------------------------------
Function GetConnection( Param )
   Dim conn 

   On Error Resume Next
   Set GetConnection = Nothing
   Set conn = Server.CreateObject("ADODB.Connection")
   If Err.Number <> 0 Then Exit Function

   conn.Open Param
   If Err.Number <> 0 Then Exit Function
   Set GetConnection = conn
End Function

'---------------------------------------------------
Function GetMdbRs( FileName, Source, Cursor, Password )
   Dim conn, rs

   On Error Resume Next
   Set GetMdbRs = Nothing
   If Len(Password) = 0 Then
       Set conn = GetMdbConnection( FileName )
   Else
       Set conn = GetSecuredMdbConnection( FileName, Password )
   End If
   If conn Is Nothing Then Exit Function

   Set rs = Server.CreateObject("ADODB.Recordset")
   If Err.Number <> 0 Then Exit Function

   rs.Open source, conn, Cursor, 2
   If Err.Number <> 0 Then Exit Function
   Set GetMdbRs = rs
End Function

'---------------------------------------------------
Function GetOtherRs( DataType, Path, SQL, Cursor )
   Dim conn, rs
   On Error Resume Next
   Set GetOtherRs = Nothing

   Select Case DataType
      Case "Dbf"
         Set conn = GetDbfConnection( Path )
      Case "Dbc"
         Set conn = GetDbcConnection( Path )
      Case "Excel"
         Set conn = GetExcelConnection( Path )
      Case "Text"
         Set conn = GetTextConnection( Path )
   End Select
   If conn Is Nothing Then Exit Function

   Set rs = Server.CreateObject("ADODB.Recordset")
   If Err.Number <> 0 Then Exit Function

   rs.Open SQL, conn, Cursor, 2
   If Err.Number <> 0 Then Exit Function
   Set GetOtherRs = rs
End Function

'---------------------------------------------------
Function GetSQLServerRs( Computer, UserID, Password, Db, source, Cursor )
   Dim conn, rs

   On Error Resume Next
   Set GetSQLServerRs = Nothing
   Set conn = GetSQLServerConnection( Computer, UserID, Password, Db )
   If conn Is Nothing Then Exit Function

   Set rs = Server.CreateObject("ADODB.Recordset")
   If Err.Number <> 0 Then Exit Function

   rs.Open source, conn, Cursor, 2
   If Err.Number <> 0 Then Exit Function
   Set GetSQLServerRs = rs
End Function
%>

Tags: Function

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 113

ASP中 SQL Server 資料庫的備份與恢復

ASP中 SQL Server 資料庫的備份與恢復 
  
 ASP中 SQL Server 資料庫的備份與恢復<HTML>
<HEAD>

查看更多...

Tags: 資料庫 備份 恢復

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 162

用asp解析圖片位址,並將其保存

用asp解析圖片位址,並將其保存

要實現這個功能需要經過三個步驟:
一,取得原頁中的圖片的地址。方法很多,可以用分割字串,也可以用正則匹配。實踐證明用正則匹配最為簡單。經過分析圖片的位址都保存在<img>標簽中。我們可以先取得所有這個標簽。過程如下:
Set objRegExp = New Regexp'設置配置對象

查看更多...

Tags: 解析圖片

分類:Tank ASP | 固定連結 | 評論: 0 | 引用: 0 | 查看次數: 52