<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/count.asp"-->
<!--#include file="../page.asp"-->
<!--#include file="../count.asp"-->
<%
if isChkInteger(request("web_id")) then
web_id=nosql(request("web_id"))
else
Response.Redirect ("../../index.asp")
end if
sql="select * from snsn_user where id="&web_id
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
if rs.eof or rs.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else


if nosql(request("act"))="xs" then
if session("user")="" and session("id")<>cint(web_id) then
response.write"<script>alert('抱歉，你没有权利更改，正在返回!!');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if
if isChkInteger(request("id")) then
id=request("id")
else
response.write "<script language='javascript'>"
response.write "alert('非法操作，正在返回！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
set uppic=server.CreateObject("adodb.recordset")
uppic.open"select * from snsn_uppic_class  where username='"&session("user")&"' and id="&id&"",conn,1,3
if not uppic.eof then
if uppic("xs")=0 then
uppic("xs")=1
else
uppic("xs")=0
end if
uppic.update
'今日更新
sql="select * from snsn_user where id="&web_id
Set rscount= Server.CreateObject("ADODB.Recordset") 
rscount.open sql,conn,1,1
if rscount.eof or rscount.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else

    if datediff("d",rscount("inewdate"),now())<1 then
	conn.execute("update snsn_user set inew=inew+1 where id="&web_id)
    else
	conn.execute("update snsn_user set inew=1,inewdate=getdate() where id="&web_id)
    end if
    
end if
rscount.close
set rscount=nothing
'结束

response.write"<script>alert('更改成功，正在返回!!');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
else
response.write"<script>alert('没有该相册，请重新输入!!');location.href='photo.asp?web_id="&web_id&"&act=add';</script>"
response.End()
end if

end if
if nosql(request("act"))="sadd" then
if session("user")="" and session("id")<>cint(web_id) then
response.write"<script>alert('抱歉，你没有权利更改，正在返回!!');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if
set uppic=server.CreateObject("adodb.recordset")
uppic.open"select * from snsn_uppic_class  where username='"&session("user")&"' and tclass='"&nosql(request("tt"))&"'",conn,1,1
if not uppic.eof then
response.write"<script>alert('您输入的相册名已存，请重新输入!!');location.href='photo.asp?web_id="&web_id&"&act=add';</script>"
response.End()
end if
'今日更新
sql="select * from snsn_user where id="&web_id
Set rscount= Server.CreateObject("ADODB.Recordset") 
rscount.open sql,conn,1,1
if rscount.eof or rscount.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else

    if datediff("d",rscount("inewdate"),now())<1 then
	conn.execute("update snsn_user set inew=inew+1 where id="&web_id)
    else
	conn.execute("update snsn_user set inew=1,inewdate=getdate() where id="&web_id)
    end if
    
end if
rscount.close
set rscount=nothing
'结束

conn.execute"insert into snsn_uppic_class(username,tclass,sm,xs)values('"&session("user")&"','"&nosql(request("tt"))&"','"&nosql(request("sm"))&"',"&nosql(request("xs"))&")"
response.write"<script>alert('新建相册成功');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if
if nosql(request("act"))="del" then
if session("user")="" and session("id")<>cint(web_id) then
response.write"<script>alert('抱歉，你没有权利更改，正在返回!!');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if
if isChkInteger(request("id")) then
id=request("id")
else
response.write "<script language='javascript'>"
response.write "alert('非法操作，正在返回！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
set delpic=server.CreateObject("adodb.recordset")
delpic.open"select * from snsn_uppic_class  where username='"&session("user")&"' and id="&id&"",conn,1,3
conn.execute"delete from snsn_uppic_class where id="&id&" and username='"&session("user")&"'"
conn.execute"delete from snsn_uppic where tclass='"&delpic("tclass")&"' and username='"&session("user")&"'"

response.write"<script>alert('删除成功');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if

if nosql(request("act"))="supd" then
if session("user")="" and session("id")<>cint(web_id) then
response.write"<script>alert('抱歉，你没有权利更改，正在返回!!');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if
if isChkInteger(request("id")) then
id=request("id")
else
response.write "<script language='javascript'>"
response.write "alert('非法操作，正在返回！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
set updpic=server.CreateObject("adodb.recordset")
updpic.open"select * from snsn_uppic_class  where username='"&session("user")&"' and tclass='"&nosql(request("tt"))&"' and id<>"&id,conn,1,3
if not updpic.eof then
response.write"<script>alert('您输入的名称相册中已存在,请重新输入!!');location.href='photo.asp?web_id="&web_id&"&act=upd&id="&nosql(request("id"))&"';</script>"
response.End()
end if
set updpic=server.CreateObject("adodb.recordset")
updpic.open"select * from snsn_uppic_class  where username='"&session("user")&"'  and id="&id,conn,1,3
set updpic1=server.CreateObject("adodb.recordset")
updpic1.open"select * from snsn_uppic  where username='"&session("user")&"' and tclass='"&updpic("tclass")&"'",conn,1,3
if not updpic1.eof then
conn.execute"update snsn_uppic set tclass='"&nosql(request("tt"))&"' where username='"&session("user")&"' and tclass='"&updpic("tclass")&"'"
end if

'今日更新
sql="select * from snsn_user where id="&web_id
Set rscount= Server.CreateObject("ADODB.Recordset") 
rscount.open sql,conn,1,1
if rscount.eof or rscount.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else

    if datediff("d",rscount("inewdate"),now())<1 then
	conn.execute("update snsn_user set inew=inew+1 where id="&web_id)
    else
	conn.execute("update snsn_user set inew=1,inewdate=getdate() where id="&web_id)
    end if
    
end if
rscount.close
set rscount=nothing
'结束

conn.execute"update snsn_uppic_class set tclass='"&nosql(request("tt"))&"',sm='"&nosql(request("sm"))&"' where username='"&session("user")&"' and id="&id
response.write"<script>alert('修改成功');location.href='photo.asp?web_id="&web_id&"';</script>"
response.End()
end if

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link rel="stylesheet" href="css.css" type="text/css">
<style type="text/css">
<!--
.style6 {	font-size: 14px;
	color: #FF0000;
	font-weight: bold;
}
-->
</style>
</head>
<script language="Javascript" src="/minishow/js/ps_only.js"></script>
<body>
<table width="420"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="22">
      <table width="420"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="1" height="1"></td>
          <td height="1" colspan="3" bgcolor="#CCCCCC"></td>
          <td width="1" height="1"></td>
        </tr>
        <tr>
          <td width="1" bgcolor="#CCCCCC"></td>
          <td width="30" bgcolor="#F1F1F1"><div align="center"><span class="M"><IMG 
                              src="img/icon_04.gif" 
                              name=image1754891 width="16" height="13" border=0></span></div></td>
          <td height="25" bgcolor="#F1F1F1"><span class="M"><FONT 
                              color=#000000><a href="web.asp?web_id=<%=web_id%>"><U><%=home%></U></a></FONT> -&gt; <FONT 
                              color=#000000><a href="photo.asp?web_id=<%=web_id%>"><U><%=xc%></U></a> -&gt; <FONT 
                              color=#000000><a href="uppic2.asp?web_id=<%=web_id%>">上传照片</a><a href="photo.asp?web_id=<%=web_id%>"></a> 
          </FONT></FONT></span></td>
          <td bgcolor="#F1F1F1"><div align="right"><span class="M"><font 
                              color=#000000><font 
                              color=#000000>          </font></font></span></div></td>
          <td width="1" bgcolor="#CCCCCC"></td>
        </tr>
        <tr>
          <td width="1" height="1"></td>
          <td height="1" colspan="3" bgcolor="#CCCCCC"></td>
          <td width="1" height="1"></td>
        </tr>
      </table></td>
  </tr><tr>
          <td>&nbsp;</td>
        </tr><tr>
    <td height="25"><span class="M"><font 
                              color=#000000><font 
                              color=#000000>
      <%set rsy=server.CreateObject("adodb.recordset")
	rsy.open"select top 1 * from snsn_m_photo where poto_user_name='"&rs("username")&"'",conn,1,1
if not rsy.eof then%>
      </font></font></span>
      <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
        <tr>
          <td width="150"><table border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="img/newpage_main_003.gif" width="115" height="12"></td>
            </tr>
            <tr>
              <td background="img/newpage_main_004.gif"><table width="110" border="0" align="center" cellpadding="0" cellspacing="3">
                  <tr>
                    <td align="center"><a href="photo_m.asp?web_id=<%=web_id%>&id=<%=rsy("poto_id")%>"><img src="<%=rsy("poto_url")%>" width="100" height="75" border="0" align="absmiddle"></a></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td><img src="img/newpage_main_005.gif" width="115" height="7"></td>
            </tr>
          </table></td>
          <td><span class="M"><font 
                              color=#000000><font 
                              color=#000000>
            <%set yd=server.CreateObject("adodb.recordset")
yd.open"select count(poto_id) as dd from snsn_m_photo  where poto_user_name='"&rs("username")&"'",conn,3,3%>
            <a href="photo_m.asp?web_id=<%=web_id%>">移动相册</a>(共 <span class="style6"><%=yd(0)%></span>&nbsp;张照片)&nbsp;<br>
            你也可以建立自己的移动相册哟！<br>
            手机发送照片到：w@snsn.net</font></font></span></td>
        </tr><tr>
          <td colspan="2">&nbsp;</td>
        </tr>
      </table>
      <span class="M"><font 
                              color=#000000><font 
                              color=#000000>
      <%end if
		rsy.close
set rsy=nothing
		%>
      </font></font></span></td>
  </tr>
  <tr>
    <td align="center" valign="top">
    <form action="<%if request("act")="add" then%>?act=sadd&web_id=<%=web_id%><%else%>?act=supd&web_id=<%=web_id%>&id=<%=request("id")%><%end if%>" method="post" name=form onsubmit="return ck()" >
<script language=javascript>
		function ck(){
		 if(form.tt.value==""){
		 alert('请输入相册名称!!!')
		 return false;}
		}
		</script>
      <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
        <%xx=0
  	set rs1=server.CreateObject("adodb.recordset")
	rs1.open"select * from snsn_uppic_class where username='"&rs("username")&"' and xs=0",conn,1,1
if rs1.eof or rs1.bof then 
	%>
        <tr>
          <td height="30" colspan="2"><div align="center">未上传图片
                  <div></div>
          </div></td>
        </tr>
        <%else
		rs1.PageSize =5 '每页记录条数
		iCount=rs1.RecordCount '记录总数
		iPageSize=rs1.PageSize
    	maxpage=rs1.PageCount 
    	page=request("page")
    	per_page=rs1.PageSize
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs1.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	For i=1 To x
	xx=xx+1%>
        <tr align="center">
          <td width="150" align="center" valign="middle" bgcolor="#FFFFFF">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><img src="img/newpage_main_003.gif" width="115" height="12"></td>
              </tr>
              <tr>
                <td background="img/newpage_main_004.gif"><table width="110" border="0" align="center" cellpadding="0" cellspacing="3">
                  <tr>
                    <td align="center"><a href="photo2.asp?web_id=<%=web_id%>&ida=<%=rs1("tclass")%>" >
		<%
			set rs123=server.CreateObject("adodb.recordset")
	rs123.open"select * from snsn_uppic where username='"&rs("username")&"' and tclass='"&rs1("tclass")&"'  and mink2=1",conn,3,3
	if not rs123.eof then
	response.Write "<img src="&rs123("uppic")&" border=0  width=100 height=75>	"
	else
	response.Write "<br>暂无图片<br>"
	end if%></a></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td><img src="img/newpage_main_005.gif" width="115" height="7"></td>
              </tr>
            </table></td>
          <td align="center" valign="middle" bgcolor="#FFFFFF"><table width="100%"  border="0" cellspacing="0" cellpadding="2">
              <tr>
                <td>
<%set updpic1=server.CreateObject("adodb.recordset")
updpic1.open"select count(id) as dd from snsn_uppic  where username='"&rs("username")&"'   and tclass='"&rs1("tclass")&"'",conn,3,3%>
<a href="photo2.asp?web_id=<%=web_id%>&ida=<%=rs1("tclass")%>"><u><%=rs1("tclass")%></u></a>(共 <span class="style6"><%=updpic1(0)%></span>&nbsp;张照片)<br>                  <%=rs1("adddate")%></td>
              </tr>
              <tr>
                <td><%=rs1("sm")%></td>
              </tr>
              <%if session("user")<>"" and session("id")=cint(web_id) then%>
              <tr>
                <td><a href="?act=del&web_id=<%=web_id%>&id=<%=rs1("id")%>" onClick="return confirm('删除该相册,将删除该相册内所有的照片,您确定删除?')">删除 </a> <a href="?act=upd&web_id=<%=web_id%>&id=<%=rs1("id")%>">更改 </a><a href="?act=add&web_id=<%=web_id%>#photo">新建</a>
                    <%if rs1("xs")=1 then%>
                    <a href="?act=xs&web_id=<%=web_id%>&id=<%=rs1("id")%>">公开</a>
                    <%else%>
                    <a href="?act=xs&web_id=<%=web_id%>&id=<%=rs1("id")%>">不公开</a>
                    <%end if%></td>
              </tr>
              <%end if%>
              <%if request("act")="upd" and cint(request("id"))=rs1("id") then%>
              <tr>
                <td height="17">
                  <input name="tt" type="text" class="wenbenkuang" id="tt" value="<%=rs1("tclass")%>" size="22">
                  <input name="Submit2" type="submit"  class="go-wenbenkuang" value="保存">
                  <input name="Submit22" type="button"  class="go-wenbenkuang" value="取消" onClick="javascript:location.href='?web_id=<%=web_id%>'">
                </td>
              </tr>
              <tr>
                <td height="18"><textarea name="sm" cols="36" rows="5" class="wenbenkuang" id="sm"><%=rs1("sm")%></textarea></td>
              </tr>
              <%end if%>
          </table></td>
        </tr> <tr>
          <td colspan="2">&nbsp;</td>
        </tr>
       <%
		  icolor=icolor+1
if icolor>1 then icolor=0
		rs1.MoveNext
next%>
        <%if nosql(request("act"))="add" then%>
        <tr>
          <td height="14" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF"><a name="#photo"></a>
              <input name="tt" type="text" class="wenbenkuang" id="tt" value="请在此输入新相册名" size="38" >
          </td>
        </tr>
        <tr>
          <td height="15" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF"><textarea name="sm" cols="36" rows="5" class="wenbenkuang" id="sm"></textarea></td>
        </tr>
        <tr>
          <td height="30" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF"><select name="xs" class="wenbenkuang" id="xs">
              <option value="0" selected>对外公开</option>
              <option value="1">不对外公开</option>
            </select>
              <input name="Submit" type="submit" class="go-wenbenkuang" value="保存" >
              <input name="Submit3" type="button" class="go-wenbenkuang" value="取消" onClick="javascript:location.href='?web_id=<%=web_id%>'"></td>
        </tr>
        <%end if%>
      </table>
      <TABLE width="100%" 
        border=0 align="center" cellPadding=4 cellSpacing=0>
        <TBODY>
          <TR>
            <TD class=M noWrap align=middle><%
					call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>",per_page)
				  %></TD>
          </TR>
        </TBODY>
      </TABLE>
    </form></td>
  </tr>
</table>
</body>
</html><%end if
end if%>