<!--#include file="conn.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="upfile_class.asp"-->
<!--#include file="bbsuser.asp"-->
<!-- #include file="aspjpg.asp" -->
<!--#include file="inc/publicfun.asp"-->
<%
userid=request.cookies("clubuser_id")
%>
<!--#include file="memberinfo.asp"-->
<%
photo_name=request("photo_name")
id=request("id")
call FTBBS_HTML_MB
url=Application("FTBBSMB")(10,0)
upfiletype=Application("FTBBSMB")(12,0)
upfilesize=Application("FTBBSMB")(13,0)
if request("act")="y" then
  dim upload,file,upfile,formPath,ServerPath,FSPath,formName,companyName,oFile,upfilecount,SaveFileName,SavePathFileName
  set upload=new Ftbbs_Class
  upload.AllowExt=upfiletype    '设置上传文件类型
  upload.GetData (upfilesize)   '取得上传文件大小
  id=upload.form("id")
  photo_name=upload.form("photo_name")
  photo_note=upload.form("photo_note")
  reurl=upload.form("reurl")
  pic=upload.form("pic")
  inFolder=split(pic,"/")(0)
  formPath=inFolder
  FilePath=inFolder&"/"
  if right(formPath,1)<>"/" then formPath=formPath&"/"
  if upload.isErr then
    select case upload.isErr
    case 1
        Response.Write "<font color=red>上传文件不能为空</font>"
    case 2
        Response.Write "系统限制上传文件大小在<font color=red>"&upfilesize&"</font>字节以下."
    end select
  else
    for each formName in upload.file '列出所有上传了的文件
	   set oFile=upload.file(formname)
	   filesize=oFile.FileSize '取得文件大小
	   vfname = makefilename(now())
	   Randomize
	   Random=Int((1000 - 100 + 1) * Rnd + 100)
	   vfname=vfname&"_"&Random
	   FileExt=oFile.FileExt '取文件扩展名 
	   fname = userid&"/"&vfname & "." & FileExt
	   todbpath=vfname & "." & FileExt
        '删除旧图片
       MypicFile = pic
       DelFile MypicFile,fso
       SavePathFileName = Server.MapPath(fname)
       upload.SaveToFile formName,SavePathFileName '保存文件
       if upload.iserr then 
         Response.Write upload.errmessage
       else
         if Application("FTBBSMB")(15,0)=1 and FileExt="jpg" then
			imgtmlogo fname
		 end if
         sql="update ftbbs_upload set upload_pic='"&inFolder&"/"&vfname&"."&FileExt&"',photo_name='"&photo_name&"',pic_note='"&photo_note&"' where id="&id
         conn.Execute(sql)
         response.redirect reurl
       end if
       set oFile = nothing
    next
  end if
end if
%>
<html><head><meta http-equiv=content-type content="text/html; charset=gb2312">
</head>
<body>
<center>
<title><%=username%>的相册管理中心</title>
<link rel="stylesheet" type="text/css" href="<%=cssfile%>">
<!--#include file="usernav.asp" -->
<div id="main" align="left">
<script language=javascript src="js/windowsize.js"></script>
	<div id="header">
	<div class="lc"><div class="rc"></div></div>
	<div class="tit"><a href="home.asp?userid=<%=userid%>" class="titlink" title="<%=username%>的空间"><%=username%></a></div>
	<div class="desc"><%=homepagetitle%></div>
	<div id="tabline">&nbsp;</div>
	<div id="tab"><a href="home.asp?userid=<%=userid%>" class="on">主页</a><a href="boker.asp?userid=<%=userid%>">博客</a><span>|</span><a href="myphoto.asp?userid=<%=userid%>">相册</a><span>|</span><a href="myinfo.asp?userid=<%=userid%>">个人档案</a>
	</div>
</div>
<div class="stage">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="layout">
<tr>
<td valign="top" class="c2t3">
<div id="mod_profile" class="mod" rel="drag">
<!--#include file="usercalog.asp" -->
</div>
</td>
          <td valign="top" class="c2t1"> 
            <div id="mod_bloglist" class="mod" rel="drag">
                <table width="77%" border="0" align="center" class="maintbbg" cellspacing="1" cellpadding="2">
              <form name="form1" method="post" action="?act=y" ENCTYPE="multipart/form-data">
				  <tr class="f12bg"> 
                    <td height="50" colspan="2" class=new14> <div align="center"><strong>修 改 相 片</strong></div></td>
                  </tr>
                <tr> 
                  <td width="100%" height="1" colspan="2" bgcolor="#336699" class=new14><spacer height="1" type="block"></td>
                </tr>
                <tr> 
                  <td width="100%" height="20" colspan="2"></td>
                </tr>
                  <tr class="f12bg"> 
                    <td height="30">
<div align="right">相册：</div></td>
                    <td height="25">
					<select name="photo_name" id="photo_name">
<%
sql="select * from ftblog_type where userid="&userid&" and blogphoto=1 order by indate desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
do while not rs.eof
%>
                        <option value="<%=rs("blogtype")%>" <%if rs("blogtype")=photo_name then%> selected <%end if%>><%=rs("blogtype")%></option>
                        <%
rs.movenext
loop
rs.close
%>
                      </select>
                      <a href="blog_group.asp?nav=a">创建相册</a></td>
                  </tr>
                  <tr> 
                    <td width="23%" height="11" class="maintbtr3" valign="middle"> 
                      <div align="right">相片：</div></td>
                    <td width="77%" height="30" class="maintbtr3">
                      <input NAME="photofile" TYPE="file" id="photofile">
                    </td>
                  </tr>
                  <tr> 
                    <td width="23%" height="11" class="maintbtr3" valign="middle"> 
                      <div align="right">说明：</div></td>
                    <td width="77%" height="30" class="maintbtr3"><input name="photo_note" type="text" id="photo_note" size="35" maxlength="30"> 
                    </td>
                  </tr>
                  <tr> 
                    <td height="50" colspan="2" class="maintbtr3"> <div align="center">
					    <input name="id" type="hidden" id="id" value="<%=id%>">
                        <input name="pic" type="hidden" id="pic" value="<%=request("pic")%>">
                        <input name="reurl" type="hidden" id="pic" value="<%=request.serverVariables("Http_REFERER")%>">
                        <input type="submit" name="Submit" value="修改相片" class=button>
                      </div></td>
                  </tr>
				  </form>
                </table>
			</div>

</td>
</tr></table>
</div>
</div>
<br><center>
<!--#include file="tail.asp" -->
</center>
</center>
</body>
</html>
<%closedb%>