<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/char.jsp" -->
<!--#include file="../Include/const.jsp" -->
<!--#include file="IsLogin.jsp" -->
<%
dim rs,mSql
dim m_AlbumID
dim m_UserID
m_UserID = Request.Cookies("aspxnet")("CurUserID")
m_AlbumID = Request.QueryString("AlbumID")

if m_AlbumID = "" then
  mSql = "Select top 1 * From Photo_Album Where F_UserID="&m_UserID&" ORDER BY F_ID DESC"
else
  mSql = "Select top 1 * From Photo_Album Where F_UserID="&m_UserID&" and F_ID="&m_AlbumID
end if

Set rs = conn.Execute(mSql)
if rs.Eof then
  Response.redirect "Photo_AddNew.jsp"
  Response.End()
end if

mAlbumName = rs("F_AlbumName")
m_AlbumID = rs("F_ID")
'read image size
m_Sql = "Select sum(F_ImageSize) from Photo_AlbumList where F_AlbumID="&m_AlbumID
set rs = conn.Execute(m_Sql)
if not rs.Eof then 
  m_ImageSize = rs(0)
  if m_ImageSize <> "" then
    m_ImageSize = round((m_ImageSize / 1024 / 1024),3)
	if m_ImageSize<1 then m_ImageSize="0"+cstr(m_ImageSize)
	else
	m_ImageSize = 0
  end if
end if


if Request.Querystring("action") = "Delete" then
  m_Sql = "Delete From Photo_AlbumList Where F_ID=" & Request("DeleteID")
  conn.Execute(m_Sql)
  'DELTE FILENAME
    m_DeleteFileName = Server.Mappath("upfile/BigImages/"&m_UserID&"/"&Request("FileName"))
	set TestFileObject=Server.Createobject("Scripting.FileSystemObject")
    if TestFileObject.FileExists(m_DeleteFileName) then
      set NewFile=TestFileObject.getfile(m_DeleteFileName)
      Newfile.delete
    end if
    m_DeleteFileName = Server.Mappath("upfile/SmallImages/"&m_UserID&"/"&Request("FileName"))
	set TestFileObject=Server.Createobject("Scripting.FileSystemObject")
    if TestFileObject.FileExists(m_DeleteFileName) then
      set NewFile=TestFileObject.getfile(m_DeleteFileName)
      Newfile.delete
    end if

  Response.write "<script>location.replace('Photo_my.jsp?AlbumID="&Request("AlbumID")&"&pageno="&Request.Querystring("pageno")&"')</script>"
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>相册-我的相册</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
href="css/index_photo.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript>
function checkForm(){
  if (document.form1.username.value == ""){
    alert("对不起，用户名不能为空!请输入..");
	document.form1.username.focus();
	return false;
  }
  if (document.form1.password.value == ""){
    alert("对不起，密码不能为空!请输入..");
	document.form1.password.focus();
	return false;
  }

}
</SCRIPT>
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true) 
	self.location=url+'&action=Delete';
}
</SCRIPT>

<META content="MSHTML 6.00.2800.1555" name=GENERATOR></HEAD>
<BODY><%if Request.Cookies("aspxnet")("CurUserName") = "" then%>
<DIV id=leftlist>
<H3>网络相册</H3>
<FORM name=form1 action=ChkLogin.jsp?return=photo method=post onSubmit="return checkForm()">
<H4>登陆进入您的相册</H4><LABEL for=username><SPAN>用户名:</SPAN><INPUT size=9 
name=username></LABEL> <LABEL for=password><SPAN>密码:</SPAN><INPUT 
type=password size=8 name=password></LABEL> 
<P><BUTTON class=login type=submit><SPAN>登陆</SPAN></BUTTON><BUTTON class=reg 
type=reset><SPAN>注册</SPAN></BUTTON> </P></FORM></DIV>
<%else%>
<DIV id=leftlist>
<H3>网络相册</H3>
<FORM>
<H4><%m_TempUserName = Request.Cookies("aspxnet")("CurUserName")
				  if m_TempUserName = "" then Response.write "游客" else Response.write m_TempUserName
				  %>的相册</H4>
<P style="PADDING-RIGHT: 9px; LINE-HEIGHT: 180%; TEXT-ALIGN: right">[ <A 
href="Logout.jsp">退出</A> ]<BR><A 
href="Photo_Upload.jsp?AlbumID=<%=m_AlbumID%>">上传照片</A><BR><A 
href="photo_my.jsp">我的相册</A><BR><A 
href="Photo_AddNew.jsp">新增相册</A> </P></FORM>
<FORM>
<H4>相册统计</H4>
<P style="PADDING-RIGHT: 9px; LINE-HEIGHT: 180%">&nbsp;相册总空间 <SPAN 
class=STYLE1>5.00</SPAN> MB<BR>&nbsp;已用<SPAN class=STYLE1><%=m_ImageSize%></SPAN> 
MB</P>
<H4>相册列表</H4>
<%m_Sql = "Select * From Photo_Album Where F_UserID="&m_UserID&" order by F_ID desc"
								Set rst = conn.Execute(m_Sql)
								Do While Not rst.Eof%>
<P style="PADDING-RIGHT: 9px; LINE-HEIGHT: 180%">&nbsp;<A href="photo_my.jsp?AlbumID=<%=rst("F_ID")%>"><U><%=rst("F_AlbumName")%></U></A><BR></P><%rst.MoveNext
								loop
								rst.Close
								%></FORM></DIV>
<%end if%>

<DIV id=logo><A title=网络相册-首页 
href="photo_default.jsp"><SPAN>网络相册-首页</SPAN></A> </DIV>
	<DIV id=nav><A href="../">首页</A> | <A 
href="QQ_default.jsp">运城地带</A> | <A 
href="QQ_index.jsp">小圈子</A> | <A 
href="../blog/">运城博客</A> | <A 
href="photo_default.jsp">网络相册</A> | <A 
href="QQ_ployall.jsp">精彩活动</A> | <A 
href="friend_index.jsp">交友频道</A> | <A 
href="../bbs/" target=_blank>运城社区</A> </DIV>
<DIV id=main>
<DIV id=menu><IMG src="img/photo/photo_left.gif" name="limg" id=limg> 
<UL>
  <LI><A title=相册首页 href="photo_default.jsp"><IMG 
  src="img/photo/home.gif"></A> </LI>
  <LI><A title=我的相册 href="photo_my.jsp"><IMG 
  src="img/photo/my_album.gif"></A> </LI>
  <LI><A title=分类相册 href="photo_list.jsp"><IMG 
  src="img/photo/sort.gif"></A> </LI>
  <LI><A title=最新照片 href="photo_new.jsp"><IMG 
  src="img/photo/newPhoto.gif"></A> </LI>
  <LI><A title=相册排行 href="photo_sort.jsp"><IMG 
  src="img/photo/rank.gif"></A> </LI>
  <LI id=menuend><A title=在线大头贴 href="photo_dtt.jsp"><IMG 
  src="img/photo/dtt.gif"></A> </LI></UL></DIV>  
  
  <DIV id=contian><!--Create start-->
<DIV id=create2>
<DIV style="FLOAT: right; MARGIN: 20px 9px 0px 0px"><a href="Photo_AddNew.jsp">[新增相册]</a> <a href="Photo_AlbumUpdate.jsp?AlbumID=<%=m_AlbumID%>">[修改相册]</a> <select style="width:90;"  name=select  onChange="if (this.options[this.selectedIndex].value!='') location.href(this.options[this.selectedIndex].value)"   size=1  >
                    <%
								m_Sql = "Select * From Photo_Album Where F_UserID="&m_UserID&" order by F_ID desc"
								Set rst = conn.Execute(m_Sql)
								Do While Not rst.Eof
								  if cstr(m_AlbumID) = cstr(rst("F_ID")) then
     				                response.write "<option value=photo_my.jsp?AlbumID=" + cstr(rst("F_ID"))
           			                response.write " selected"
       				                response.write ">" + rst("F_AlbumName")
                                  else
                                    response.write "<option value='photo_my.jsp?AlbumID=" & rst("F_ID") &"'>"& rst("F_AlbumName") &"</option>"
                                  end if
								  rst.MoveNext
								loop
								rst.Close
								%>
                  </select></DIV>
<H6><IMG src="img/nophoto_man.gif"><A class=blue 
href="#"><%m_TempUserName = Request.Cookies("aspxnet")("CurUserName")
				  if m_TempUserName = "" then Response.write "游客" else Response.write m_TempUserName
				  %>的相册</A> </H6>
				  
				      <%	
	Set rs = Server.createobject("Adodb.RecordSet")
    pageno = request.querystring("pageno")
    pmcount = 9
    mSql = "Select * From Photo_AlbumList Where F_AlbumID="& m_AlbumID &" Order by F_Addtime DESC"
    rs.open mSql,conn,1,1
	if rs.eof then
	   response.write "<FIELDSET><DL><DT></DT><DD><DIV></DD>很抱歉，该相册还没有相片上传! </DD></DL></FIELDSET><DIV id=page></DIV>"
	Else
      rs.pagesize=pmcount
      mpage=rs.pagecount
      if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
         pageno=1
      end if
      rs.absolutepage=pageno
      Dim rc,re
      rc=rs.pagesize
      re=1
%>
				  
<FIELDSET>
<DL>
  <DT>共有相片<font color=red><strong> 
                  <% = rs.recordcount%>
                  </strong></font> 幅 ⊙ 这是<font color=#008000><strong> 
                  <% = Trim(pageno)%>
                  </strong></font>/<font color=#008000><strong> 
                  <% = Trim(mpage)%>
                  </strong></font>页 </DT>
        <%do while not rs.eof and rc>0%>
  <DD>
  <DIV><a target='_blank' title="<%=rs("F_Title")%>" href='ShowPhoto.jsp?ID=<%=rs("F_ID")%>'><IMG src="upfile/SmallImages/<%=rs("F_UserID")%>/<%=rs("F_Image")%>"></A></DIV><A 
  class=block itle="&rs("F_Title")&" href="ShowPhoto.jsp?ID=<%=rs("F_ID")%>" 
  target=_blank><%=rs("F_Title")%></A><BR>编号/人气: <%=rs("F_ID")%>/<%=rs("F_Hits")%><BR>
  <% if rs("F_Image")="" then m_Image = "NoPic" else m_Image = rs("F_Image")
        Response.write "<a href=javascript:jDelete('Photo_my.jsp?AlbumID="&m_AlbumID&"&DeleteID="&rs("F_ID")&"&pageno="&pageno&"&FileName="&m_Image&"')>"
		Response.write "<img src='img/del.gif' alt='删除照片' border=0></a>"
        Response.write " <a href=Photo_Update.jsp?action=read&ID="&rs("F_ID")&"><img src='img/edit.gif' alt='修改资料' border=0></a>"%>
   </DD>
  <%If re mod 3 = 0 then
          Response.write ""
        End if
        rs.movenext
        re=re+1
        rc=rc-1
      loop	
	  %>
  </DL></FIELDSET> 
<DIV id=page><%
   if pageno>1 then
      response.write "<a href='Photo_my.jsp?AlbumID="&m_AlbumID&"'> 首页 </a>"
   else
      response.write " 首页 "
   end if
   if pageno>1 then
      response.write "<a href='Photo_my.jsp?pageno="&pageno-1&"&AlbumID="&m_AlbumID&"'> 上一页 </a>"
   else
      response.write " 上一页 "
   end if
   add=5'数字分页个数+1
   if pageno-int(add/2)<=1 then m=1 else m=pageno-int(add/2)
   if m+add>mpage then 
      n=mpage
      if mpage-add<=1 then m=1 else m=mpage-add
   else
      n=m+add
   end if

   for pno=m to n
     if pno=cint(pageno) then
        response.write "&nbsp;<font color=red>"&pno&"</font>"
     else
        response.write "<b>&nbsp;<a href='Photo_my.jsp?pageno="&pno&"&AlbumID="&m_AlbumID&"'>"&pno&"</a></b>"
     end if
   next
   response.write "&nbsp"

   if int(pageno) < int(rs.pagecount) then
     response.write "<a href='Photo_my.jsp?pageno="&pageno+1&"&AlbumID="&m_AlbumID&"'> 下一页 </a>"
   else 
     response.write " 下一页 "
   end if

   if int(pageno) < int(rs.pagecount) then
      response.write "<a href='Photo_my.jsp?pageno="&mpage&"&AlbumID="&m_AlbumID&"'> 末页 </a>"
   else
      response.write " 末页 "
   end if
   Response.write "&nbsp;&nbsp;"
   rs.close
%></DIV></DIV><!--Create end--></DIV><%end if%>
<DIV id=foot><A class=list href="../about/?Para=Intro" target=_blank>关于我们</A> ┊ <A class=list href="../about/?Para=Contact" target=_blank>联系方式</A> ┊ <A class=list href="../about/?Para=Job" target=_blank>招贤纳士</A> ┊ <A class=list href="../about/?Para=AdService" target=_blank>广告服务</A> ┊ <A class=list href="../about/?Para=Cooperate" target=_blank>合作伙伴</A> ┊ <A class=list href="../so/Suggestion.jsp" target=_blank> 留言/投诉</A> ┊ <A class=list href="../about/?Para=Job" target=_blank></A><BR><%=Site_info(5)%> </DIV></DIV>
      
</BODY></HTML><% Call CloseDatabase %>