ASP を使用して Web サイトを開発している友人は、彼の ASP 機能から学習して、学習を促進し、開発効率を向上させることができます。 次のようにコードをコピーします。
<%
'----------------------------------
'Tianfeng ASP クラス v1.0、一般的な ASP 機能を 1 つに統合
天峰の著作権はすべて留保されています
'QQ:76994859 メール:[email protected]
'すべての関数名は次のとおりです。
' StrLength(str) は文字列の長さを取得します
' CutStr(str,strlen) 文字列の長さのカット
' CheckIsEmpty(tstr) は空かどうかをチェックします
' isInteger(para) 整数テスト
' CheckName(str) 名前の文字チェック
' CheckPassword(str) パスワードチェック
' CheckEmail(email) メール形式チェック
'Alert(msg,goUrl) はダイアログ ボックス プロンプトをポップアップ表示します
' GoBack(Str1,Str2,isback) エラー メッセージ
' Suc(str1,str2,url) 操作成功メッセージ プロンプト
' ChkPost() はフォームがサイト外に送信されたかどうかを検出します
' PSql() は SQL インジェクションを防止します
' FiltrateHtmlCode(Str) により HTML が生成されなくなります
' HtmlCode(str) フィルター HTML
'Replacehtml(tstr) きれいな HTML
'GetIP() クライアントIPを取得します
'GetBrowser クライアントのブラウザ情報を取得します
' GetSystem はクライアント オペレーティング システムを取得します
'GetUrl() パラメータを含む現在のページの URL を取得します
'CUrl() 現在のページの URL を取得します
' GetExtend はファイル拡張子を取得します
' CheckExist(table,fieldname,fieldcontent,isblur) は、テーブル内のフィールドのコンテンツが存在するかどうかを確認します
' GetNum(table,fieldname,resulttype,args) は、テーブル内にあるフィールドの数、最大値、最小値などを検出します。
' GetFolderSize(Folderpath) はフォルダーのサイズを計算します
' GetFileSize(Filename) はファイルのサイズを計算します
' IsObjInstalled(strClassString) はコンポーネントがインストールされているかどうかを検出します
'SendMail JMAILSメールを送信
'ResponseCookies は Cookie を書き込みます
' CleanCookies クッキーをクリアします
' GetTimeover はプログラム ページの実行時間を取得します
'FormatSize サイズの書式設定
'FormatTime 時間の書式設定
' ゾディアックは星座を取得します
' Constellation は星座を取得します
'----------------------------------
クラスCls_fun
'--------文字処理-------------------------
'************************************************ * **
'関数名: StrLength
'機能:文字列の長さを取得(漢字は2文字)
'パラメータ: str ---- 文字列の内容
'戻り値: 文字列長
'************************************************ * **
パブリック関数 StrLength(str)
ディムレップ、レンズ、i
rep=新しい正規表現を設定します
rep.Global=true
rep.IgnoreCase=true
rep.Pattern=[/u4E00-/u9FA5/uF900-/uFA2D]
rep.Execute(str) の各 i について
レンズ=レンズ+1
次
Rep=Nothing を設定
レンズ=レンズ + レンズ(str)
strLength=レンズ
終了機能
'************************************************ * **
'関数名:CutStr
'機能: 文字列の長さをカットし、長さを超える場合は省略記号を表示します
'パラメータ: str ---- 文字列の内容
' strlen ------表示する長さ
'戻り値:切り取った後の文字列内容
'************************************************ * **
パブリック関数 CutStr(str,strlen)
薄暗い l、t、i、c
str= の場合
カットストラ=
終了関数
終了の場合
str=Replace(Replace(Replace(Replace(str, , ),,Chr(34)),>,>),<,<),|,|)
l=長さ(文字列)
t=0
i=1 から l まで
c=Abs(Asc(Mid(str,i,1)))
c>255 の場合
t=t+2
それ以外
t=t+1
終了の場合
t>=strlen の場合
Cutstr=Left(str,i) & ...
出口
それ以外
カットストラ=str
終了の場合
次
Cutstr=Replace(Replace(Replace(Replace(cutstr, , ),Chr(34),),>,>),<,<),|,|)
終了機能
'--------------シリーズ検証--------------------------
'************************************************ * **
'関数名: CheckIsEmpty
'機能: 空かどうかを確認します
'パラメータ: tstr ---- 文字列
'戻り値: true は空ではありません、false は空です
'************************************************ * **
パブリック関数 CheckIsEmpty(tstr)
CheckIsEmpty=false
IsNull(tstr) または Tstr= の場合、関数を終了します
薄暗い強度
Str=Tstr
re=new RegExp を設定します
re.IgnoreCase =True
re.Global=True
str= 置換(str, vbNewLine, )
str = 置換(str, Chr(9), )
str = 置換(str, , )
str = 置換(str, , )
re.Pattern=<img(.[^>]*)>
str =re.Replace(Str,94kk)
re.Pattern=<(.[^>]*)>
Str=re.Replace(Str,)
Re=Nothing を設定する
Str<> の場合、CheckIsEmpty=true
終了機能
'************************************************ * **
'関数名: isInteger
'関数: 整数テスト
'パラメータ: tstr ---- 文字
'戻り値: true は整数、false は整数ではありません
'************************************************ * **
パブリック関数 isInteger(para)
エラー時は再開します 次へ
ディムストラ
薄暗い、私
isNUll(para) の場合、
isInteger=false
終了関数
次の場合に終了
str=cstr(パラ)
トリム(str)=の場合、
isInteger=false
終了関数
次の場合に終了
l=レン(文字列)
i=1~lの場合
Mid(str,i,1)>9 または Mid(str,i,1)<0 の場合
isInteger=false
終了関数
次の場合に終了
次
isInteger=true
err.number<>0 の場合、err.clear
終了機能
'************************************************ * **
'関数名: CheckName
'機能: 名前の文字チェック
'パラメータ: str ---- 文字列
'戻り値: true は正しい、false は正しくありません
'************************************************ * **
パブリック関数 CheckName(Str)
チェック名=true
ディムレップ、パス
Rep=新しい正規表現を設定します
Rep.Global=True
Rep.IgnoreCase=True
'文字、数字、アンダースコア、漢字と一致し、文字、アンダースコア、または漢字で始まる必要があります
代表パターン=^[a-zA-Z_u4e00-/u9fa5][/w/u4e00-/u9fa5]+$
pass=Rep.Execute(Str) を設定します。
pass.count=0 の場合、CheckName=false
Rep=Nothing を設定
終了機能
'************************************************ * **
'関数名:CheckPassword
'機能: パスワード認証
'パラメータ: str ---- 文字列
'戻り値: true は正しい、false は正しくありません
'************************************************ * **
パブリック関数 CheckPassword(Str)
ディムパス
チェックパスワード=true
If Str <> then
ディムレップ
Rep = 新しい正規表現を設定します
Rep.Global = True
Rep.IgnoreCase = True
'文字、数字、アンダースコア、ピリオドと一致する
Rep.Pattern=[a-zA-Z0-9_/.]+$
Pass=rep.Test(Str)
Rep=nothing を設定します
合格しない場合は、CheckPassword=false
終了の場合
終了機能
'************************************************ * **
'関数名: CheckEmail
'機能: 電子メール形式の検出
'パラメータ: str ----メールアドレス
'戻り値: true は正しい、false は正しくありません
'************************************************ * **
パブリック関数 CheckEmail(電子メール)
CheckEmail=true
ディムレップ
Rep = 新しい正規表現を設定します
rep.pattern=([/.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(/.([a-zA-] Z0-9]){2,}){1,4}$
pass=rep.Test(メール)
Rep=Nothing を設定
合格しない場合は CheckEmail=false
終了機能
'--------------情報プロンプト---------------------------
'************************************************ * **
'関数名:アラート
'機能: ダイアログボックスプロンプトをポップアップ表示します
'パラメータ: msg ---- ダイアログ ボックスの情報
' gourl ---- プロンプトの後にどこに進むか
'戻り値: なし
'************************************************ * **
パブリック関数アラート(msg,goUrl)
msg = replace(msg,',/')
goUrl= の場合
goUrl=history.go(-1);
それ以外
goUrl=window.location.href='&goUrl&'
終了IF
Response.Write (<script language=JavaScript type=text/javascript>&vbNewLine&alert(' & msg & ');&goUrl&vbNewLine&</script>)
応答.終了
終了機能
'************************************************ * **
'関数名: GoBack
'機能: エラーメッセージプロンプト
'パラメータ: str1 ---- 情報プロンプトのタイトル
' str2 ---- 情報プロンプトの内容
'isback----returnを表示するかどうか
'戻り値: なし
'************************************************ * **
パブリック関数 GoBack(Str1,Str2,isback)
If Str1= then Str1=エラーメッセージ
Str2= の場合、Str2= 必須フィールドをすべて入力してください
if isback = then
Str2=Str2& <a href=javascript:history.go(-1)>リフィルに戻る</a></li>
それ以外
Str2=Str2
終了する場合
Response.Write<div style=margin-left:5px;border:1px Solid #0066cc;width:98%><div style=height:22px;font-weight:bold;color:白;フォントサイズ:14px;背景:#799AE1;背景:url(images/th.gif);;テキスト整列:左;行高さ:20px;パディング:3px;>&Str1& </div><div style=line-height:50px;background:#F7F7F7;vertical-align:middle;font-size:14px;width:100%><div style=color:red;font:50px/50px 宋体;float:left;width :5%>×</div><div style=margin-top:8px;float:right;width:90%;text-align:left;padding-left:3px;>&str2&</div></div></div>
応答.終了
終了機能
'************************************************ * **
'関数名: Suc
'機能: 成功プロンプトメッセージ
'パラメータ: str1 ---- 情報プロンプトのタイトル
' str2 ---- 情報プロンプトの内容
' URL ---- 戻りアドレス
'戻り値: なし
'************************************************ * **
パブリック関数 Suc(str1,str2,url)
If str1= then Str1=操作は成功しました
If str2= then Str2=この操作は正常に完了しました。
url= の場合、url=javascript:history.go(-1)
str2=str2& <a href=&url& >管理を続行するには戻ってください</a>
Response.Write<div style=margin-left:5px;border:1px Solid #0066cc;width:98%><div style=height:22px;font-weight:bold;color:白;フォントサイズ:14px;背景:#799AE1;背景:url(images/th.gif);;テキスト整列:左;行高さ:20px;パディング:3px;>&Str1& </div><div style=line-height:50px;background:#F7F7F7;vertical-align:middle;font-size:14px;width:100%><div style=color:red;font:50px/50px 宋体;float:left;width :5%>√</div><div style=margin-top:8px;float:right;width:90%;text-align:left;padding-left:3px;>&str2&</div></div></div>
終了機能
'--------------安全な取り扱い--------------------------
'************************************************ * **
'関数名: ChkPost
'機能: サイト外へのフォーム送信を禁止
'戻り値: オンサイト送信の場合は true、オフサイト送信の場合は false
'************************************************ * **
パブリック関数 ChkPost()
ディム URL1、URL2
チェックポスト=true
url1=Cstr(リクエスト.サーバー変数(HTTP_REFERER))
url2=Cstr(リクエスト.サーバー変数(サーバー名))
If Mid(url1,8,Len(url2))<>url2 then
チェックポスト=偽
終了関数
終了の場合
終了機能
'************************************************ * **
'関数名:PSql
'機能: SQL インジェクションの防止
'戻り値: 空の場合は注入されません。空でない場合は注入され、注入された文字が返されます。
'************************************************ * **
パブリック関数 PSql()
Psql=
badwords= 'アンチ' アンチ; アンチとアンチ exec アンチ挿入 アンチ選択 アンチ更新 アンチ削除 アンチカウント アンチ * アンチ % アンチ chr アンチ Mid アンチマスター アンチ truncate アンチ char アンチ 宣言アンチ |
badword=split(悪い言葉,防御)
If Request.Form<> then
Request.Form の各 TF_Post について
i=0 から Ubound(badword) へ
If Instr(LCase(Request.Form(TF_Post)),badword(i))>0 then
Psql=悪い単語(i)
終了関数
終了の場合
次
次
終了の場合
If Request.QueryString<> then
各 TF_Get In Request.QueryString
i=0 から Ubound(badword) へ
If Instr(LCase(Request.QueryString(TF_Get)),badword(i))>0 then
Psql=悪い単語(i)
終了関数
終了の場合
次
次
終了の場合
終了機能
'************************************************ * **
'関数名: FiltrateHtmlCode
'機能: HTML コードが生成されないようにする
'パラメータ: str ---- 文字列
'************************************************ * **
パブリック関数 FiltrateHtmlCode(Str)
Not isnull(str) かつ str<> の場合
Str=置換(Str,Chr(9),)
Str=replace(Str,|,|)
Str=replace(Str,chr(39),')
Str=replace(Str,<,<)
Str=replace(Str,>,>)
Str = 置換(str, CHR(13),)
Str = 置換(str, CHR(10),)
FiltrateHtmlCode=Str
終了の場合
終了機能
'************************************************ * **
'関数名: HtmlCode
'機能: HTML タグをフィルタリングします
'パラメータ: str ---- 文字列
'************************************************ * **
パブリック関数 HtmlCode(str)
Not isnull(str) かつ str<> の場合
str = replace(str, >, >)
str = replace(str, <, <)
str = 置換(str, CHR(32), )
str = 置換(str, CHR(9), )
str = 置換(str, CHR(34), )
str = 置換(str, CHR(39), ')
str = 置換(str, CHR(13), )
str = 置換(str, CHR(10), )
str = 置換(str, スクリプト, スクリプト)
HTMLコード = 文字列
終了の場合
終了機能
'************************************************ * **
'関数名: Replacehtml
'機能: きれいなHTML
'パラメータ: tstr ---- 文字列
'************************************************ * **
パブリック関数 Replacehtml(tstr)
薄暗い強度
Str=Tstr
re=new RegExp を設定します
re.IgnoreCase =True
re.Global=True
re.Pattern=<(p|//p|br)>
Str=re.Replace(Str,vbNewLine)
re.Pattern=<img.[^>]*src(=| )(.[^>]*)>
str=re.replace(str,[img]$2[/img])
re.Pattern=<(.[^>]*)>
Str=re.Replace(Str,)
Re=Nothing を設定する
Replacehtml=Str
終了機能
'----------クライアントとサーバーに関する情報を取得します----------
'************************************************ * **
'関数名: GetIP
'機能: クライアントの IP アドレスを取得します
'戻り値: クライアントIPアドレス
'************************************************ * **
パブリック関数 GetIP()
薄暗い温度
Temp = Request.ServerVariables(HTTP_X_FORWARDED_FOR)
Temp = または isnull(Temp) または isEmpty(Temp) の場合 Temp = Request.ServerVariables(REMOTE_ADDR)
Instr(Temp,')>0 の場合、Temp=0.0.0.0
GetIP=温度
終了機能
'************************************************ * **
'関数名: GetBrowser
'機能: クライアントのブラウザ情報を取得します
'戻り値: クライアントブラウザ情報
'************************************************ * **
パブリック関数 GetBrowser()
info=Request.ServerVariables(HTTP_USER_AGENT)
if Instr(info,NetCaptor 6.5.0)>0 then
ブラウザ=NetCaptor 6.5.0
elseif Instr(info,MyIe 3.1)>0 then
ブラウザ=MyIe 3.1
elseif Instr(info,NetCaptor 6.5.0RC1)>0 then
ブラウザ=NetCaptor 6.5.0RC1
elseif Instr(info,NetCaptor 6.5.PB1)>0 then
ブラウザ=NetCaptor 6.5.PB1
elseif Instr(info,MSIE 5.5)>0 then
ブラウザ=Internet Explorer 5.5
elseif Instr(info,MSIE 6.0)>0 then
ブラウザ=Internet Explorer 6.0
elseif Instr(info,MSIE 6.0b)>0 then
ブラウザ=Internet Explorer 6.0b
elseif Instr(info,MSIE 5.01)>0 then
ブラウザ=Internet Explorer 5.01
elseif Instr(info,MSIE 5.0)>0 then
ブラウザ=Internet Explorer 5.00
elseif Instr(info,MSIE 4.0)>0 then
ブラウザ=Internet Explorer 4.01
それ以外
ブラウザ=その他
終了する場合
終了機能
'************************************************ * **
'関数名: GetSystem
'機能: クライアントのオペレーティング システムを取得します
'戻り値: クライアントのオペレーティング システム
'************************************************ * **
関数 GetSystem()
info=Request.ServerVariables(HTTP_USER_AGENT)
if Instr(info,NT 5.1)>0 then
システム=Windows XP
elseif Instr(info,Tel)>0 then
システム=テレポート
elseif Instr(info,webzip)>0 then
システム=webzip
elseif Instr(info,flashget)>0 then
システム=フラッシュゲット
elseif Instr(info,offline)>0 then
システム=オフライン
elseif Instr(info,NT 5)>0 then
システム=Windows 2000
elseif Instr(info,NT 4)>0 then
システム=Windows NT4
elseif Instr(info,98)>0 then
システム=Windows 98
elseif Instr(info,95)>0 then
システム=Windows 95
elseif instr(info,unix) または instr(info,linux) または instr(info,SunOS) または instr(info,BSD) then
system=Unix 風の
elseif instr(thesoft,Mac) then
システム=Mac
それ以外
システム=その他
終了する場合
終了機能
'************************************************ * **
'関数名: GetUrl
'機能: パラメータを含む URL を取得します
'戻り値:パラメータを含むURLを取得
'************************************************ * **
パブリック関数 GetUrl()
薄暗い温度
strTemp=Request.ServerVariables(スクリプト名)
If Trim(Request.QueryString)<> then
strTemp=strTemp&?
Request.QueryString の各 M_item について
strTemp=strTemp&M_item&=&Server.UrlEncode(Trim(Request.QueryString(&M_item&)))
次
終了する場合
GetUrl=strTemp
終了機能
'************************************************ * **
'関数名:CUrl
'関数: 現在のページの URL を取得する関数
'戻り値: 現在のページ URL の関数
'************************************************ * **
FunctionCUrl()
Domain_Name = LCase(Request.ServerVariables(Server_Name))
ページ名 = LCase(Request.ServerVariables(Script_Name))
Quary_Name = LCase(Request.ServerVariables(Quary_String))
If Quary_Name = then
CUrl = http://&ドメイン名&ページ名
それ以外
CUrl = http://&ドメイン名&ページ名&?&Quary_Name
終了の場合
終了機能
'************************************************ * **
'関数名: GetExtend
'機能: ファイル拡張子を取得します
'パラメータ: ファイル名 ---- ファイル名
'************************************************ * **
パブリック関数 GetExtend(ファイル名)
薄暗い温度
ファイル名<>の場合、
tmp=mid(ファイル名,instrrev(ファイル名,.)+1,len(ファイル名)-instrrev(ファイル名,.))
tmp=LCase(tmp)
instr(1,tmp,asp)>0 または instr(1,tmp,php)>0 または instr(1,tmp,php3)>0 または instr(1,tmp,aspx)>0 の場合
getextend=txt
それ以外
getextend=tmp
終了する場合
それ以外
getextend=
終了する場合
終了機能
'------------------データベース操作----------------------
'************************************************ * **
'関数名: CheckExist
'機能: 特定のテーブルの特定のフィールドに特定のコンテンツが存在するかどうかを検出します
'パラメータ: table ---- テーブル名
'フィールド名 ----フィールド名
'fieldcontent ----フィールドの内容
' isblur ---- ファジーマッチするかどうか
'戻り値: falseは存在しません、trueは存在します
'************************************************ * **
関数 CheckExist(テーブル,フィールド名,フィールド内容,isblur)
CheckExist=false
isblur=1 の場合
set rsCheckExist=conn.execute(select * from &table& where &fieldname& like '%&fieldcontent&%')
それ以外
set rsCheckExist=conn.execute(select * from &table& where &fieldname&= '&fieldcontent&')
次の場合に終了
そうでない場合 (rsCheckExist.eof および rsCheckExist.bof)、CheckExist=true
rsCheckExist.close
rsCheckExist=何も設定しない
終了機能
'************************************************ * **
'関数名: GetNum
'機能: テーブル内のフィールドの数、最大値または最小値を検出します。
'パラメータ: table ---- テーブル名
'フィールド名 ----フィールド名
'resulttype ----結果を返します (カウント/最大/最小)
' args ---- 追加参加 (... による順序)
'戻り値:数値
'************************************************ * **
関数 GetNum(テーブル,フィールド名,結果の種類,引数)
GetFieldContentNum=0
if フィールド名= then フィールド名=*
sqlGetFieldContentNum=&テーブル&引数から&結果タイプ&(&フィールド名&)を選択
set rsGetFieldContentNum=conn.execute(sqlGetFieldContentNum)
そうでない場合 (rsGetFieldContentNum.eof および rsGetFieldContentNum.bof)、GetFieldContentNum=rsGetFieldContentNum(0)
rsGetFieldContentNum.close
set rsGetFieldContentNum=nothing
終了機能
'************************************************ * **
'関数名: UpdateValue
'機能: テーブル内の特定のフィールドの値を更新します
'パラメータ: table ---- テーブル名
'フィールド名 ----フィールド名
'フィールド値----更新された値
'id ----id
' url -------更新後のリダイレクトされたアドレス
'戻り値: なし
'************************************************ * **
パブリック関数 UpdateValue(テーブル,フィールド名,フィールド値,ID,URL)
conn.Execute(update &table& set &fieldname&=&fieldvalue& where id=&CLng(trim(id)))
if url<> then 応答.リダイレクト URL
終了機能
'-------------サーバー情報と操作---------------------
'************************************************ * **
'関数名: GetFolderSize
'機能: フォルダーのサイズを計算します
'パラメータ: FileName ----フォルダー パスとフォルダー名
'戻り値:数値
'************************************************ * **
パブリック関数 GetFolderSize(フォルダーパス)
ディム fso,d,size,showsize
set fso=server.createobject(scripting.filesystemobject)
drvpath=server.mappath(フォルダパス)
fso.FolderExists(drvpath) の場合
set d=fso.getfolder(drvpath)
サイズ=d.サイズ
GetFolderSize=フォーマットサイズ(サイズ)
それ以外
GetFolderSize=フォルダーパス&フォルダーが存在しません
終了の場合
終了機能
'************************************************ * **
'関数名: GetFileSize
'機能: ファイルのサイズを計算します
'パラメータ: FileName ----ファイルパスとファイル名
'戻り値:数値
'************************************************ * **
パブリック関数 GetFileSize(ファイル名)
Dim fso、drvpath、d、size、showsize
set fso=server.createobject(scripting.filesystemobject)
ファイルパス=サーバー.マップパス(ファイル名)
fso.FileExists(ファイルパス) の場合
set d=fso.getfile(ファイルパス)
サイズ=d.サイズ
GetFileSize=フォーマットサイズ(サイズ)
それ以外
GetFileSize=ファイル名&ファイルが存在しません
終了の場合
fso=何も設定しない
終了機能
'************************************************ * **
'関数名: IsObjInstalled
'機能: コンポーネントがインストールされているかどうかを確認します
'パラメータ: strClassString ---- コンポーネント名
'戻り値: falseは存在しません、trueは存在します
'************************************************ * **
パブリック関数 IsObjInstalled(strClassString)
エラー時は次へ再開
IsObjInstalled=False
エラー=0
DimxTestObj
xTestObj=Server.CreateObject(strClassString) を設定します
0=Err の場合、IsObjInstalled=True
xTestObj=何も設定しない
エラー=0
終了機能
'************************************************ * **
'関数名: SendMail
'機能: Jmail コンポーネントを使用してメールを送信する
'パラメータ: ServerAddress ---- サーバーアドレス
'AddRecipient---受信者のアドレス
' 件名 ----件名
'本文---文字の内容
'送信者 ---- 送信者のアドレス
'************************************************ * **
パブリック関数 SendMail(MailServerAddress,AddRecipient,Subject,Body,Sender,MailFrom)
エラー時は次から再開
ディム・ジェイメール
JMail=Server.CreateObject(JMail.SMTPMail) を設定します。
エラーの場合は
SendMail= JMail コンポーネントがインストールされていません
エラークリア
終了関数
終了する場合
JMail.Logging=True
JMail.Charset=gb2312
JMail.ContentType = テキスト/html
JMail.ServerAddress=メールサーバーアドレス
JMail.AddRecipient=AddRecipient
JMail.Subject=件名
JMail.Body=メールボディ
JMail.Sender=送信者
JMail.From = MailFrom
JMail.Priority=1
JMail.Execute
JMail=nothing を設定します
エラーの場合は
SendMail=err.description
エラークリア
それ以外
SendMail=OK
終了する場合
終了関数
'************************************************ * **
'関数名: ResponseCookies
'機能: COOKIES を書き込む
'パラメータ: キー ---- クッキー名
' 値 ----Cookie 値
' 期限切れ ---- Cookie の有効期限
'************************************************ * **
パブリック関数 ResponseCookies(Key,Value,Expires)
DomainPath=Left(Request.ServerVariables(script_name),inStrRev(Request.ServerVariables(script_name),/))
Response.Cookies(キー)=&値&
if Expires<>0 then Response.Cookies(Key).Expires=date+Expires
Response.Cookies(Key).Path=ドメインパス
終了機能
'************************************************ * **
'関数名: CleanCookies
'機能: Cookie のクリア
'************************************************ * **
パブリック関数 CleanCookies()
DomainPath=Left(Request.ServerVariables(script_name),inStrRev(Request.ServerVariables(script_name),/))
Request.Cookies の各 objCookie について
Response.Cookies(objCookie)=
Response.Cookies(objCookie).Path=ドメインパス
次
終了機能
'************************************************ * **
'関数名: GetTimeOver
'機能: Cookie のクリア
'パラメータ: flag ---表示時間単位 1=秒、それ以外の場合はミリ秒
'************************************************ * **
パブリック関数 GetTimeOver(フラグ)
ディムエンドタイム
フラグ = 1 の場合
EndTime=FormatNumber(Timer() - StartTime, 6, true)
getTimeOver = このページの実行時間: & EndTime & 秒
それ以外
EndTime=FormatNumber((Timer() - StartTime) * 1000, 3, true)
getTimeOver = このページの実行時間: & EndTime & ミリ秒
終了の場合
終了機能
'----------------シリーズの書式設定-----------------------
'************************************************ * **
'関数名:FormatSize
'機能: サイズの書式設定
'パラメータ: size ----フォーマットされるサイズ
'************************************************ * **
パブリック関数 FormatSize(dsize)
dsize>=1073741824 の場合
FormatSize=フォーマット番号(dsize/1073741824,2) & GB
elseif dsize>=1048576 then
FormatSize=フォーマット番号(dsize/1048576,2) & MB
elseif dsize>=1024 then
FormatSize=フォーマット番号(dsize/1024,2) & KB
それ以外
FormatSize=dsize & バイト
終了する場合
終了機能
'************************************************ * **
'関数名: FormatTime
'機能: 時刻の書式設定
'パラメータ: DateTime ---- フォーマットされる時刻
'フォーマット ----フォームのフォーマット
'************************************************ * **
パブリック関数 FormatTime(DateTime,Format)
ケースの形式を選択してください
ケース1
FormatTime=&year(DateTime)&year&month(DateTime)&month&day(DateTime)&day
ケース2
FormatTime=&month(DateTime)&month&day(DateTime)&日
ケース3
FormatTime=&year(DateTime)&/&month(DateTime)&/&day(DateTime)&
ケース4
FormatTime=&month(DateTime)&/&day(DateTime)&
ケース5
FormatTime=&month(DateTime)&month&day(DateTime)&日&FormatDateTime(DateTime,4)&
ケース6
temp=日曜日、月曜日、火曜日、水曜日、木曜日、金曜日、土曜日
temp=split(temp,,)
FormatTime=temp(平日(日付時刻)-1)
それ以外の場合
FormatTime=DateTime
エンドセレクト
終了機能
'--------------------その他--------------------
'************************************************ * **
'機能名:ゾディアック
'機能: 生と死を取得する
'パラメータ: 誕生日 ---- 誕生日
'************************************************ * **
公的機能 干支(誕生日)
IsDate(誕生日)の場合
誕生年=年(誕生日)
ZodiacList=array(申、鶏、戌、豚、ネズミ、牛、虎、兎、辰、蛇、馬、羊)
Zodiac=ZodiacList(誕生年 mod 12)
終了する場合
終了機能
'************************************************ * **
'関数名:コンステレーション
'関数: 星座を取得する
'パラメータ: 誕生日 ---- 誕生日
'************************************************ * **
public Function 星座(誕生日)
IsDate(誕生日)の場合
星座月=月(誕生日)
ConstellationDay=日(誕生日)
if Len(ConstellationMon)<2 then ConstellationMon=0&ConstellationMon
if Len(ConstellationDay)<2 then ConstellationDay=0&ConstellationDay
MyConstellation=ConstellationMon&ConstellationDay
MyConstellation < 0120 の場合
constellation=<img src=images/Constellation/g.gif />elseif MyConstellation < 0219 then
constellation=<img src=images/Constellation/h.gif />elseif MyConstellation < 0321 then
constellation=<img src=images/Constellation/i.gif />elseif MyConstellation < 0420 then
constellation=<img src=images/Constellation/^.gif />elseif MyConstellation < 0521 then
constellation=<img src=images/Constellation/_.gif />elseif MyConstellation < 0622 then
constellation=<img src=images/Constellation/`.gif />elseif MyConstellation < 0723 then
constellation=<img src=images/Constellation/a.gif />elseif MyConstellation < 0823 then
constellation=<img src=images/Constellation/b.gif />elseif MyConstellation < 0923 then
constellation=<img src=images/Constellation/c.gif />elseif MyConstellation < 1024 then
constellation=<img src=images/Constellation/d.gif />elseif MyConstellation < 1122 then
constellation=<img src=images/Constellation/e.gif />elseif MyConstellation < 1222 then
constellation=<img src=images/Constellation/f.gif />elseif MyConstellation > 1221 then
constellation=<img src=images/Constellation/g.gif />end if
終了する場合
終了機能
'================================================ =
'関数名:オートページ
'機能: 長い記事の自動ページネーション
'パラメータ: id、コンテンツ、urlact
'================================================ =
関数 AutoPage(コンテンツ、パラメータ、ページ変数)
contentStr=split(content,pagevar)
pagesize=ubound(contentStr)
ページサイズ > 0 の場合
Int(Request(page))= または Int(Request(page))=0 の場合
ページ番号=1
それ以外
pageNum=リクエスト(ページ)
次の場合に終了
if pageNum-1<=pagesize then
AutoPage=AutoPage&contentStr(pageNum-1)
AutoPage=AutoPage&<div style=margin-top:10px;text-align:right;padding-right:15px;><font color=blue>ページ番号:</font><font color=red>
i=0 の場合はページサイズまで
i=pageNum-1 の場合
AutoPage=AutoPage&[<font color=red>&i+1&</font>]
それ以外
if instr(paramater,?)>0 then
AutoPage=AutoPage&<a href=¶mater&&page=&i+1&>[&(i+1)&]</a>
それ以外
AutoPage=AutoPage&<a href=¶mater&?page=&i+1&>[&(i+1)&]</a>
終了する場合
終了する場合
次
AutoPage=オートページ&</font></div>
それ以外
AutoPage=AutoPage&不正な操作です!ページ数を超えました! <a href=javascript:history.back(-1)><u>戻る</u></a>
終了する場合
それ以外
AutoPage=コンテンツ
終了する場合
終了機能
終了クラス
%>