<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!-- #include file="inc/dv_clsother.asp" -->
<!-- #include File="inc/Upload_Class.asp" -->
<!--#include file="plus_marry_conn.asp"-->

<%
dim i,delold
Dvbbs.BoardID=0
Dvbbs.LoadTemplates("index")
Dvbbs.stats="更换合影"
Dvbbs.nav()
Dvbbs.head_var 2,0,"","" 
if Cint(Dvbbs.GroupSetting(14))=0 then
	sendmsg="<BR><li>您没有进入本社区礼堂的权限，请<a href=login.asp>登陆</a>或者同管理员联系。"
	send_msg()
Else
      call marry_nav()
	Call main()
	response.write          "<Br></td><tr></table></div>"
End if
Dvbbs.footer()



sub main


Select Case request("action")
     
	case "lovecphoto"
	      call lovecphoto()
	         
	case "lovesphoto"
	      call lovesphoto()
	       Send_Msg()    
    case "uplovephoto"
	      call uplovephoto()
	       Send_Msg()  
    
	case "marrycphoto"
	      call marrycphoto()
	         
	case "marrysphoto"
	      call marrysphoto()
	       Send_Msg()  
    case "upmarryphoto"
	      call upmarryphoto()
	       Send_Msg() 		        
	Case Else
		  Response.End

	End Select 

end sub


'===========================================LOVE照改变
sub lovecphoto()
dim j,name7,rsm7,sqlm7
  j=Dvbbs.CheckStr(request("id"))
   %>


   <DIV ALIGN="center">
   <table BACKGROUND="Dv_plus/marry/b01.jpg" WIDTH="760" HEIGHT="100" BORDERCOLORLIGHT="#FF00FF" BORDERCOLORDARK="#FF00FF" BORDER="1" STYLE="border-collapse: collapse">   
           <TR>
                <TD width="760" align="center" height="20">
				更换合影:(请输图片网址)</TD>
           </tr>
              
           <TR>
                <TD width="760" align="center" height="80">
				<FORM METHOD="POST" NAME="clovephoto" ACTION="plus_marry_up.asp?action=lovesphoto&id=<%=j%>">
					<P>
					<INPUT TYPE="text" NAME="lovephoto" SIZE="60">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<INPUT TYPE="submit" VALUE="提交" NAME="Submit">&nbsp;&nbsp;&nbsp;&nbsp;
					<INPUT TYPE="reset" VALUE="清除" NAME="Clear"></P>
				</FORM>
		<% if  isup=0 then%>
		        <p>
				合影上传功能已被管理员关闭。请指定合影的网络地址。以 HTTP 开头。				</p>
		 <% else %>

		        <p>
				如果没有在线图片，可以在这里上传。只支持图片格式（JPG,GIF）。图片不得大于<%=upsize%>KB。
				</p>
		<%		
	Dim PostRanNum
	Randomize
	PostRanNum = Int(900*rnd)+1000
	Session("marryUploadCode") = Cstr(PostRanNum)%>
		
				<form name="form" method="post" action="Plus_marry_up.asp?action=uplovephoto&id=<%=j%>" enctype="multipart/form-data">
				<INPUT TYPE="hidden" NAME="marryUploadCode" value="<%=PostRanNum%>">
				<input type="file" name="file1" width=200 value="" size="75"><input type="submit" name="Submit" value="上传" onclick="parent.document.getElementById('Submit').disabled=true;parent.document.getElementById('Clear').disabled=true;">
			
				<p>　</p>
		<%end if%>	</tr>
				</form>
				</TD>
           </tr>    
        </table>
   </DIV>
 
<%end sub
'===========================================LOVE照存储
sub lovesphoto()
dim j,name7,rsm7,sqlm7,url,oldfilename
  j=Dvbbs.CheckStr(request("id"))
  url=Dvbbs.checkstr(request("lovephoto"))
  url=lcase(url)
  
  if url="" or left(url,4)<>"http" then
     SendMsg="<li>请输入正确地址！"
     exit sub
  end if
  set rsm7=server.createobject("adodb.recordset")
   sqlm7="select * from m_love  where love_id="&j
   rsm7.open sqlm7,connj,1,3
   
   oldfilename=rsm7("lovephoto")
   delold=deloldfile("love"&j,oldfilename)            '删除老文件	
   rsm7("lovephoto")=url
   if Dvbbs.membername=rsm7("forname") then
   name7=rsm7("toname")
   else
   name7=rsm7("forname")
   end if
   rsm7.update
   rsm7.close
   set rsm7=nothing
   set sqlm7=nothing
   sqlm7="insert into dv_message(sender,incept,title,content,sendtime,issend)values('恋爱事务处','"&name7&"','很高兴的通知您：','"&Dvbbs.membername&"改变了你们的照片,快去颀赏吧!','"&now()&"','1')"
  Dvbbs.execute(sqlm7)
  
  UPDATE_User_Msg name7
  SendMsg="<li>照片改变成功！"
  set sqlm7=nothing

end sub

'===========================================love照上传设置


sub UPlovephoto()

    Server.ScriptTimeOut=999999           '要是你的论坛支持上传的文件比较大，就必须设置。
	If Not Dvbbs.ChkPost Then
		Response.End
	End If
	If Dvbbs.Userid=0 Then
		Response.write "你还未登陆！"
		Response.End
	End If
	If Cint(Dvbbs.GroupSetting(7))=0 then
		Response.write "您没有在本论坛上传文件的权限"
		Response.End
	End If
    
%>
<table width="100%" height="100%" border=0  cellspacing="0" cellpadding="0">
<tr><td class=tablebody1 width="100%" height="100%" >
<script>
parent.document.theForm.Submit.disabled=false;
parent.document.theForm.Submit2.disabled=false;
</script>
</td></tr></table>

<%


  dim j,name7,rsm7,sqlm7,filename7,forname7,toname7,oldfilename
  j=Dvbbs.CheckStr(request("id"))
     
  set rsm7=server.createobject("adodb.recordset")
   sqlm7="select * from m_love  where love_id="&j
   rsm7.open sqlm7,connj,1,3
   
     	 if rsm7.eof or rsm7.bof then
   	     			rsm7.close
             		set rsm7=nothing
             		set sqlm7=nothing
             		  sendmsg="记录已经被删除"
             	      exit sub
           end if
   	'判定，免得冒充上传文件
   forname7=rsm7("forname")
   toname7=rsm7("toname")
   if Dvbbs.membername<> forname7 and Dvbbs.membername<> toname7 then
           rsm7.close
        set rsm7=nothing
       set sqlm7=nothing

       	Response.write "请不要输入奇怪的地址！"
		Response.End
   end if
   oldfilename=rsm7("lovephoto")

   filename7=UploadFile("love"&j)
   
   if filename7="" then
      SendMsg= "<li>请正确选择要上传的文件"
      exit sub
   end if 


   delold=deloldfile("love"&j,oldfilename)            '删除老文件
   	
   rsm7("lovephoto")=filename7
   if Dvbbs.membername=rsm7("forname") then
   name7=rsm7("toname")
   else
   name7=rsm7("forname")
   end if
   rsm7.update
   rsm7.close
   set rsm7=nothing
   set sqlm7=nothing
   sqlm7="insert into dv_message(sender,incept,title,content,sendtime,issend)values('恋爱事务处','"&name7&"','很高兴的通知您：','"&Dvbbs.membername&"改变了你们的照片,快去颀赏吧!','"&now()&"','1')"
  Dvbbs.execute(sqlm7)
  
  UPDATE_User_Msg name7
  
  SendMsg= "<li>图片上传成功!"
  set sqlm7=nothing

end sub


'#######################################################################################################################


'===========================================marry照改变
sub marrycphoto()
dim j,name7,rsm7,sqlm7
  j=Dvbbs.CheckStr(request("id"))
   %>


   <DIV ALIGN="center">
   <table BACKGROUND="Dv_plus/marry/b01.jpg" WIDTH="760" HEIGHT="100" BORDERCOLORLIGHT="#FF00FF" BORDERCOLORDARK="#FF00FF" BORDER="1" STYLE="border-collapse: collapse">   
           <TR>
                <TD width="760" align="center" height="20">
				更换合影:(请输图片网址)</TD>
           </tr>
              
           <TR>
                <TD width="760" align="center" height="80">
				<FORM METHOD="POST" NAME="cmarryphoto" ACTION="plus_marry_up.asp?action=marrysphoto&id=<%=j%>">
					<P>
					<INPUT TYPE="text" NAME="marryphoto" SIZE="60">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<INPUT TYPE="submit" VALUE="提交" NAME="Submit">&nbsp;&nbsp;&nbsp;&nbsp;
					<INPUT TYPE="reset" VALUE="清除" NAME="Clear"></P>
				</FORM>
		<% if  isup=0 then%>
		        <p>
				合影上传功能已被管理员关闭。请指定合影的网络地址。以 HTTP 开头。				</p>
		 <% else %>

		        <p>
				如果没有在线图片，可以在这里上传。只支持图片格式（JPG,GIF）。图片不得大于<%=upsize%>KB。
				</p>
		<%		
	Dim PostRanNum
	Randomize
	PostRanNum = Int(900*rnd)+1000
	Session("marryUploadCode") = Cstr(PostRanNum)%>
		
				<form name="form1" method="post" action="Plus_marry_up.asp?action=upmarryphoto&id=<%=j%>" enctype="multipart/form-data">
				<INPUT TYPE="hidden" NAME="marryUploadCode" value="<%=PostRanNum%>">
				<input type="file" name="file1" width=200 value="" size="75"><input type="submit" name="Submit" value="上传" onclick="parent.document.getElementById('Submit').disabled=true;parent.document.getElementById('Clear').disabled=true;">
			
				<p>　</p>
		<%end if%>	</tr>
				</form>
				</TD>
           </tr>    
        </table>
   </DIV>
 
<%end sub
'===========================================marry照存储
sub marrysphoto()
dim j,name7,rsm7,sqlm7,url,oldfilename
  j=Dvbbs.CheckStr(request("id"))
  url=Dvbbs.checkstr(request("marryphoto"))
  url=lcase(url)
  
  if url="" or left(url,4)<>"http" then
     SendMsg="<li>请输入正确地址！"
     exit sub
  end if
  set rsm7=server.createobject("adodb.recordset")
   sqlm7="select * from m_marry  where marry_id="&j
   rsm7.open sqlm7,connj,1,3
   
   oldfilename=rsm7("marryphoto")
   delold=deloldfile("marry"&j,oldfilename)            '删除老文件	
   rsm7("marryphoto")=url
   if Dvbbs.membername=rsm7("forname") then
   name7=rsm7("toname")
   else
   name7=rsm7("forname")
   end if
   rsm7.update
   rsm7.close
   set rsm7=nothing
   set sqlm7=nothing
   sqlm7="insert into dv_message(sender,incept,title,content,sendtime,issend)values('恋爱事务处','"&name7&"','很高兴的通知您：','"&Dvbbs.membername&"改变了你们的照片,快去颀赏吧!','"&now()&"','1')"
  Dvbbs.execute(sqlm7)
  
  UPDATE_User_Msg name7
  SendMsg="<li>照片改变成功！"
  set sqlm7=nothing

end sub

'===========================================marry照上传设置


sub UPmarryphoto()

    Server.ScriptTimeOut=999999           '要是你的论坛支持上传的文件比较大，就必须设置。
	If Not Dvbbs.ChkPost Then
		Response.End
	End If
	If Dvbbs.Userid=0 Then
		Response.write "你还未登陆！"
		Response.End
	End If
	If Cint(Dvbbs.GroupSetting(7))=0 then
		Response.write "您没有在本论坛上传文件的权限"
		Response.End
	End If

%>
<table width="100%" height="100%" border=0  cellspacing="0" cellpadding="0">
<tr><td class=tablebody1 width="100%" height="100%" >
<script>
parent.document.theForm.Submit.disabled=false;
parent.document.theForm.Submit2.disabled=false;
</script>
</td></tr></table>
 
<%


  dim j,name7,rsm7,sqlm7,filename7,forname7,toname7,oldfilename
  j=Dvbbs.CheckStr(request("id"))
     
  set rsm7=server.createobject("adodb.recordset")
   sqlm7="select * from m_marry  where marry_id="&j
   rsm7.open sqlm7,connj,1,3
   
     	 if rsm7.eof or rsm7.bof then
   	     			rsm7.close
             		set rsm7=nothing
             		set sqlm7=nothing
             		  sendmsg="记录已经被删除"
             	      exit sub
           end if
   	'判定，免得冒充上传文件
   forname7=rsm7("forname")
   toname7=rsm7("toname")
   if Dvbbs.membername<> forname7 and Dvbbs.membername<> toname7 then
           rsm7.close
        set rsm7=nothing
       set sqlm7=nothing

       	Response.write "请不要输入奇怪的地址！"
		Response.End
   end if
   oldfilename=rsm7("marryphoto")   
   filename7=UploadFile("marry"&j)
   if filename7="" then
      SendMsg= "<li>请正确选择要上传的文件"
      exit sub
   end if 


   delold=deloldfile("marry"&j,oldfilename)            '删除老文件
   	
   rsm7("marryphoto")=filename7
   if Dvbbs.membername=rsm7("forname") then
   name7=rsm7("toname")
   else
   name7=rsm7("forname")
   end if
   rsm7.update
   rsm7.close
   set rsm7=nothing
   set sqlm7=nothing
   sqlm7="insert into dv_message(sender,incept,title,content,sendtime,issend)values('恋爱事务处','"&name7&"','很高兴的通知您：','"&Dvbbs.membername&"改变了你们的照片,快去颀赏吧!','"&now()&"','1')"
  Dvbbs.execute(sqlm7)
  
  UPDATE_User_Msg name7
  
  SendMsg= "<li>图片上传成功!"
  set sqlm7=nothing

end sub














'#######################################################################################################################


'===================================上传子程序



Function UploadFile(k)


	Dim Upload,FilePath,FormName,File,F_FileName
	Dim UserID
	UserID = ""
	If Dvbbs.UserID>0 Then UserID =  k&"_"&Dvbbs.UserID&"_"
	FilePath = "UploadFace/"
	Set Upload = New UpFile_Cls
		Upload.UploadType			= Cint(Dvbbs.Forum_UploadSetting(2))	'设置上传组件类型
		Upload.UploadPath			= FilePath								'设置上传路径
		Upload.MaxSize				= upsize									'单位 KB
		Upload.InceptMaxFile		= 1										'每次上传文件个数上限
		Upload.InceptFileType		= "gif,jpg"				                '设置上传文件限制
		Upload.RName				= UserID
		Upload.ChkSessionName		= "marryUploadCode"
		'执行上传
		Upload.SaveUpFile
		If Upload.ErrCodes<>0 Then
			SendMsg= "错误："& Upload.Description
			Exit Function
		End If
		If Upload.Count > 0 Then
			For Each FormName In Upload.UploadFiles
				Set File = Upload.UploadFiles(FormName)
					F_FileName = FilePath & File.FileName
                    UploadFile=f_fileName 
				Set File = Nothing
			Next
		Else

			UploadFile=""
			Set Upload = Nothing
			Exit Function
		End If
	Set Upload = Nothing
End Function











%>