<%@ CODEPAGE=65001 %>
<%
Response.CodePage=65001
Response.Charset="UTF-8"
'--------------------------------------------

SiteDir = "../"
DBDir = SiteDir&"data/eimsCMS.mdb"   'Date Path

'================================================
'以下代码请不要自行修改
'================================================

Ver=5.6 'Version
LogRec=200 'User Login Record
OfficialUrl="http://www.eims.org.cn"
Prefix="eims_"

Dim Conn,ConnStr
On error resume next
Set Conn=Server.CreateObject("Adodb.Connection")
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(DBDir)
'--------------------------------------------
Conn.open ConnStr
if err then
   err.clear
   Set Conn = Nothing
   Response.Write "系统错误：数据库连接出错，请检查连接字符串!"
   Response.End
end if
Sub CloseConn()
    On Error Resume Next
	Rs.Close:Set Rs=nothing
	Conn.close:Set Conn=nothing
End sub
'================================================
'函名：CheckSql
'作用：防止SQl注入
'================================================
Function CheckSql(Str)
 If Str = "" Then 
  CheckSql = "" 
  Exit Function  
 End If 
 Str = Replace(Str,Chr(0),"", 1, -1, 1) 
 Str = Replace(Str, """", "&quot;", 1, -1, 1) 
 Str = Replace(Str,"<","&lt;", 1, -1, 1) 
 Str = Replace(Str,">","&gt;", 1, -1, 1)  
 Str = Replace(Str, "script", "&#115;cript", 1, -1, 0) 
 Str = Replace(Str, "SCRIPT", "&#083;CRIPT", 1, -1, 0) 
 Str = Replace(Str, "Script", "&#083;cript", 1, -1, 0) 
 Str = Replace(Str, "script", "&#083;cript", 1, -1, 1) 
 Str = Replace(Str, "object", "&#111;bject", 1, -1, 0) 
 Str = Replace(Str, "OBJECT", "&#079;BJECT", 1, -1, 0) 
 Str = Replace(Str, "Object", "&#079;bject", 1, -1, 0) 
 Str = Replace(Str, "object", "&#079;bject", 1, -1, 1) 
 Str = Replace(Str, "applet", "&#097;pplet", 1, -1, 0) 
 Str = Replace(Str, "APPLET", "&#065;PPLET", 1, -1, 0)
 Str = Replace(Str, "Applet", "&#065;pplet", 1, -1, 0) 
 Str = Replace(Str, "applet", "&#065;pplet", 1, -1, 1) 
 Str = Replace(Str, "[", "&#091;") 
 Str = Replace(Str, "]", "&#093;") 
 Str = Replace(Str, """", "", 1, -1, 1) 
 Str = Replace(Str, "=", "&#061;", 1, -1, 1) 
 Str = Replace(Str, "select", "sel&#101;ct", 1, -1, 1) 
 Str = Replace(Str, "execute", "&#101xecute", 1, -1, 1) 
 Str = Replace(Str, "exec", "&#101xec", 1, -1, 1) 
 Str = Replace(Str, "join", "jo&#105;n", 1, -1, 1) 
 Str = Replace(Str, "union", "un&#105;on", 1, -1, 1) 
 Str = Replace(Str, "where", "wh&#101;re", 1, -1, 1) 
 Str = Replace(Str, "insert", "ins&#101;rt", 1, -1, 1) 
 Str = Replace(Str, "delete", "del&#101;te", 1, -1, 1) 
 Str = Replace(Str, "update", "up&#100;ate", 1, -1, 1) 
 Str = Replace(Str, "like", "lik&#101;", 1, -1, 1) 
 Str = Replace(Str, "drop", "dro&#112;", 1, -1, 1) 
 Str = Replace(Str, "create", "cr&#101;ate", 1, -1, 1) 
 Str = Replace(Str, "rename", "ren&#097;me", 1, -1, 1) 
 Str = Replace(Str, "count", "co&#117;nt", 1, -1, 1) 
 Str = Replace(Str, "chr", "c&#104;r", 1, -1, 1) 
 Str = Replace(Str, "mid", "m&#105;d", 1, -1, 1) 
 Str = Replace(Str, "truncate", "trunc&#097;te", 1, -1, 1) 
 Str = Replace(Str, "nchar", "nch&#097;r", 1, -1, 1) 
 Str = Replace(Str, "char", "ch&#097;r", 1, -1, 1) 
 Str = Replace(Str, "alter", "alt&#101;r", 1, -1, 1) 
 Str = Replace(Str, "cast", "ca&#115;t", 1, -1, 1) 
 CheckSql = Replace(Str, "exists", "e&#120;ists", 1, -1, 1)
End Function

'================================================
'޸网站基本信息输出
'================================================
Set sRs = Server.Createobject("Adodb.Recordset")
sRs.Open "Select * From [eims_System] Where ItemID=1",Conn,1,1
siteName=Trim(sRs("siteName"))
siteLogo=Trim(sRs("siteLogo"))
siteTitle=Trim(sRs("siteTitle"))
siteKeyWord=Trim(sRs("siteKeyWord"))
siteInfo=Trim(sRs("siteInfo"))
siteCopyRight=Trim(sRs("siteCopyRight"))
picMax=int(sRs("picMax")) '图片上传限制
picType=Trim(sRs("picType")) '图片上传类型
fileMax=int(sRs("fileMax")) '文件上传限制
fileType=Trim(sRs("fileType")) '文件上传类型
Thumbnail=int(sRs("Thumbnail")) '是否压缩图片
FeedBack=int(sRs("FeedBack")) '留言是否审核
pmWidth=int(sRs("pmWidth")) '缩略图宽度
pmHeight=int(sRs("pmHeight")) '缩略图高度

Tel=Trim(sRs("Tel")) '留言是否启用
Add=Trim(sRs("Add")) '留言是否启用
DeCode=Trim(sRs("DeCode")) '留言是否启用

sRs.Close
Set sRs=Nothing
'================================================
'޸用户密码匹配/权限分配
'================================================
Set cRs=Conn.Execute("Select PassWord,eType,Permission From [eims_User] Where ItemID="&Int(Request.Cookies("UserID")))
PassWord="eims" : PassWord=Trim(cRs(0))
UserType=Cint(cRs(1)) : Permission=Trim(cRs(2))

nHost = "http://"&trim(request.ServerVariables("HTTP_HOST"))
%>
<!--#include file="function.asp" -->