<!--#include file="setup.asp" -->
<script src="inc/qShow.js"></script>
<%
top
if Request.Cookies("username")=empty then error("<li>您还未<a href=login.asp>登录</a>社区")

showtype=request("type")
if showtype=empty then showtype=1
subtype = request("subtype")
if subtype=empty then subtype=1
truetype = subtype * 100 + showtype

if Request.Cookies("sex")<>"female" and  Request.Cookies("sex")<>"male" then Response.Cookies("sex")="male"

if request("act")="vote" then
	if isnumeric(request("voteid")) and request("voteid")<>"" then
		voteid=cint(request("voteid"))
		set voters=conn.execute("select * from [myshow_photo] where id="&voteid)
		 if isnull(voters("voter")) or isnull(voters("vote")) then
		  	sql="update [myshow_photo] set vote=1,voter='"&voters("voter")&"'+'"&request.cookies("username")&"'+'|' where id="&voteid
			conn.execute sql
			response.write "<script>window.alert('投票成功!');document.location='myshow_photoshow.asp';</script>"
		 else
			if InstrRev(voters("voter"),request.cookies("username"))<>0 then 
				response.write "<script>window.alert('您已经投过票了!');history.go(-1)</script>"
			else
				sql="update [myshow_photo] set vote=vote+1,voter='"&voters("voter")&"'+'"&request.cookies("username")&"'+'|' where id="&voteid
				conn.execute sql
				response.write "<script>window.alert('投票成功!');document.location='myshow_photoshow.asp';</script>"
			end if
		 end if
	else
		response.write "<script>window.alert('非法提交');history.go(-1)</script>"
	end if
end if

if request("act")="voter" then
	if isnumeric(request("voteid")) and request("voteid")<>"" then
		voteid=cint(request("voteid"))
		set voters=conn.execute("select * from [myshow_photo] where id="&voteid)
			if isnull(voters("voter")) or voters("voter")="" then
				response.write "<script>window.alert('还没有人投票!');history.go(-1)</script>"
			else
				response.write "<script>window.alert('"&voters("voter")&"');history.go(-1)</script>"
			end if
	else
		response.write "<script>window.alert('非法提交');history.go(-1)</script>"
	end if
end if
%>

<title>虚拟形象</title>


<table border=0 width="97%" align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%clubtree%> → <a href=myshow.asp>虚拟形象</a> → 形象展示</td>
</tr>
</table><br>

<script>valigntop()</script>
<TABLE style="WIDTH: 97%" height=29 cellSpacing=1 cellPadding=5 align=center border=0 class=a2>
<form name="showform" method="post" action="">
<input name="usershow" type="hidden" value=""> 
<TR>
		<TD align="center" bgcolor="FFFFFF" colspan="5">
		<%
		sql = "select * from [myshow_photo] where photoshow=true order by id desc"
		rs.open sql,conn,1
		if not rs.eof then
		
		pagesetup=6
		
		count=rs.recordcount    '数据总条数
		rs.pagesize=pagesetup   '每页显示条数
		TotalPage=rs.pagecount  '总页数
		PageCount = cint(Request.QueryString("ToPage"))
		if PageCount <1 then PageCount = 1
		if PageCount > TotalPage then PageCount = TotalPage
		if TotalPage>0 then rs.absolutepage=PageCount '跳转到指定页数
		
		i=0
		Do While Not RS.EOF and i<pagesetup
		i=i+1
		if Not Response.IsClientConnected then responseend
		if i mod 3 = 1 then response.Write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center' width='33%'>")
		%>
		<table width="97%" border="0" cellspacing="0" cellpadding="0">
			<TR align=middle>
			<TD bgcolor="FFFFFF" height="230"><div id="bodyshow<%=rs("id")%>" style="border:0px solid #000000;padding:0;POSITION: relative; Left: 0; TOP: 0; HEIGHT: 226px;  WIDTH: 140px;"></div></TD>
			</TR><script>qshowit("<%=rs("photo")%>","<%=rs("id")%>")</script>
			<tr>
			<td valign="middle">
			<table width="175" align="center">
			<tr>
			  <td valign="middle">用户昵称：<%=rs("username")%><br>拍照时间：<%=rs("regtime")%><br>照片主题：<%=rs("explain")%><br>
				投票结果：<%if isnull(rs("vote")) or rs("vote")="" then%><font color=red>0</font><%else%><font color=red><%=rs("vote")%></font><%end if%>票<br><input onclick="javascript:window.open('myshow_showdel.asp?act=del&id=<%=rs("ID")%>','_self','')" type="button" value="删除" name="del">&nbsp; <input onclick="document.location='myshow_photoshow.asp?act=vote&voteid=<%=rs("ID")%>'" type="button" value="投票" name="vote">&nbsp; 
				<input onclick="document.location='myshow_photoshow.asp?act=voter&voteid=<%=rs("ID")%>'" type="button" value="查看" name="voter"></td>
			</tr>
			</table>
			</td>
			</tr>
		  </table>
		<%
		if i mod 3 <> 0 then 
		response.Write("</td><td align='center' width='33%'>")
		else
		response.Write("</td></tr></table><hr width='97%' size='1' color='CCCCCC'>")
		end if
		
		rs.movenext
		loop
		rs.close
		
		if i mod 3 = 2 then response.Write("</td></tr></table><hr width='97%' size='1' color='CCCCCC'>")
		if i mod 3 = 1 then response.Write("</td><td width='33%' align='center'></td></tr></table><hr width='97%' size='1' color='CCCCCC'>")
		%>
		<table width="95%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td height="20">
		<b>共有 <font color=990000><%=TotalPage%></font> 页 </b>
		</td>
		<td align="right"><b>页[ 
		<script>
		PageCount=<%=TotalPage%>
		topage=<%=PageCount%>
		for (var i=1; i <= PageCount; i++) {
		if (i <= topage+3 && i >= topage-3 || i==1 || i==PageCount){
		if (i > topage+4 || i < topage-2 && i!=1 && i!=2 ){document.write(" ... ");}
		if (topage==i){document.write(" <font color=red>"+ i +"</font> ");}
		else{
		document.write("<a href=?"+"topage="+i+">"+ i +"</a> ");
		}
		}
		}
		</script>
		] </b>
		</td>
		</tr>
		</table>
		<%end if%>
		</TD>
</TR>
</TBODY>
</form>
</TABLE>
<script>valignbottom()</script>
<%
htmlend
%>