⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 savefile.asp

📁 一个网络相册
💻 ASP
字号:
<!--#include file="../function1/DBOpen.asp"-->
<!--#include file="info.asp" -->
<!-- #include File="z_Exif.asp" -->
<%
function delit(fileType,path)
	'remove a file
        set fso=server.CreateObject("scripting.filesystemobject")    

        IF UCase(fileType) = "SINGLE" THEN
		    if fso.FileExists(path) then 
        	fso.DeleteFile(path)
			end if 
        END IF
        IF UCase(fileType) = "MULTI" THEN
        	fso.DeleteFolder(path)

        END IF

    end function
%>
<%
rootPath = request.queryString("rootPath")
'if not set the rootPath parameter then set it to current path
if rootPath = "" then rootPath = "."
path = server.mapPath(rootPath)
dim classid,title
classid=Request.form("classid")
title=trim(Request.Form("name"))
if Request.QueryString("cz")="" then
Response.Redirect"info.asp?info=错误的参数"
else
cz=Request.QueryString("cz")
end if

if cz="del" then
id=Request.QueryString("id")
sql = "SELECT * FROM photo where id="&id
Set rs = Server.CreateObject("ADODB.Recordset")
rs.OPEN sql,Conn,1,1
pic=rs("big")
small=rs("small")
classid=rs("classid")
rs.close
Set rs=Nothing
filepath=path+ "\" +pic
filepath1=path+ "\" +small
fileType="SINGLE"

conn.execute "delete from photo where id="&Request.QueryString("id")
Call delit(fileType,filePath)
Call delit(fileType,filePath1)
Response.Redirect"adminfile.asp?classid="&classid
else

REM ------判断数据有效性------

founderr=false
if trim(Request.Form("name"))="" then
title="未命名"
end if
if trim(Request.form("classid"))="" then
founderr=true
info=info+"<li>请选择一级分类</li>"
end if
if trim(Request.Form("pic"))="" then
founderr=true
info=info+"<li>请填写放大图或者Flash文件地址</li>"
end if

REM ------如果数据是有效的则开始存储数据并显示相关信息------

if founderr=false then 
set rs=server.createobject("adodb.recordset")
if Request.form("cover")="1" then
sql="update photo set cover='0' where classid="&classid
conn.execute sql
end if

Dim F_Exif,fileExt
F_Exif=""
fileExt=lcase(right(Request.Form("pic"),3))
if fileExt="jpg" then
F_Exif=GetImageExifInfo(Request.Form("pic"))
end if 
'===================== 更新所有相片
Dim F_Exif1,fileExt1,rs4
F_Exif1=""
set rs4=server.createobject("adodb.recordset")
sql="select * from photo"
rs4.open sql,conn,1,3
if not rs4.bof and not rs4.eof  then
for i=1 to rs4.RecordCount
if trim(rs4("exif"))="" or isnull(rs4("exif")) or isempty(rs4("exif")) then
fileExt1=lcase(right(rs4("big"),3))
if fileExt1="jpg" then
F_Exif1=GetImageExifInfo(rs4("big"))
end if 
rs4("exif")=F_Exif1
end if
rs4.movenext
      if rs4.eof then
	      i = i + 1
	      exit for
      end if
      next
  end if
  rs4.close
  set rs4=nothing
'======================
if cz="addfile" then '增加图片
sql="select * from photo where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
rs("time")=now()
else
sql="select * from photo where id="&Request.QueryString("id") 
rs.open sql,conn,1,3
end if
rs("exif")=F_Exif
rs("title")=title
rs("big")=Request.Form("pic")
if trim(Request.Form("pic2"))<>"" then
rs("small")=Request.Form("pic2")
else
rs("small")=Request.Form("pic")
end if
rs("classid")=Request.form("classid")
rs("cover")=Request.form("cover")
if Request.Form("dx")<>"" then
rs("size")=Request.Form("dx")
if Request.Form("w")<>"" and Request.Form("h")<>"" then
rs("w")=Request.Form("w")
rs("h")=Request.Form("h")
end if
end if
if Request.Form("jj")<>"" then
rs("content")=HTMLEncode2(Request.Form("jj"))
end if
rs.update
rs.close
set rs=nothing
conn.close
Set conn=Nothing
if cz="addfile" then
Response.Redirect"adminfile.asp?classid="&classid
else
Response.Redirect"adminfile.asp?classid="&classid
end if

REM ------如果数据是无效的则开始显示错误信息------

else
call infom()
end if

end if

function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -