<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/char.jsp" -->
<!--#include file="../Include/const.jsp" -->
<!--#include file="../Include/function.jsp" -->
<!--#include file="../Include/md5.jsp" -->
<!--#include file="../Include/licky_fsql.jsp" -->


<%
sub ShowPrev(ID,AlbumID)
	dim rsPrev,sqlPrev
	sqlPrev="Select Top 1 * FROM Photo_AlbumList WHERE F_AlbumID = " & AlbumID &" and F_ID<" & ID& " order by F_ID DESC"
	Set rsPrev= Server.CreateObject("ADODB.Recordset")
	rsPrev.open sqlPrev,conn,1,1
	
	if rsPrev.Eof then
	  	response.write "最末页"
	else
		response.write " <a class='blue' href='?ID=" & rsPrev("F_ID")& "'><strong>下一页</strong></a>"
	end if
	rsPrev.close
	set rsPrev=nothing
end sub

sub ShowNext(ID,AlbumID)
	dim rsNext,sqlNext
	sqlNext="Select Top 1 * FROM Photo_AlbumList WHERE F_AlbumID = " & AlbumID &" and F_ID>" & ID& " order by F_ID ASC"
	Set rsNext= Server.CreateObject("ADODB.Recordset")
	rsNext.open sqlNext,conn,1,1

	if rsNext.Eof then
	  	response.write "第一页"
	else
		response.write " <a class='blue' href='?ID=" & rsNext("F_ID")& "'><strong>上一页</strong></a> "
	end if
	rsNext.close
	set rsNext=nothing
end sub

  If Request.ServerVariables("REQUEST_METHOD")="POST" then
      mAlbumID = Request.Form("hidAlbumID")
      mUserName = checkStr(Trim(Request.Form("txtUserName")))
      If Request.Form("chkAnonymity")="1" then
	    session("Anonymity")="1"
	    mUserName="匿名"
	  else
        mUserName = checkStr(Trim(Request.Form("txtUserName")))
      end if
	  
      mContent = NoCSSHackInput(Request.Form("txtContent"))
      mIPInfo = Request.ServerVariables("REMOTE_ADDR")
      mSql = "Insert Into Photo_Review(F_AlbumID,F_UserName,F_Content,F_IPInfo,F_Addtime)"
      mSql = mSql + "Values('"&mAlbumID&"','"&mUserName&"','"&mContent&"','"&mIPInfo&"','"&now()&"')"
      conn.Execute(mSql)
      Call Msgbox("祝贺您，你已经对该主题，发了您的评论.","ShowPhoto.jsp?ID="&mAlbumID)

  End if

  dim rs,mSql
  dim mTitle,mContent,mImage,UserName,mIPInfo
  dim ID
  ID = checkStr(Request.QueryString("ID"))
 
  if trim(ID) = "" OR (not isnumeric(ID)) then
   call msgbox("请不要误操作!",1)
   response.end
 end if
 
  mSql="Select * From Photo_AlbumList Where F_ID=" & ID
  Set rs = conn.Execute(mSql)
  If rs.Eof then
    Response.write "对不起，该页无法显示！请<a href='javascript:window.back(-1)'>[返 回]</a>"
	Response.end
  End if
    mAlbumID = rs("F_AlbumID")
    mID1 = rs("F_ID")
    mTitle = rs("F_Title")
    mContent = rs("F_Content")
    mImage = rs("F_Image")
    mUserName = rs("F_UserName")
	mUserID = rs("F_UserID")
    mIPInfo = rs("F_IPInfo")
    mAddtime = rs("F_Addtime")
	mImageSize = round(rs("F_ImageSize")/1024,2)
	if mImageSize < 1  then mImageSize = "0"+cstr(mImageSize)+"K" else mImageSize = cstr(mImageSize)+"K"
    mHits = rs("F_Hits")
    rs.Close
	
    'read next
	'm_Sql = "SELECT * FROM Photo_AlbumList WHERE F_AlbumID="&m_AlbumID
	'Set rs = conn.Execute(m_Sql)
	'do While Not rs.Eof
	'  if cstr(ID) = cstr(rs("F_ID")) then
	'  rs.MoveNext
	'loop
   

'Hits++
mSql = "Update Photo_AlbumList set F_Hits=F_Hits+1 Where F_ID=" & ID
conn.Execute(mSql)

if Request.Querystring("action") = "Delete" then
  m_Sql = "Delete From Photo_Review Where F_ID=" & Request("DeleteID")
  conn.Execute(m_Sql)
  Response.write "<script>location.replace('ShowPhoto.jsp?ID="&Request("ID")&"')</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><%=mTitle%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
href="mm.files/index_photo.css" type=text/css rel=stylesheet>
<SCRIPT src="Jimage.js"></SCRIPT>
<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>
<script language="JavaScript">
function CheckData()
{

 if (document.form2.txtContent.value=="")
 {
   alert('对不起，评论内容不能为空!');
   document.form2.txtContent.focus();
   return false;
 }
 
}
</script>

<META content="MSHTML 6.00.2800.1555" name=GENERATOR></HEAD>
<BODY><LINK href="css/index_photo.css" type=text/css rel=stylesheet>
  <%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>
</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_help.jsp"><IMG 
  src="img/photo/help.gif"></A> </LI></UL></DIV>
<DIV id=contian><!--Create start-->
<DIV id=create>
<H6><IMG src="img/photo/user_img.jpg"><A class=blue 
href="Photo_default.jsp">网络相册</A> / <%= mTitle %> </H6>
<H6>
<DIV style="FLOAT: right"><%call ShowNext(mID1,mAlbumID)%> <%call ShowPrev(mID1,mAlbumID)%>
</DIV> 
<STRONG>用户名</STRONG>：<%= mUserName %> <STRONG>标题</STRONG>：<%= mTitle %> <STRONG>点击数</STRONG>：<%= mHits %></H6>
<DIV id=picvisit> <%if Trim(mImage)<>"" then %><A href="upfile/BigImages/<%=mUserID%>/<%=mImage%>" target=_blank><IMG 
style="BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN: 0px auto; BORDER-LEFT: #ddd 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #ddd 1px solid" 
src="upfile/BigImages/<%=mUserID%>/<%=mImage%>" 
onload="javascript:if(this.width>600 * 2)this.style.width=600;else if(this.width>=600)this.style.width=Math.round(this.width * Math.floor(2 * 600 / this.width) / 2);" 
border=1></A><%end if					  
					%> </DIV>
					<DIV style="text-align: center;"> <font color="#990000">相片描述：</font><%=Htmlencode(mContent) %>
</DIV> 
<FIELDSET>
<form name="form2" method="post" action="ShowPhoto.jsp?ID=<%=ID%>" onSubmit="return CheckData()">
<H6><STRONG><input name="chkAnonymity" type="checkbox" value="1" <%if session("Anonymity") = 1 then Response.Write "checked" %>>发表评论:</STRONG></H6><LABEL><SPAN>您的大名：</SPAN> <INPUT value="<%=Request.Cookies("aspxnet")("CurUserName")%>"
name=txtUserName> // 如果不输入则以匿名身份发表信息. <FONT face=宋体><input name="hidAlbumID" type="hidden" value="<%=mID1%>"> </FONT></LABEL><LABEL><SPAN>评论内容：</SPAN> <TEXTAREA name=txtContent rows=8 cols=60></TEXTAREA> 
</LABEL><LABEL><SPAN>&nbsp;</SPAN><BUTTON class=bot1 
type=submit>提交</BUTTON><BUTTON class=bot1 type=reset>取消</BUTTON> 
</LABEL></FORM></FIELDSET> </DIV>
<DIV id=remark>                       

<%
	  mSql = "Select Top 20 * From Photo_Review Where F_AlbumID=" & mID1&" order by F_Addtime desc"
	  Set rs = conn.Execute(mSql)
	  if rs.eof then response.write "<DL>对不起，该照暂无评论！</DL>"
%>
<dl>
<%Do While Not rs.Eof 	%>
<dd><%set rs_c1=server.createobject("adodb.recordset")
	  sql_c1="select * from T_Member where F_UserName='"&rs("F_UserName")&"'"
	  Set rs_c1 = conn.Execute(sql_c1)
	  %>
	  <%if rs("F_UserName")="匿名" then
	  response.write "<img src='img/user02.gif' />"
	  else
	  response.write "<img src='"&rs_c1("F_MyImage")&"' />"
end if
	  rs_c1.close%><h3><a href='#' class='sky'><%=rs("F_UserName")%></a></h3><%=rs("F_Content")%><td>·[<font color=D669A5><%=rs("F_UserName")%></font>]<font color=aaaaaa>(<%=formatdatetime(rs("F_Addtime"),2)%>)</font>  
<%if Cstr(rs("F_UserName"))= session("CurUserName") then
		  Response.write "<a href=javascript:jDelete('ShowPhoto.jsp?ID="&mID1&"&DeleteID="&rs("F_ID")&"')>"
		  Response.write "<img src='img/del.gif' alt='删除' border=0></a>"
		end if%>
			</dd>
			
<%rs.MoveNext
	  Loop
	  rs.Close
	  %></dl></DIV><!--Create end--></DIV>
<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>
<DIV></DIV>
<DIV></DIV>

</BODY></HTML>
