<% '**************************************' ' 開發者: YuanFen (YuanFen@msn.com) ' 開發日: 2003/12/10 ' 修改日: NULL ' 版 本: 0.9 '**************************************' '以 alert 秀出 msg 並把網頁導向到 url Sub AlertRedirect(msg, url) Response.Write "" & vbCrLf &_ " " & vbCrLf &_ "" Response.End End Sub '檢查頁面是否使用 POST 傳送資料, 如不是則將頁面導向到 url Sub checkIsPost(url) If ""=url Then url = Path&"/index.asp" If "POST"<>Request.ServerVariables("REQUEST_METHOD") THEN msg = "Access Denied!" AlertRedirect msg, url End If End Sub '檢查是否登入, 如不是則將頁面導向到 url Sub checkLogin(url) If "true"<>Session("IsLogin") Then If ""=url Then url = Path&"/member/member_login.asp" Response.Redirect url Response.End End If End Sub '檢查Session是否存在, 如不存在則將頁面導向到 url Sub checkSession(sessionName, url) If IsNull(Session(sessionName)) Or Session(sessionName)="" Then If ""=url Then url = Path&"/index.asp" Response.Redirect url Response.End End If End Sub '回傳現在的日期,年月日用 sChr 分隔 Function ToDay(sChr,yType) yVal = Year(Date) Select Case (yType) Case "Full",4 yLen = 4 Case "Short",2 yLen = 2 Case "TwFull",-3 yLen = 3 yVal = CInt(yVal)-1911 Case "TwShort",-2 yLen = 2 yVal = CInt(yVal)-1911 Case Else yLen = 4 End Select 'If ""=sChr Then sChr="/" ToDay = Right(yVal,yLen)&sChr&LAddChr(Month(Date),"0",2)&sChr&LAddChr(Day(Date),"0",2) End Function ' Function MakeQueryString() MakeQueryString = Request.Form IF 0Request.Form.Count Then MakeQueryString = MakeQueryString & "&" End IF MakeQueryString = MakeQueryString & Request.QueryString End IF End Function '======================================================================== '附加上產品顏色 Function ProductColor(PNo) ProductColor = "" SQLSeg = "select cd.ColorName from ColorsDescribes cd,ProductsDetails pt where pt.ColorID=cd.ColorID and ProductNo="&AdjStr(PNo) Set rs = Conn.Execute(SQLSeg) If Not(rs.EOF And rs.BOF) Then If Not IsNull(rs(0)) Then IF ""<>rs(0) Then ProductColor = " ("&rs(0)&")" End IF End IF End IF Set rs = Nothing End Function Function PicturePath(PicPath) PicPath = Trim(CStr(PicPath)) IF "/"=Left(PicPath,1) And "/"=Right(Path,1) Then PicPath = Right(PicPath,Len(PicPath)-1) End IF PicturePath = PicPath End Function '======================================================================== ' Sub DisplayIllustrate(DisplayMode,PicPath,illustrate,PicWidth) DisplayMode = CInt(CStr(DisplayMode)) IF IsNULL(PicPath) Then PicPath="" PicPath = CStr(PicPath) illustrate = CStr(illustrate) IF ""<>PicWidth Then PicWidth = "width="""&PicWidth&"""" End IF Select Case DisplayMode Case 1 %>
><%IF ""<>PicPath Then%><%End IF%> <%=illustrate%>
<% Case 2 %>
<%=illustrate%> ><%IF ""<>PicPath Then%><%End IF%>
<% Case 3 %>
<%IF ""<>PicPath Then%><%End IF%>
<% Case 4 %>
<%=illustrate%>
<% Case 5 %>
<%IF ""<>PicPath Then%><%End IF%>
<%=illustrate%>
<% End Select End Sub %>