<!--#include virtual="inc/General.inc.asp"-->
<!--#include virtual="inc/uploadfile.inc"-->
<%
CheckManageUser()
dim objUpload
set objUpload = new Jeansecool_uploadClass
id = clng("0"&objUpload.form("idh"))
Code = replace(objUpload.form("Code")&"","'","''")
UserName = replace(objUpload.form("UserName")&"","'","''")
UserPass = objUpload.form("UserPass")&""
TypeOne = replace(objUpload.form("TypeOne")&"","'","''")
TypeTwo = replace(objUpload.form("TypeTwo")&"","'","''")
Info = replace(objUpload.form("Info")&"","'","''")
PicPath = ""
strPath = "/uppic/Info"
strFileName = year(now) & month(now) & day(now) & hour(now) & minute(now) & second(now)
set fso = server.createobject("scripting.filesystemobject")
if fso.FolderExists(server.mappath(strPath))=false then
	fso.CreateFolder server.mappath(strPath)
end if
set file = objUpload.file("PicPath")
if file.FileSize>10 then
	fileName = file.FileName
	fileType = mid(fileName,instrrev(fileName,".")+1,len(fileName))
	PicPath = strPath & "/" & strFileName & "." & fileType
	file.SaveAs server.mappath(PicPath)
	if id&""<>"" and id&""<>"0" then
		paths = GetSomeFieldByField("Info","id",id,"PicPath")
		if paths<>"" then
			if fso.FileExists(server.mappath(paths)) then
				fso.DeleteFile server.mappath(paths)
			end if
		end if
	end if
end if
set fso = nothing
set objUpload = nothing
if id&""="" or id&""="0" then
	if UserPass <> "" then UserPass = MD5(UserPass)
	conn.execute "insert into Info(Code,UserName,UserPass,PicPath,TypeOne,TypeTwo,Info,AddDateTime) values('" & Code & "','" & UserName & "','" & UserPass & "','" & PicPath & "','" & TypeOne & "','" & TypeTwo & "','" & Info & "','" & now & "')"
	CloseConnection()
	Response.Write "<script language='javascript'>alert('添加成功！');window.location.href='Info.asp';</script>"
else
	strsql = "update Info set Code='" & Code & "',UserName='" & UserName & "',TypeOne='" & TypeOne & "',TypeTwo='" & TypeTwo & "',Info='" & Info & "'"
	if UserPass <> "" AND LCase(UserPass) <> "jeansecool" then
		strsql = strsql & ",UserPass='" & MD5(UserPass) & "'"
	elseif UserPass = "" then
		strsql = strsql & ",UserPass=''"
	end if
	if PicPath&""<>"" then strsql = strsql & ",PicPath='" & PicPath & "'"
	strsql = strsql & " where id=" & id
	conn.execute strsql
	CloseConnection()
	Response.Write "<script language='javascript'>alert('修改成功！');window.location.href='Info.asp';</script>"
end if
%>