<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: userphoto.asp
' Version:3.0
' Date: 2005-10-22
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
response.buffer=true
stats="用户相册"
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有<a href=login.asp>登陆</a>，不能建立相册。如果您还没有<a href=reg.asp>注册</a>！"
	Founderr=true
end if
if Cint(GroupSetting(60))<>0 and dateadd("n",Cint(GroupSetting(60)),myjoinDate)>=Now() then
  	errmsg=errmsg+"<br>"+"<li>新注册用户"&Cint(GroupSetting(60))&"分钟后才能建立相册，请稍后<a href=login.asp target=_blank>登录</a>。"
	founderr=true
end if
call nav()
if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var(trim(membername)&"&nbsp;的相册","userphoto.asp")
call tumppages()'翻页处理
strFileName="userphoto.asp?action="&Request("action")&"&id="&Request("id")&""
	dim UpnumLorn1,UpnumLorn0
set rs=server.createobject("adodb.recordset")
sql="select count(FID) from [Ms_Upphoto] where UserID="&UserID&" and LorN=1"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
UpnumLorn1=rs(0)
else
UpnumLorn1=0
end if
rs.close
set rs=server.createobject("adodb.recordset")
sql="select count(FID) from [Ms_Upphoto] where UserID="&UserID&" and LorN=0"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
UpnumLorn0=rs(0)
else
UpnumLorn0=0
end if
rs.close
Select Case Trim(Request("action"))
	Case "Cr_folder"''创建目录
		Stats="创建目录"
		Call Cr_folder()
	case "Cr_folder_s"''保存目录
		Stats="保存目录"
		Call Cr_folder_s()
	case "Ed_folder"''修改目录
		Stats="修改目录"
		Call Ed_folder()
	case "Ed_folder_s"''保存修改目录
		Stats="保存目录"
		Call Ed_folder_s()		
	case "c_order"''目录排序
		Stats="目录排序"
		Call C_order()
	case "删除目录"''删除目录
		Stats="删除目录"
		Call del_order()	
	Case "al_list"
		Stats="图片列表"
		Call al_list()
	Case "al_order"''图片排序
		Stats="图片排序"
		Call al_order()
	Case "upload_loc"''本地上传
		Stats="本地上传"
		Call upload_loc()
	Case "upload_loc_s"''保存本地上传
		Stats="保存本地上传"
		Call upload_loc_s()	
	Case "upload_net"''网络贴图
		Stats="网络贴图"
		Call upload_net()
	Case "upload_net_s"''保存网络贴图
		Stats="网络贴图"
		Call upload_net_s()
	Case "edit_ph"''修改贴图
		Stats="修改贴图"
		Call edit_ph()
	Case "edit_ph_s"''保存修改贴图
		Stats="保存修改贴图"
		Call edit_ph_s()	
	Case "setface"
		Stats="设置照片"
		Call setface()
	Case "setBody"
		Stats="设置形象照"
		Call setBody()
	Case "清空"
		Stats="清空相册"
		Call Alldelet()
	Case "删除"
		Stats="删除相册"
		Call delet()
	Case "移动"
		Stats="移动相册"
		Call moveph()
	Case "Mo_photo_s"
		Stats="保存移动相册"
		Call Mo_photo_s()						
	case else
	call main()
End Select
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()''相册目录列表%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="?action=updat" method=POST name="theForm">
    <tr align="left"> 
      <th width="60%" height="28"  class=tablebody1><%=membername%> 的相册</th>
    </tr>
    <tr align="center"> 
      <td width="100%" height="26" align="left"  class=tablebody2>[<a href="?action=Cr_folder">创建目录</a>] 
        [目录排序：<a href="?action=c_order&orders=1">默认</a>－<a href="?action=c_order&orders=2">点击</a>－<a href="?action=c_order&orders=3">图数</a>]</td>
    </tr>
    <tr align="center"> 
      <td height="147"  class=tablebody1> <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <%dim iu
	  set rs=server.createobject("adodb.recordset")
		  sql="select Phototype,id,Isphoto,Allpic from Ms_Uphtype where Username='"&trim(membername)&"' order by Orders ,id"
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
iu=0
call rspages()%>
          <tr> 
            <%do while not rs.eof and page_count<Cint(MaxPerPage)
		  iu=iu+1
		  %>
            <td height="164" align="center"> <table border="0" cellpadding="0" cellspacing="0" class=tableborder2 style="width:140">
                <tr> 
                  <td height="127" align=center><%if rs(2)<>"" then
				  response.Write("<img src="&rs(2)&" border=0 height=120 width=130>")
				  else
				  response.Write("<img src=images/nophoto_up.gif>")
				  end if%></td>
                </tr>
                <tr> 
                  <td height="25" align="center"><input type=checkbox name=id value=<%=rs(1)%>>
                    <a href=?action=al_list&id=<%=rs(1)%>><%=rs(0)%></a>&nbsp;<font color="#666666">(<%=rs(3)%>)</font></td>
                </tr>
              </table></td>
            <%if iu>0 and iu mod 5=0 then
  response.Write("</tr><tr>")
  end if
  page_count=page_count+1
  rs.movenext
  loop
  else
  response.write("<td height=""30"" colspan=""5"" align=""center""  class=tablebody1>"&stats&"无相册目录！</td>")
  end if
  rs.close
  %>
          </tr>
        </table></td>
    </tr>
    <tr align="center"> 
      <td width="100%" height="12" align="left"  class=tablebody1><%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td>
    </tr>
    <tr align="center">
      <td height="13" align="right"  class=tablebody1>
<input type=checkbox name=chkall value=on onclick="CheckAll(this.form)"> 
        选中所有显示记录
        <input type=submit name=action onclick="{if(confirm('确定删除选定的目录吗?')){this.document.theform.submit();return true;}return false;}" value="删除目录">
      </td>
    </tr>
  </form>
</table>
<%
end sub

sub C_order()''目录排序开始
dim orders,Cnum,i
orders=Checkstr(Trim(Request("orders")))
if orders="" or not isnumeric(orders) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
orders=clng(orders)
end if
''获取目录总数
sql="select count(id) as id from [Ms_Uphtype] where Username='"&trim(membername)&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Cnum=rs(0)
else
Cnum=0
end if
rs.close
if orders=1 then''默认排序
set rs=server.createobject("adodb.recordset")
sql="select Orders from Ms_Uphtype where Username='"&trim(membername)&"' order by id asc"
rs.Open sql,conn,1,3
if not (rs.eof and rs.bof) then
i=1
do while not rs.eof
rs("Orders")=i
rs.movenext
i=i+1
if i>Cnum then
  	errmsg=errmsg+"<br>"+"<li>记录尾页。"
	founderr=true
	exit do
end if
loop
end if
rs.close

elseif orders=2 then''按点击排序
set rs=server.createobject("adodb.recordset")
sql="select Orders from Ms_Uphtype where Username='"&trim(membername)&"' order by Hits desc,id"
rs.Open sql,conn,1,3
if not (rs.eof and rs.bof) then
i=1
do while not rs.eof
rs("Orders")=i
rs.movenext
i=i+1
if i>Cnum then
  	errmsg=errmsg+"<br>"+"<li>记录尾页。"
	founderr=true
	exit do
end if
loop
end if
rs.close

elseif orders=3 then''按图片数
set rs=server.createobject("adodb.recordset")
sql="select Orders from Ms_Uphtype where Username='"&trim(membername)&"' order by Allpic desc,id"
rs.Open sql,conn,1,3
if not (rs.eof and rs.bof) then
i=1
do while not rs.eof
rs("Orders")=i
rs.movenext
i=i+1
if i>Cnum then
  	errmsg=errmsg+"<br>"+"<li>记录尾页。"
	founderr=true
	exit do
end if
loop
end if
rs.close

end if
Response.Redirect "userphoto.asp"
end sub

sub al_list()''图片列表
dim id
id=Checkstr(Trim(Request("id")))
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="userphoto.asp" method=POST name="theForm">
    <tr align="left"> 
      <th height="28"  class=tablebody1 colspan="9"><%=membername%> 的相册</th>
    </tr>
    <tr align="center"> 
      <td height="26" align="left"  class=tablebody2 colspan=9> [<a href=?action=Ed_folder&id=<%=id%>>目录属性</a>] 
        [图片排序：<a href="?action=al_order&orders=1&id=<%=id%>">默认</a>－<a href="?action=al_order&orders=2&id=<%=id%>">点击</a>] 
        [<a href="?action=upload_loc&id=<%=id%>">本地上传</a>] 
        [<a href="?action=upload_net&id=<%=id%>">网络贴图</a>]</td>
    </tr>
    <tr align="center"> 
      <td width="46" height="31"  class=tablebody2>属性</td>
      <td width="270"  class=tablebody2>图片文件</td>
      <td width="61"  class=tablebody2>封面</td>
      <td width="66"  class=tablebody2>大小</td>
      <td width="56"  class=tablebody2>人气</td>
      <td width="47"  class=tablebody2>形象</td>
      <td width="55"  class=tablebody2>状态</td>
      <td width="47"  class=tablebody2>修改</td>
      <td width="55"  class=tablebody2>操作</td>
    </tr>
    <%dim Fid
	set rs=server.createobject("adodb.recordset")
	sql="select * from [Ms_Upphoto] where Username='"&trim(membername)&"' and FTypes="&id&" order by orders asc,Fid "
	rs.Open sql,conn,1,1
if rs.eof and rs.bof then
	response.write"<tr><td class=tablebody1 align=center valign=middle colspan=9>您还没有上传任何照片。</td></tr>"
else
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
Fid=rs("Fid")
%>
    <tr align="center"> 
      <td height="0" align="center"  class=tablebody1><img src="images/files/<%=rs("FileTypes")%>.gif" border=0></td>
      <td height="26" align="left"  class=tablebody1><a href="showpic.asp?Fid=<%=Fid%>" target=_blank Title="点击查看图片"><img src=<%=rs("Viewname")%> width="50" border="0"></a></td>
      <td height="26" align="center"  class=tablebody1><a href="?action=setface&Fid=<%=Fid%>&Ftypes=<%=id%>">设置</a></td>
      <td height="0" align="center"  class=tablebody1><%=rs("FileSize")%> </td>
      <td height="0" align="center"  class=tablebody1><%=rs("Hits")%>次</td>
      <td height="0" align="center"  class=tablebody1> <%if rs("Bodypic")=1 then
	  response.Write("<a href=userphoto.asp?action=setBody&Bodypic=0&Fid="&Fid&" title=设置照片不是形象照><font color=red>是</font></a>")
	  else
	  response.Write("<a href=userphoto.asp?action=setBody&Bodypic=1&Fid="&Fid&" title=设置照片为形象照>否</a>")
	  end if%> </td>
      <td height="0" align="center"  class=tablebody1> <%if rs("Checked")=1 then
	  response.Write("已审核")
	  elseif rs("Checked")=0 then
	  response.Write("<font color=red>未审核</font>")
	  elseif rs("Checked")=2 then
	  response.Write("<font color=red>不通过</font>")
	  end if%> </td>
      <td height="0" align="center"  class=tablebody1><a href="userphoto.asp?action=edit_ph&Fid=<%=Fid%>&oldftype=<%=id%>">修改</a></td>
      <td height="0" align="center"  class=tablebody1><input type=checkbox name=id value=<%=Fid%>> 
      </td>
    </tr>
    <%page_count=page_count+1
  rs.movenext
  loop
  end if
  %>
    <tr align="center"> 
      <td height="28" colspan="9" align="left"  class=tablebody2><%
		  	call showpage(strFileName)%></td>
    </tr>
    <tr align="right"> 
      <td height="15" colspan="9"  class=tablebody1> <input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">
	  <input type=hidden name=Ftypes value=<%=id%>>
        选中所有显示记录 <input type=submit name=action onclick="{if(confirm('确定移动所有相册吗?')){this.document.theform.submit();return true;}return false;}" value="移动"> 
        <input type=submit name=action onclick="{if(confirm('确定清空所有相册吗?')){this.document.theform.submit();return true;}return false;}" value="清空">
        <input type=submit name=action onclick="{if(confirm('确定删除选定的相册吗?')){this.document.theform.submit();return true;}return false;}" value="删除"> 
      </td>
    </tr>
    <tr align="center"> 
      <td height="37" colspan="9" align="left"  class=tablebody1>注意：<br>
        　　1、状态为“<font color="#FF0000">未通过</font>”，请自己检查图片是否有违<a href="agreement.asp?id=6" target="_blank"><font color="#FF0000">审核标准</font></a>。<br>
        　　2、形象照只会显示一张，请上传真实照片。<br>
        　　3、本地上传金钱/篇 <b><%=GroupSetting(65)%> <%=GroupSetting(66)%></b> 元 本地上传魅力/篇 <b><%=GroupSetting(67)%> <%=GroupSetting(68)%></b> 点 本地上传经验/篇 <b><%=GroupSetting(69)%> <%=GroupSetting(70)%></b> 点 。<br>
        　　4、网络上传金钱/篇 <b><%=GroupSetting(72)%> <%=GroupSetting(73)%></b> 元 网络上传魅力/篇 <b><%=GroupSetting(74)%> <%=GroupSetting(75)%></b> 点 网络上传经验/篇 <b><%=GroupSetting(76)%> <%=GroupSetting(77)%></b> 点。<br>
        　　5、可本地上传 <font color="red"><b> 
        <%if Cint(GroupSetting(64))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(64))
		end if%>
        </b></font> 张图片，您还可以本地上传 <font color="red"><b> 
        <%if Cint(GroupSetting(64))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(64)-UpnumLorn1)
		end if%>
        </b></font> 张图片<br>
        　　6、网络图片可以添加 <font color="red"><b> 
        <%if Cint(GroupSetting(71))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(71))
		end if%>
        </b></font> 张图片，您还可以添加 <font color="red"><b> 
        <%if Cint(GroupSetting(71))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(71)-UpnumLorn1)
		end if%>
        </b></font> 张网络图片</td>
    </tr>
  </form>
</table>

<%rs.close
end sub

sub al_order()''图片排序
dim orders,Cnum,i,id
orders=Checkstr(Trim(Request("orders")))
id=Checkstr(Trim(Request("id")))
if orders="" or not isnumeric(orders) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
orders=clng(orders)
end if
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if
''获取图片总数
sql="select count(Fid) as Fid from [Ms_Upphoto] where Username='"&trim(membername)&"' and FTypes="&id&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Cnum=rs(0)
else
Cnum=0
end if
rs.close
if orders=1 then''默认排序
set rs=server.createobject("adodb.recordset")
sql="select Orders from Ms_Upphoto where Username='"&trim(membername)&"' and FTypes="&id&" order by Fid asc"
rs.Open sql,conn,1,3
if not (rs.eof and rs.bof) then
i=1
do while not rs.eof
rs("Orders")=i
rs.movenext
i=i+1
if i>Cnum then
  	errmsg=errmsg+"<br>"+"<li>记录尾页。"
	founderr=true
	exit do
end if
loop
end if
rs.close

elseif orders=2 then''按点击排序
set rs=server.createobject("adodb.recordset")
sql="select Orders from Ms_Upphoto where Username='"&trim(membername)&"' and FTypes="&id&" order by Hits desc,Fid"
rs.Open sql,conn,1,3
if not (rs.eof and rs.bof) then
i=1
do while not rs.eof
rs("Orders")=i
rs.movenext
i=i+1
if i>Cnum then
  	errmsg=errmsg+"<br>"+"<li>记录尾页。"
	founderr=true
	exit do
end if
loop
end if
rs.close

end if
Response.Redirect "userphoto.asp?action=al_list&id="&id&""
end sub

sub Cr_folder()''创建目录%>
<SCRIPT src="inc/category.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function selectChange(control, controlToPopulate, catArray, selectid)
{
  for (var q=controlToPopulate.options.length;q>=0;q--) {
  	controlToPopulate.options[q]=null;
  }
  
  var myEle = document.createElement("OPTION") ;
  myEle.value = 0 ;
  myEle.text = "请选择";
  controlToPopulate.options.add(myEle);
    
	if(control.value != 0) {
		for (var x = 0 ; x < catArray.length  ; x++ ) {
			if ( catArray[x][2] == control.value ) {
				myEle = document.createElement("OPTION") ;
				myEle.value = catArray[x][0] ;
				myEle.text = catArray[x][1];
				controlToPopulate.options.add(myEle) ;
			}
		}//END FOR
	}
	controlToPopulate.value = selectid;
}
function TopCategory(controlToPopulate, catArray, selectid)
{
  for (var q=controlToPopulate.options.length;q>=0;q--) {
  	controlToPopulate.options[q]=null;
  }
  
  var myEle = document.createElement("OPTION") ;
  myEle.value = 0 ;
  myEle.text = "请选择";
  controlToPopulate.options.add(myEle);
   
   //alert(selectid);
  for (var x = 0 ; x < catArray.length; x++ ) {
	if ( catArray[x][2] == 0 ) {
			myEle = document.createElement("OPTION") ;
			myEle.value = catArray[x][0] ;
			myEle.text = catArray[x][1];
			controlToPopulate.options.add(myEle) ;
		}
   }
   controlToPopulate.value = selectid;
}

function check() {
	if(document.forms['theForm'].Phototype.value.length == 0) {
		alert("没有填写目录名称");
		return false;
	}
	if(document.forms['theForm'].SubCategory.value == 0) {
		alert("没有选择目录分类");
		return false;
	}
	return true;
}
//  End -->
</script>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="userphoto.asp?action=Cr_folder_s" method=POST name="theForm" onsubmit="return check();">
    <tr align="left"> 
      <th width="60%" height="28"  class=tablebody1><%=membername%> 的相册-创建目录</th>
    </tr>
    <tr align="center"> 
      <td width="100%" height="249" align="left" valign="top"  class=tablebody1>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
          <tr> 
            <td height="32" colspan="2">新建目录</td>
          </tr>
          <tr> 
            <td width="22%" height="30" align="right">目录名称</td>
            <td width="78%"><input name="Phototype" type="text" id="Phototype" size="40" maxlength="200"></td>
          </tr>
          <tr> 
            <td height="28" align="right">目录描述</td>
            <td><textarea name="Readme" cols="50" rows="5" id="Readme"></textarea></td>
          </tr>
          <tr> 
            <td height="30" align="right">目录分类</td>
            <td><SELECT id="TopCategory" name="TopCategory" onchange="selectChange(this, theForm.SubCategory, catArray, 0);">
			</SELECT>
            子分类
			  <SELECT id="SubCategory" name="SubCategory">
              </SELECT> <font color="#FF6600">建议您将不同类型的照片放在不同的目录中。</font></td>
          </tr>
          <tr> 
            <td height="27">目录属性</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td height="24" align="right">公开目录</td>
            <td><input name="IsShell" type="radio" value="0" checked>
              完全公开<font color="#666666">(任何人都可以浏览此目录)</font></td>
          </tr>
          <tr> 
            <td height="21" align="right">私人目录</td>
            <td><input type="radio" name="IsShell" value="1">
              完全私有<font color="#666666">(只有您自己可以浏览此目录) </font></td>
          </tr>
          <tr> 
            <td height="23" align="right">半公开目录</td>
            <td><input type="radio" name="IsShell" value="2">
              需要密码验证 <font color="#FF0000">密码：</font> 
              <input name="Readpass" type="text" id="Readpass" size="10" maxlength="6">
              <font color="#666666">(长度1-6位英文及数字)</font></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr align="center">
      <td  class=tablebody1><input type="submit" name="Submit" value="创建目录"></td>
    </tr>
    <tr align="center"> 
      <td width="100%"  class=tablebody1 align="left">&nbsp;</td>
    </tr>
  </form>
</table>
<script>
TopCategory(document.getElementById('TopCategory'), catArray, '0');
selectChange(document.getElementById('TopCategory'), document.getElementById('SubCategory'), catArray, '0')
</script>
<%
end sub

sub Cr_folder_s()''保存目录
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
end if
dim Phototype,Readme,Orders
	Phototype=checkStr(trim(Request("Phototype")))
	Readme=checkStr(trim(Request("Readme")))
	if Phototype="" or strLength(request("Phototype"))>50 then
		errmsg=errmsg+"<br>"+"<li>请输入目录名称(长度不能大于50)。"
		founderr=true
	end if
	if Readme<>"" and strLength(request("Readme"))>1000 then
	errmsg=errmsg+"<br>"+"<li>目录描述长度不能大于1000。"
		founderr=true
	end if
	if request("TopCategory")=0 or request("TopCategory")="" then
	errmsg=errmsg+"<br>"+"<li>所属大类不能为空，请选择。"
		founderr=true
	end if
	if request("SubCategory")=0 or request("SubCategory")="" then
	errmsg=errmsg+"<br>"+"<li>所属小类不能为空，请选择。"
		founderr=true
	end if
	if request("IsShell")=2 and request("Readpass")="" then
	errmsg=errmsg+"<br>"+"<li>请输入验证密码(长度1-6位)。"
	founderr=true
	end if
	if founderr=true then exit sub
	sql="select Orders from [Ms_Uphtype] where SubCate="&request("SubCategory")&" and username='"&trim(membername)&"' order by orders desc"''读出相同小分类中排序最大值
	set rs=conn.execute(sql)
	if not (rs.eof and rs.bof) then
		Orders=rs(0)
		else
		Orders=0
	end if
	rs.close
	set rs=server.createobject("adodb.recordset")
	sql="select * from [Ms_Uphtype] where SubCate="&request("SubCategory")&" and username='"&trim(membername)&"' and Phototype='"&Phototype&"'"''判断是否有相同目录名称
	rs.open sql,conn,1,3
	if not (rs.eof and rs.bof) then
	errmsg=errmsg+"<br>"+"<li>对不起，在您相同分类中有相同目录存在。"
	founderr=true
	rs.close
	exit sub
	else
	rs.addnew
	rs("TopCate")=trim(request("TopCategory"))
	rs("SubCate")=trim(request("SubCategory"))
	rs("Phototype")=Phototype
	rs("Username")=trim(membername)
	if Orders<>0 then''判断排序最大值
	rs("Orders")=Orders+1
	else
	rs("Orders")=0
	end if
	if Readme<>"" then''目录介绍是否为空
	rs("Readme")=Readme
	end if
	rs("IsShell")=request("IsShell")
	if request("IsShell")=2 then''判断目录属性是否为半公开
	rs("Readpass")=trim(request("Readpass"))
	end if
	rs("Addtime")=Now()
	rs.update()
	rs.close
	sucmsg=sucmsg+"<br>"+"<div align=center><b>恭喜您，目录创建成功！</b></div>"
	sucmsg=sucmsg+"<br>"+"<div align=center><a href=userphoto.asp?action=Cr_folder>继续创建</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=userphoto.asp>返回</a></div>"
call Mslove_suc()
	end if
end sub

sub Ed_folder()''修改目录
dim id,Phototype,Readme,IsShell,Readpass
id=Checkstr(Trim(Request("id")))
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if

Set Rs=conn.Execute("Select Phototype,Readme,IsShell,Readpass From [Ms_Uphtype] Where Username='"&membername&"' and id="&id&"")
	If Not (Rs.eof or Rs.bof) then
	Phototype=rs(0)
	Readme=rs(1)
	IsShell=rs(2)
	Readpass=rs(3)
	end if
	rs.close%>
<SCRIPT src="inc/category.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function selectChange(control, controlToPopulate, catArray, selectid)
{
  for (var q=controlToPopulate.options.length;q>=0;q--) {
  	controlToPopulate.options[q]=null;
  }
  
  var myEle = document.createElement("OPTION") ;
  myEle.value = 0 ;
  myEle.text = "请选择";
  controlToPopulate.options.add(myEle);
    
	if(control.value != 0) {
		for (var x = 0 ; x < catArray.length  ; x++ ) {
			if ( catArray[x][2] == control.value ) {
				myEle = document.createElement("OPTION") ;
				myEle.value = catArray[x][0] ;
				myEle.text = catArray[x][1];
				controlToPopulate.options.add(myEle) ;
			}
		}//END FOR
	}
	controlToPopulate.value = selectid;
}
function TopCategory(controlToPopulate, catArray, selectid)
{
  for (var q=controlToPopulate.options.length;q>=0;q--) {
  	controlToPopulate.options[q]=null;
  }
  
  var myEle = document.createElement("OPTION") ;
  myEle.value = 0 ;
  myEle.text = "请选择";
  controlToPopulate.options.add(myEle);
   
   //alert(selectid);
  for (var x = 0 ; x < catArray.length; x++ ) {
	if ( catArray[x][2] == 0 ) {
			myEle = document.createElement("OPTION") ;
			myEle.value = catArray[x][0] ;
			myEle.text = catArray[x][1];
			controlToPopulate.options.add(myEle) ;
		}
   }
   controlToPopulate.value = selectid;
}

function check() {
	if(document.forms['theForm'].Phototype.value.length == 0) {
		alert("没有填写目录名称");
		return false;
	}
	if(document.forms['theForm'].SubCategory.value == 0) {
		alert("没有选择目录分类");
		return false;
	}
	return true;
}
//  End -->
</script>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="?action=Ed_folder_s" method=POST name="theForm" onsubmit="return check();">
    <tr align="left"> 
      <th width="60%" height="28"  class=tablebody1><%=membername%> 的相册-修改目录</th>
    </tr>
    <tr align="center"> 
      <td width="100%" height="249" align="left" valign="top"  class=tablebody1>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
          <tr> 
            <td height="32" colspan="2">修改目录</td>
          </tr>
          <tr> 
            <td width="22%" height="30" align="right">目录名称</td>
            <td width="78%"><input name="Phototype" type="text" id="Phototype" size="40" maxlength="200" value="<%=Phototype%>"></td>
          </tr><input name="id" type="hidden"  value="<%=id%>">
          <tr> 
            <td height="28" align="right">目录描述</td>
            <td><textarea name="Readme" cols="50" rows="5" id="Readme"><%=Readme%></textarea></td>
          </tr>
          <tr> 
            <td height="30" align="right">目录分类</td>
            <td><SELECT id="TopCategory" name="TopCategory" onchange="selectChange(this, theForm.SubCategory, catArray, 0);">
			</SELECT>
            子分类
			  <SELECT id="SubCategory" name="SubCategory">
              </SELECT> <font color="#FF6600">建议您将不同类型的照片放在不同的目录中。</font></td>
          </tr>
          <tr> 
            <td height="27">目录属性</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td height="24" align="right">公开目录</td>
            <td><input name="IsShell" type="radio" value="0" <%if IsShell=0 then%>checked<%end if%>>
              完全公开<font color="#666666">(任何人都可以浏览此目录)</font></td>
          </tr>
          <tr> 
            <td height="21" align="right">私人目录</td>
            <td><input type="radio" name="IsShell" value="1" <%if IsShell=1 then%>checked<%end if%>>
              完全私有<font color="#666666">(只有您自己可以浏览此目录) </font></td>
          </tr>
          <tr> 
            <td height="23" align="right">半公开目录</td>
            <td><input type="radio" name="IsShell" value="2" <%if IsShell=2 then%>checked<%end if%>>
              需要密码验证 <font color="#FF0000">密码：</font> 
              <input name="Readpass" type="text" id="Readpass" size="10" maxlength="6" value="<%=Readpass%>">
              <font color="#666666">(长度1-6位英文及数字)</font></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr align="center">
      <td  class=tablebody1><input type="submit" name="Submit" value="修改目录"></td>
    </tr>
    <tr align="center"> 
      <td width="100%"  class=tablebody1 align="left">&nbsp;</td>
    </tr>
  </form>
</table>
<script>
TopCategory(document.getElementById('TopCategory'), catArray, '0');
selectChange(document.getElementById('TopCategory'), document.getElementById('SubCategory'), catArray, '0')
</script>
<%
end sub

sub Ed_folder_s()''修改保存目录
dim id
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
end if
id=Checkstr(Trim(Request("id")))
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if
dim Phototype,Readme,Orders
	Phototype=checkStr(trim(Request("Phototype")))
	Readme=checkStr(trim(Request("Readme")))
	if Phototype="" or strLength(request("Phototype"))>50 then
		errmsg=errmsg+"<br>"+"<li>请输入目录名称(长度不能大于50)。"
		founderr=true
	end if
	if Readme<>"" and strLength(request("Readme"))>1000 then
	errmsg=errmsg+"<br>"+"<li>目录描述长度不能大于1000。"
		founderr=true
	end if
	if request("TopCategory")=0 or request("TopCategory")="" then
	errmsg=errmsg+"<br>"+"<li>所属大类不能为空，请选择。"
		founderr=true
	end if
	if request("SubCategory")=0 or request("SubCategory")="" then
	errmsg=errmsg+"<br>"+"<li>所属小类不能为空，请选择。"
		founderr=true
	end if
	if request("IsShell")=2 and request("Readpass")="" then
	errmsg=errmsg+"<br>"+"<li>请输入验证密码(长度1-6位)。"
	founderr=true
	end if
	if founderr=true then exit sub
	set rs=server.createobject("adodb.recordset")
	sql="select * from [Ms_Uphtype] where username='"&trim(membername)&"' and id="&id&""''判断是否有相同目录名称
	rs.open sql,conn,1,3
	if not (rs.eof and rs.bof) then
	rs("TopCate")=trim(request("TopCategory"))
	rs("SubCate")=trim(request("SubCategory"))
	rs("Phototype")=Phototype
	rs("Username")=trim(membername)
	if Readme<>"" then''目录介绍是否为空
	rs("Readme")=Readme
	end if
	rs("IsShell")=request("IsShell")
	if request("IsShell")=2 then''判断目录属性是否为半公开
	rs("Readpass")=trim(request("Readpass"))
	end if
	rs.update()
	rs.close
	sucmsg=sucmsg+"<br>"+"<div align=center><b>恭喜您，目录修改成功！</b></div>"
call Mslove_suc()
	end if
end sub

sub upload_loc()''本地上传表单
dim id
if Cint(GroupSetting(61))=0 or Cint(GroupSetting(63))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有本地上传照片的权限，请升级等级再来上传。"
   	FoundErr=True
	exit sub
end if
if Cint(GroupSetting(64))<>0 and UpnumLorn1>=Cint(GroupSetting(64)) then
	ErrMsg=ErrMsg+"<Br>"+"<li>您只能上传:"&GroupSetting(64)&"张照片。"
   	FoundErr=True
	exit sub
end if
id=Checkstr(Trim(Request("id")))
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if
%>
<form action="?action=upload_loc_s" method=post name=theForm>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
    <input type=hidden name="id" value="<%=id%>">
    <tr> 
      <th height="24" colspan="2" align="center">本地上传图片</th>
    </tr>
    <tr> 
      <td width="18%" height="77" align="center" class=tablebody1>上传说明</td>
      <td width="82%" height="77" class=tablebody1>1、您目前是 
        <%if myvip>0 then
    response.write "<font color=red><b>VIP会员</b></font>"
    else
    response.write "<b>普通会员</b>"
    end if
    %>
        ，可本地上传 <font color="red"><b><%if Cint(GroupSetting(64))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(64))
		end if%></b></font> 张图片，您还可以本地上传 
        <font color="red"><b><%if Cint(GroupSetting(64))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(64)-UpnumLorn1)
		end if%></b></font> 张图片。<br>
        2、您只能上传后缀名为<%=GroupSetting(79)%>的图片文件，文件大小应不超过<%=GroupSetting(80)%>kb<br>
        3、交友图片目前分为两个类型：影集图片和形象照。形象照只能是本人单身照片，卡通、风景等请上传到影集中。<br>
        4、您上传的图片将由<%=webname%>审核后再公开，<a href=agreement.asp?id=6 target=_blank><font color="#FF0000">图片详细审核标准</font></a>。<br>
        5、您必须在影集中选择一张真实图片设置为形象照，否则您的个人资料（征婚消息）中将无照片显示。<br>
        6、本地上传金钱/篇 <b><%=GroupSetting(65)%> <%=GroupSetting(66)%></b> 元  本地上传魅力/篇 <b><%=GroupSetting(67)%> <%=GroupSetting(68)%></b> 点  本地上传经验/篇 <b><%=GroupSetting(69)%> <%=GroupSetting(70)%></b> 点  </td>
    </tr>
    <%dim filetypes
	if GroupSetting(79)<>"" then
	filetypes=split(GroupSetting(79),"|")
	else
	filetypes=0
	end if
	%>
    <tr> 
      <td height="24" align="center" class=tablebody1>文件上传 <a onMouseOver="showmenu(event,'<%for i=0 to ubound(filetypes)
	  response.write("<div class=menuitems><a href=#>"&filetypes(i)&"</a></div>")
	  next%>')" style="CURSOR:pointer" title="查看可上传的文件类型" >类型</a></td>
      <td height="24" class=tablebody1><iframe name=ad frameborder=0 width=100% height=24 scrolling=no src="photo_upload.asp"></iframe></td>
    </tr>
	    <%if Cint(Codeshow(7))=1 then%>
    <tr> 
      <td height="27" align="center"  class=tablebody1>检验码：</td>
      <td align="left"  class=tablebody1> <input type="text" name="codestr" maxlength="4" size="4"> 
        &nbsp;<%=GetCode()%>&nbsp;</td>
    </tr>
    <%end if%>
	<tr> 
      <td height="-2" align="center" class=tablebody1>图片地址：</td>
      <td height="12" align="left" class=tablebody1><input name="Filename" type=text id="Filename" size="40" maxlength="200" readonly>
        <font color="#FF0000">(不要修改图片地址)</font></td>
    </tr>

    <tr> 
      <td height="-2" align="center" class=tablebody1>是否公开：</td>
      <td height="12" align="left" class=tablebody1> <input name="Ispublic" type="radio" value="1" checked>
        是 
        <input name="Ispublic" type="radio" value="0">
        否</td>
    </tr>
    <tr> 
      <td height="0" align="center" class=tablebody1>形 象 照：</td>
      <td height="26" align="left" class=tablebody1><input type="radio" name="Bodypic" value="1">
        是 
        <input name="Bodypic" type="radio" value="0" checked>
        否</td>
    </tr>
    <tr> 
      <td height="12" align="center" class=tablebody1>简要说明：</td>
      <td height="12" align="left" class=tablebody1><textarea name="Readme" cols="60" rows="5"></textarea> 
        <br>
        图片说明不能大于50个字符。</td>
    </tr>
    <tr> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr>
  </table>
</form>
<%end sub

sub upload_loc_s()''本地上传保存
dim Filename,Readme,id,orders
Filename=checkStr(Request("Filename"))
Readme=checkStr(Request("Readme"))
id=checkStr(Request("id"))
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
end if
if id="" or not isnumeric(id) then
errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
end if
if Cint(Codeshow(7))=1 then
	if Not CodeIsTrue() then
		errmsg=errmsg+"<br>"+"<li>验证码校验失败，请返回刷新页面后再输入验证码。"
		founderr=true
	end if
end if
if Cint(GroupSetting(61))=0 then
		errmsg=errmsg+"<br>"+"<li>你没有本地上传的权限，请与管理员联系。"
		founderr=true
end if
if Cint(GroupSetting(63))=0 then
		errmsg=errmsg+"<br>"+"<li>您没有建立相册的权限，请与管理员联系。"
		founderr=true
end if
if Filename="" or strLength(Filename)>50 then
				errmsg=errmsg+"<br>"+"<li>上传照片名称为空或者长度大于50个字符。"
				founderr=true
end if
if not isInteger(trim(Request("Ispublic"))) then
				errmsg=errmsg+"<br>"+"<li>请选择是否公开。"
				founderr=true
end if
if not isInteger(trim(Request("Bodypic"))) then
				errmsg=errmsg+"<br>"+"<li>请选择是否是形象照。"
				founderr=true
end if
if Readme="" or strLength(Readme)>50 then
				errmsg=errmsg+"<br>"+"<li>照片简要说明为空或者长度大于50个字符。"
				founderr=true
end if
if Chkvalue(1,GroupSetting(65),Cint(GroupSetting(66)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(67),Cint(GroupSetting(68)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(69),Cint(GroupSetting(70)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
if founderr=true then exit sub
	sql="select Orders from [Ms_Upphoto] where username='"&trim(membername)&"' and FTypes="&id&" order by orders desc"''读出相同小分类中排序最大值
	set rs=conn.execute(sql)
	if not (rs.eof and rs.bof) then
		Orders=rs(0)
		else
		Orders=0
	end if
	rs.close
set rs=server.createobject("adodb.recordset")
sql="select FTypes,Readme,Ispublic,Flag,Bodypic,Orders,Checked from [Ms_Upphoto] where Username='"&trim(membername)&"' and Filename='"&Filename&"'"
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
rs("FTypes")=id
rs("Readme")=Readme
rs("Ispublic")=trim(Request("Ispublic"))
rs("Flag")=1
rs("Orders")=(Orders+1)
rs("Bodypic")=trim(Request("Bodypic"))
if Cint(GroupSetting(83))=1 then
rs("Checked")=1
end if
rs.update
rs.close

	if trim(Request("Bodypic"))=1 then'更新数据库数据库
	conn.execute("Update Ms_User set UserPhoto='"&Filename&"' where Userid="&Userid&"")
	end if
		conn.execute("Update Ms_setup set Uploadph=Uploadph+1 where Cid=1")
conn.execute("update Ms_user set UserPics=UserPics+1,UserWealth=UserWealth "&GroupSetting(65)&Cint(GroupSetting(66))&",UserEP=UserEP "&GroupSetting(67)&Cint(GroupSetting(68))&",UserCP=UserCP "&GroupSetting(69)&Cint(GroupSetting(70))&" where Userid="&Userid&"")
	conn.execute("Update Ms_Uphtype set Allpic=Allpic+1 where id="&id&"")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功上传照片。"
		call Mslove_suc()
else
	errmsg=errmsg+"<br>"+"<li>数据库中没有照片记录。"
	founderr=true
	exit sub
end if
end sub

sub upload_net()''添加网络图片
dim id
id=Checkstr(Trim(Request("id")))
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if
if Cint(GroupSetting(62))=0 or Cint(GroupSetting(63))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有网络照片添加的权限，请升级等级再来添加。"
   	FoundErr=True
	exit sub
end if
if cint(GroupSetting(71))<>0 and UpnumLorn0>=cint(GroupSetting(71)) then
	ErrMsg=ErrMsg+"<Br>"+"<li>您只能添加"&GroupSetting(71)&"张网络照片。"
   	FoundErr=True
	exit sub
end if%>
<form action="?action=upload_net_s" method=post name=theForm>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
    <input type=hidden name="id" value="<%=id%>">
    <tr> 
      <th height="24" colspan="2" align="center">添加网络图片</th>
    </tr>
    <tr> 
      <td height="77" align="center" class=tablebody1>网络图片</td>
      <td height="77" class=tablebody1>1、您目前是 
        <%if myvip>0 then
    response.write "<font color=red><b>VIP会员</b></font>"
    else
    response.write "<b>普通会员</b>"
    end if
    %>
        ，网络图片可以添加 <font color="red"><b><%if Cint(GroupSetting(71))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(71))
		end if%></b></font> 张图片，您还可以本地上传 
        <font color="red"><b><%if Cint(GroupSetting(71))=0 then
		response.Write("不限")
		else
		response.Write(GroupSetting(71)-UpnumLorn1)
		end if%></b></font> 张图片。<br>
        2、您只能添加网络图片后缀名为<%=GroupSetting(79)%>的图片文件。<br>
        3、交友图片目前分为两个类型：影集图片和形象照。形象照只能是本人单身照片，卡通、风景等请上传到影集中。<br>
        4、您添加的网络图片将由<%=webname%>审核后再公开，<a href=agreement.asp?id=6 target=_blank><font color="#FF0000">图片详细审核标准</font></a>。<br>
        5、您必须在影集中选择一张真实图片设置为形象照，否则您的个人资料（征婚消息）中将无照片显示。<br>
        6、网络上传金钱/篇 <b><%=GroupSetting(72)%> <%=GroupSetting(73)%></b> 元  网络上传魅力/篇 <b><%=GroupSetting(74)%> <%=GroupSetting(75)%></b> 点  网络上传经验/篇 <b><%=GroupSetting(76)%> <%=GroupSetting(77)%></b> 点。 <br>
        7、请用http://或ftp://或https://开头的完整链接地址。</td>
    </tr>
    <tr> 
      <td width="20%" height="6" align="center" class=tablebody1>图片地址：</td>
      <td width="80%" align="left" class=tablebody1><input name="Filename" type=text id="Filename" size=40>
        （请填写完成的文件链接地址） </td>
    </tr>
    <tr>
      <td width="20%" height="6" align="center" class=tablebody1>缩略地址：</td>
      <td align="left" class=tablebody1><input name="Preimage" type="text" id="Preimage" size="40">
        （如果没有缩略图，请复制上面地址） </td>
    </tr>
		    <%if Cint(Codeshow(7))=1 then%>
    <tr> 
      <td height="27" align="center"  class=tablebody1>检验码：</td>
      <td align="left"  class=tablebody1> <input type="text" name="codestr" maxlength="4" size="4"> 
        &nbsp;<%=GetCode()%>&nbsp;</td>
    </tr>
    <%end if%>
    <tr> 
      <td height="-2" align="center" class=tablebody1>是否公开：</td>
      <td height="12" align="left" class=tablebody1> <input name="Ispublic" type="radio" value="1" checked>
        是 
        <input name="Ispublic" type="radio" value="0">
        否</td>
    </tr>
    <tr> 
      <td height="0" align="center" class=tablebody1>形 象 照：</td>
      <td height="26" align="left" class=tablebody1><input type="radio" name="Bodypic" value="1">
        是 
        <input name="Bodypic" type="radio" value="0" checked>
        否</td>
    </tr>
    <tr> 
      <td height="12" align="center" class=tablebody1>简要说明：</td>
      <td height="12" align="left" class=tablebody1><textarea name="Readme" cols="60" rows="5"></textarea> 
        <br>
        图片说明不能大于50个字符。</td>
    </tr>
    <tr> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr>
  </table>
</form>
<%end sub

sub upload_net_s()''保存网络数据
dim id
id=Checkstr(Trim(Request("id")))
if id="" or not isnumeric(id) then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
	exit sub
else
id=clng(id)
end if
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
end if

if Cint(Codeshow(7))=1 then
	if Not CodeIsTrue() then
		errmsg=errmsg+"<br>"+"<li>验证码校验失败，请返回刷新页面后再输入验证码。"
		founderr=true
	end if
end if
dim Filename,Readme,Userupnum,Preimage
if Cint(GroupSetting(62))=0 or Cint(GroupSetting(63))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有网络照片添加的权限，请升级等级再来添加。"
   	FoundErr=True
end if
if cint(GroupSetting(71))<>0 and UpnumLorn0>=cint(GroupSetting(71)) then
	ErrMsg=ErrMsg+"<Br>"+"<li>您只能添加"&GroupSetting(71)&"张网络照片。"
   	FoundErr=True
end if
Filename=checkStr(Request("Filename"))
Readme=checkStr(Request("Readme"))
Preimage=checkStr(Request("Preimage"))
if Filename="" or strLength(Filename)>250 then
				errmsg=errmsg+"<br>"+"<li>网络照片地址为空或者长度大于250个字符。"
				founderr=true
end if
if Preimage="" or strLength(Preimage)>250 then
				errmsg=errmsg+"<br>"+"<li>网络缩略地址为空或者长度大于250个字符。"
				founderr=true
end if
if not isInteger(trim(Request("Ispublic"))) then
				errmsg=errmsg+"<br>"+"<li>请选择是否公开。"
				founderr=true
end if
if not isInteger(trim(Request("Bodypic"))) then
				errmsg=errmsg+"<br>"+"<li>请选择是否是形象照。"
				founderr=true
end if
if Readme="" or strLength(Readme)>50 then
				errmsg=errmsg+"<br>"+"<li>照片简要说明为空或者长度大于50个字符。"
				founderr=true
end if
if Chkvalue(1,GroupSetting(72),Cint(GroupSetting(73)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(74),Cint(GroupSetting(75)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(76),Cint(GroupSetting(77)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
if founderr=true then exit sub
set rs=server.createobject("adodb.recordset")
sql="select * from [Ms_Upphoto] where Username='"&trim(membername)&"' and Filename='"&Filename&"'"
rs.open sql,conn,1,3
if rs.eof or rs.bof then
rs.addnew
rs("UserID")=UserID
rs("Username")=trim(membername)
rs("Filename")=Filename
rs("FileTypes")=right(Filename,3)
rs("FTypes")=id
rs("Viewname")=Preimage
rs("FileSize")=50
rs("Readme")=Readme
rs("Ispublic")=trim(Request("Ispublic"))
rs("Flag")=1
rs("Bodypic")=trim(Request("Bodypic"))
if Cint(GroupSetting(83))=1 then
rs("Checked")=1
end if
rs.update
rs.close

	if trim(Request("Bodypic"))=1 then'更新数据库数据库
	conn.execute("Update Ms_User set UserPhoto='"&Filename&"' where Userid="&Userid&"")
	end if
	conn.execute("Update Ms_setup set Uploadph=Uploadph+1 where Cid=1")
	conn.execute("update Ms_user set UserPics=UserPics+1,UserWealth=UserWealth "&GroupSetting(72)&Cint(GroupSetting(73))&",UserEP=UserEP "&GroupSetting(74)&Cint(GroupSetting(75))&",UserCP=UserCP "&GroupSetting(76)&Cint(GroupSetting(77))&" where Userid="&Userid&"")
	conn.execute("Update Ms_Uphtype set Allpic=Allpic+1 where id="&id&"")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功添加网络照片。"
		call Mslove_suc()
else
	errmsg=errmsg+"<br>"+"<li>您的数据库中已经存在相同照片记录。"
	founderr=true
	exit sub
end if
end sub

sub setface()''设置照片封面
if Cint(GroupSetting(78))=0 then
				errmsg=errmsg+"<br>"+"<li>您没有打开/关闭自己相册权限，请升级等级之后再来操作。"
				founderr=true
				exit sub
end if
dim Fid,setface,Ftypes
Fid=trim(request("Fid"))
Ftypes=trim(request("Ftypes"))
if Fid="" or not isInteger(trim(Request("Fid"))) then
				errmsg=errmsg+"<br>"+"<li>照片参数错误。"
				founderr=true
end if
if Ftypes="" or not isInteger(trim(Request("Ftypes"))) then
				errmsg=errmsg+"<br>"+"<li>照片类别参数错误。"
				founderr=true
end if
if founderr=true then exit sub
sql="select Viewname from [Ms_Upphoto] where Username='"&trim(membername)&"' and Fid="&Fid&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
setface=rs(0)
else
errmsg=errmsg+"<br>"+"<li>照片不存在。"
				founderr=true
				exit sub
end if
rs.close

conn.execute("Update Ms_Uphtype set Isphoto='"&setface&"' where Username='"&trim(membername)&"' and id="&Ftypes&"")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功设置照片为封面。"
		call Mslove_suc()
end sub

sub setBody()''设置照片为形象照与否
dim Bodypic,Fid,Userphoto
Bodypic=trim(request("Bodypic"))
Fid=trim(request("Fid"))
if Bodypic="" or not isInteger(trim(Request("Bodypic"))) then
				errmsg=errmsg+"<br>"+"<li>参数错误。"
				founderr=true
end if
if Fid="" or not isInteger(trim(Request("Fid"))) then
				errmsg=errmsg+"<br>"+"<li>照片参数错误。"
				founderr=true
end if
if founderr=true then exit sub
conn.execute("Update Ms_Upphoto set Bodypic="&Bodypic&" where Userid="&Userid&" and Fid="&Fid&"")
set rs=server.createobject("adodb.recordset")
sql="select Filename from [Ms_Upphoto] where UserID="&UserID&" and Fid="&Fid&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Userphoto=rs(0)
end if
rs.close
if Bodypic=1 then
conn.execute("Update Ms_User set UserPhoto='"&Userphoto&"' where Userid="&Userid&"")
else
conn.execute("Update Ms_User set UserPhoto=null where Userid="&Userid&"")
end if
if Bodypic=0 then
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功取消形象照。"
else
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功设置照片为形象照。"
end if
		call Mslove_suc()
end sub

sub Alldelet()''清空相册
dim Userupnums,Ftypes
if Cint(GroupSetting(82))=0 then
	errmsg=errmsg+"<br>"+"<li>您没有删除自己相册的权限，请升级等级。"
	founderr=true
	exit sub
end if
Ftypes=trim(request("Ftypes"))
sql="select count(FID) from [Ms_Upphoto] where UserID="&UserID&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Userupnums=rs(0)
else
Userupnums=0
end if
rs.close
dim D_Filename,D_Viewname,objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		set rs=Conn.Execute("select Fid,LorN,Filename,Viewname from Ms_Upphoto where Userid="&Userid&"")
				if not (rs.eof and rs.bof) then
					do while not rs.eof
					if rs(1)=0 then''判断是否为本地上传
						conn.execute("delete from Ms_Upphoto where Userid="&Userid&"")
					else''本地上传删除本地文件
						D_Filename=rs(2)
						D_Viewname=rs(3)
						if objFSO.fileExists(Server.MapPath(SaveUpFilesPath&D_Filename)) then
							objFSO.DeleteFile(Server.MapPath(SaveUpFilesPath&D_Filename))
						End if
						if objFSO.fileExists(Server.MapPath(UpfilePreview&D_Viewname)) then
							objFSO.DeleteFile(Server.MapPath(UpfilePreview&D_Viewname))
						End if
						conn.execute("delete from Ms_Upphoto where Userid="&Userid&"")
					end if
					rs.movenext
					loop
				end if
				rs.close
	conn.execute("update Ms_user set UserPhoto=null,UserPics=0,UserWealth=UserWealth-("&GroupSetting(72)&(Cint(GroupSetting(73))*Userupnums)&"),UserEP=UserEP-("&GroupSetting(74)&(Cint(GroupSetting(75))*Userupnums)&"),UserCP=UserCP-("&GroupSetting(76)&(Cint(GroupSetting(77))*Userupnums)&") where Userid="&Userid&"")
	conn.execute("Update Ms_setup set Uploadph=Uploadph-"&Userupnums&" where Cid=1")
	conn.execute("Update Ms_Uphtype set Allpic=0 where id="&Ftypes&"")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功清空相册。"
	call Mslove_suc()
end sub

sub delet()''删除选定相册
if Cint(GroupSetting(82))=0 then
	errmsg=errmsg+"<br>"+"<li>您没有删除自己相册的权限，请升级等级。"
	founderr=true
	exit sub
end if
dim delid,FixID,Splitnum,Maxnum,Ftypes
Ftypes=trim(request("Ftypes"))
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"错误的参数。"
Founderr=true
end if
Splitnum=split(delid,",")
Maxnum=ubound(Splitnum)
if founderr=true then exit sub
dim D_Filename,D_Viewname,objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		set rs=Conn.Execute("select Fid,LorN,Filename,Viewname from Ms_Upphoto where Fid in ("&delid&")")
				if not (rs.eof and rs.bof) then
					do while not rs.eof
					if rs(1)=0 then''判断是否为本地上传
						conn.execute("delete from Ms_Upphoto where Userid="&Userid&" and Fid in("&delid&")")
					else''本地上传删除本地文件
						D_Filename=rs(2)
						D_Viewname=rs(3)
						if objFSO.fileExists(Server.MapPath(SaveUpFilesPath&D_Filename)) then
							objFSO.DeleteFile(Server.MapPath(SaveUpFilesPath&D_Filename))
						End if
						if objFSO.fileExists(Server.MapPath(UpfilePreview&D_Viewname)) then
							objFSO.DeleteFile(Server.MapPath(UpfilePreview&D_Viewname))
						End if
						conn.execute("delete from Ms_Upphoto where Userid="&Userid&" and Fid in("&delid&")")
					end if
					rs.movenext
					loop
				end if
				rs.close
	conn.execute("update Ms_user set UserPhoto=null,UserPics=UserPics-"&(Maxnum+1)&",UserWealth=UserWealth-("&GroupSetting(72)&(Cint(GroupSetting(73))*(Maxnum+1))&"),UserEP=UserEP-("&GroupSetting(74)&(Cint(GroupSetting(75))*(Maxnum+1))&"),UserCP=UserCP-("&GroupSetting(76)&(Cint(GroupSetting(77))*(Maxnum+1))&") where Userid="&Userid&"")
	conn.execute("Update Ms_setup set Uploadph=Uploadph-"&(Maxnum+1)&" where Cid=1")
	conn.execute("Update Ms_Uphtype set Allpic=Allpic-"&(Maxnum+1)&" where id="&Ftypes&"")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功删除相册。"
	call Mslove_suc()
end sub


sub moveph()''移动相册
dim Ftypes,delid,FixID
Ftypes=trim(request("Ftypes"))
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"错误的参数。"
Founderr=true
end if
if founderr=true then exit sub%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="?action=Mo_photo_s" method=POST name="theForm">
    <tr align="left"> 
      <th width="100%" height="28"  class=tablebody1><%=membername%> 的相册-移动相册</th>
    </tr>
    <tr align="center"> 
      <td width="100%" align="left" valign="top"  class=tablebody1> 
        <table width="100%" border="0" cellspacing="3" cellpadding="3">
          <tr> 
            <td height="32" colspan="2">移动相册</td>
          </tr>
          <tr> 
            <td width="22%" height="30" align="right">目录名称</td>
            <td width="78%"><select name="Ptypeid" id="Ptypeid">
                <%sql="select Phototype,id from [Ms_Uphtype] where Username='"&membername&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
do while not rs.eof%>
                <option value="<%=rs(1)%>" <%if Ftypes=rs(1) then%>selected <%end if%>><%=rs(0)%></option>
                <%rs.movenext
loop
end if
rs.close%>
              </select></td>
          </tr>
          <tr> 
            <td height="28" align="right">选定照片</td>
            <td><input name="photoid" type="text" id="photoid" value="<%=delid%>" size="40"></td><input name="Ftypes" type="hidden" id="Ftypes" value="<%=Ftypes%>">
          </tr>
        </table>
      </td>
    </tr>
    <tr align="center"> 
      <td  class=tablebody1><input type="submit" name="Submit" value="移动照片"></td>
    </tr>
  </form>
</table>
<%end sub

sub Mo_photo_s()''保存移动相册
dim Ptypeid,photoid,splitphid,Ftypes
Ptypeid=checkStr(Request("Ptypeid"))
photoid=checkStr(Request("photoid"))
Ftypes=checkStr(Request("Ftypes"))
if Ptypeid="" or not isnumeric(Ptypeid) then
	errmsg=errmsg+"<br>"+"<li>请选择相册类别。"
	founderr=true
end if
if Ftypes="" or not isnumeric(Ftypes) then
	errmsg=errmsg+"<br>"+"<li>请选择相册类别。"
	founderr=true
end if
if photoid="" then
	errmsg=errmsg+"<br>"+"<li>没有选择照片。"
	founderr=true
else
photoid=replace(request("photoid"),"'","")
photoid=replace(photoid,";","")
photoid=replace(photoid,"--","")
photoid=replace(photoid,")","")
end if
splitphid=split(photoid,",")
splitphid=ubound(splitphid)
if founderr=true then exit sub
conn.execute("Update Ms_Uphtype set Allpic=Allpic-"&(splitphid+1)&" where ID ="&Ftypes&"")
conn.execute("Update Ms_Uphtype set Allpic=Allpic+"&(splitphid+1)&" where ID ="&Ptypeid&"")
conn.execute("Update Ms_Upphoto set FTypes="&Ptypeid&" where FID in("&photoid&")")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功移动相册。"
		call Mslove_suc()
end sub

sub Setphoto()''审核相册
dim delid,FixID,ck
if not (master and supermaster and standmaster) then
if Cint(GroupSetting(121))=0 then
	errmsg=errmsg+"<br>"+"<li>您没有审核撤消约会的权限，请联系管理员。"
	founderr=true
end if
end if
ck=checkStr(Request("ck"))
if ck="" or not isnumeric(ck) then
	errmsg=errmsg+"<br>"+"<li>请选择执行操作的项目。"
	founderr=true
end if
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"错误的参数。"
Founderr=true
end if
if founderr=true then exit sub
conn.execute("Update Ms_Upphoto set Checked="&ck&" where FID in("&delid&")")
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功执行操作。"
		call Mslove_suc()
end sub

sub edit_ph()''修改照片
if Cint(GroupSetting(81))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有编辑照片的权限。"
   	FoundErr=True
	exit sub
end if
dim Fid,oldftype
Fid=trim(Request("Fid"))
if Fid="" or not isInteger(trim(Request("Fid"))) then
				errmsg=errmsg+"<br>"+"<li>照片参数错误。"
				founderr=true
end if
oldftype=Cint(trim(Request("oldftype")))
if founderr=true then exit sub
sql="select * from [Ms_Upphoto] where UserID="&UserID&" and Fid="&Fid&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
%>
<form action="?action=edit_ph_s" method=post name=theForm>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<input type=hidden name="Fid" value=<%=Fid%>>
    <tr> 
      <th height="24" colspan="2" align="center">编辑图片</th>
    </tr>
    <tr> 
      <td width="20%" height="13" align="center" class=tablebody1>图片地址：</td>
      <td width="80%" align="left" class=tablebody1><input name="Filename" type=text id="Filename" size=50 value=<%=rs("Filename")%>>
      </td>
    </tr>
    <tr> 
      <td width="20%" height="13" align="center" class=tablebody1>缩略地址：</td>
      <td width="80%" align="left" class=tablebody1><input name="Preimage" type=text id="Preimage" size=50 value=<%=rs("viewname")%>>
      </td>
    </tr>
			    <%if Cint(Codeshow(7))=1 then%>
    <tr> 
      <td height="27" align="center"  class=tablebody1>检验码：</td>
      <td align="left"  class=tablebody1> <input type="text" name="codestr" maxlength="4" size="4"> 
        &nbsp;<%=GetCode()%>&nbsp;</td>
    </tr>
    <%end if%>
    <tr> <input type="hidden" name="oldftype" value=<%=oldftype%>> 
      <td height="-2" align="center" class=tablebody1>是否公开：</td>
      <td height="12" align="left" class=tablebody1> <input name="Ispublic" type="radio" value="1" <%if rs("Ispublic")=1 then%>checked<%end if%>>
        是 
        <input name="Ispublic" type="radio" value="0" <%if rs("Ispublic")=0 then%>checked<%end if%>>
        否</td>
    </tr>
    <tr> 
      <td height="-1" align="center" class=tablebody1>图片类型：</td>
      <td height="13" align="left" class=tablebody1>
	  <select name="Ftypes" size="1" id="Ftypes">
	  <option value="0" selected>选择图片类型</option>
	  <%dim rst
	  set rst=server.createobject("adodb.recordset")
	sql="select Phototype,id from Ms_Uphtype where IsShell=0 order by Orders asc,id"
	rst.Open sql,conn,1,1
if not (rst.eof and rst.bof) then
do while not rst.eof%>
          <option value=<%=rst(1)%> <%if rs("Ftypes")=rst(1) then%>selected<%end if%>><%=rst(0)%></option>
<%rst.movenext
loop
else
response.Write("<option>无分类</option>")
end if
rst.close%>
        </select></td>
    </tr>
    <tr> 
      <td height="0" align="center" class=tablebody1>形 象 照：</td>
      <td height="26" align="left" class=tablebody1><input type="radio" name="Bodypic" value="1" <%if rs("Bodypic")=1 then%>checked<%end if%>>
        是 
        <input name="Bodypic" type="radio" value="0" <%if rs("Bodypic")=0 then%>checked<%end if%>>
        否</td>
    </tr>
    <tr> 
      <td height="12" align="center" class=tablebody1>简要说明：</td>
      <td height="12" align="left" class=tablebody1><textarea name="Readme" cols="60" rows="5"><%=Rs("Readme")%></textarea> 
        <br>
        图片说明不能大于50个字符。</td>
    </tr>
    <tr> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr>
  </table>
</form>
<%end if
rs.close
end sub

sub edit_ph_s()''保存修改照片
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
end if

if Cint(Codeshow(7))=1 then
	if Not CodeIsTrue() then
		errmsg=errmsg+"<br>"+"<li>验证码校验失败，请返回刷新页面后再输入验证码。"
		founderr=true
	end if
end if
if Cint(GroupSetting(81))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有编辑照片的权限。"
   	FoundErr=True
	exit sub
end if
dim Fid,Filename,Readme,Preimage,oldftype
Fid=checkStr(Request("Fid"))
Filename=checkStr(Request("Filename"))
Readme=checkStr(Request("Readme"))
Preimage=checkStr(Request("Preimage"))
oldftype=checkStr(Request("oldftype"))
if Fid="" or not isInteger(trim(Request("Fid"))) then
				errmsg=errmsg+"<br>"+"<li>参数错误。"
				founderr=true
end if
if Filename="" or strLength(Filename)>250 then
				errmsg=errmsg+"<br>"+"<li>照片地址为空或者长度大于250个字符。"
				founderr=true
end if
if Preimage="" or strLength(Preimage)>250 then
				errmsg=errmsg+"<br>"+"<li>网络缩略地址为空或者长度大于250个字符。"
				founderr=true
end if
if not isInteger(trim(Request("Ispublic"))) then
				errmsg=errmsg+"<br>"+"<li>请选择是否公开。"
				founderr=true
end if
if not isInteger(trim(Request("Ftypes"))) or trim(Request("Ftypes"))=0 then
				errmsg=errmsg+"<br>"+"<li>请选择照片类型。"
				founderr=true
end if
if not isInteger(trim(Request("Bodypic"))) then
				errmsg=errmsg+"<br>"+"<li>请选择是否是形象照。"
				founderr=true
end if
if Readme="" or strLength(Readme)>50 then
				errmsg=errmsg+"<br>"+"<li>照片简要说明为空或者长度大于50个字符。"
				founderr=true
end if
if founderr=true then exit sub
set rs=server.createobject("adodb.recordset")
sql="select * from [Ms_Upphoto] where Username='"&trim(membername)&"' and Fid="&Fid&""
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
rs("Filename")=Filename
rs("FileTypes")=right(Filename,3)
rs("FTypes")=Cint(trim(Request("Ftypes")))
rs("Readme")=Readme
rs("Ispublic")=Cint(trim(Request("Ispublic")))
rs("Flag")=1
rs("Viewname")=Preimage
rs("Bodypic")=Cint(trim(Request("Bodypic")))
rs.update
rs.close
if oldftype<>trim(Request("Ftypes")) then''更改类别之后统计照片数
conn.execute("Update Ms_Uphtype set Allpic=Allpic-1 where id="&oldftype&"")
conn.execute("Update Ms_Uphtype set Allpic=Allpic+1 where id="&Clng(trim(Request("Ftypes")))&"")
end if
	if trim(Request("Bodypic"))=1 then'更新数据库数据库
	if not (master and standmaster and supermaster) then
		conn.execute("Update Ms_User set UserPhoto='"&Filename&"' where Userid="&Userid&"")
	end if
	end if
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功修改照片。"
		call Mslove_suc()
else
	errmsg=errmsg+"<br>"+"<li>您的数据库中不存在照片记录。"
	founderr=true
	exit sub
end if
end sub

sub del_order()''删除目录
dim delid,FixID
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"错误的参数。"
Founderr=true
end if
if founderr=true then exit sub
conn.execute("delete from Ms_Uphtype where Username='"&trim(membername)&"' and id in("&delid&")")
conn.execute("delete from Ms_Upphoto where Username='"&trim(membername)&"' and FTypes in("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功删除所选目录。"
	call Mslove_suc()
end sub%>