<!--#include file="upload.inc"--> 
<!--#include file="../inc/Conn.asp"-->
<!--#include file="../inc/base64.asp"-->
<!--#include file="../inc/Function.asp"-->
<!--#include file="loginisok.asp"-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>保存信息 - <%=Dream_SiteTitle%></title>
<meta name="keywords" content="<%=Dream_SiteKeywords%>" />
<meta name="description" content="<%=Dream_SiteDescription%>" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
<meta name="format-detection" content="telephone=no" />
</head>
<body>
<%
Private Function CheckFileExt (fileEXT)
dim Forumupload
Forumupload="gif,jpg,bmp,jpeg,png"
Forumupload=split(Forumupload,",")
for j=0 to ubound(Forumupload)
if lcase(fileEXT)=lcase(trim(Forumupload(j))) then
CheckFileExt=true
exit Function
else
CheckFileExt=false
end if
next
End Function

action=request("action")
if action="addcard" then
dim upload,file,formName,formPath 
set upload=new upload_5xSoft ''建立上传对象 
formPath=upload.form("filepath") ''在目录后加(/) 
if right(formPath,1)<>"/" then formPath=formPath&"/"
i=1
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>1024000 then
response.Write file.FileSize
response.write "图片大小超过1024KB　[ <a href="""&action&".asp"">重新上传</a> ]"
response.end
end if

if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据 
'fileExt=lcase(right(file.Filename,3))
fileExt=Mid(file.Filename,InStrRev (file.Filename,".")+1)
fileExt=lcase(file.FileExt)
if CheckFileExt(fileEXT)=false then
response.write "文件格式不正确　[ <a href="""&action&".asp"">重新上传</a> ]"
response.end
end if
ranNum=int(900*rnd)+100
filenames=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
file.SaveAs Server.mappath("../UploadFiles/"&filenames) ''保存文件 
end if
if i=1 then
imgurl=filenames
else
imgurl2=filenames
end if
set file=nothing
i=i+1
next

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Dream_User where Dream_UserName='"&session("Dream_UserName")&"'"
rs.open sql,conn,1,3
if not rs.eof then
if imgurl<>"" then
rs("Dream_IdentityCard")="UploadFiles/"&imgurl
end if
if imgurl2<>"" then
rs("Dream_IdentityCard2")="UploadFiles/"&imgurl2
end if
rs("Dream_IdentityOK")="验证中"
end if
rs.update
rs.close
set rs=nothing
set upload=nothing
Response.Write("<script language=""JavaScript"">alert(""提示：身份证上传成功，等待管理员验证！"");this.location.href='addcard.asp';</script>")
response.end
end if
%>
</body>
</html>
