<%
ServerName1=Cstr(Request.ServerVariables("HTTP_REFERER"))
ServerName2=Cstr(Request.ServerVariables("SERVER_NAME"))
If Mid(ServerName1,8,len(ServerName2))<>ServerName2 Then
    Response.Write "路径有误，禁止从网站外部提交表单！"
    response.end
End if
%>
<%
Public Function FilterHtml(Str)
    If Trim(Str) = "" Or IsNull(Str) Then
        FilterHtml=""
    Else
    Str = Replace(Str, ">", "&gt;")
    Str = Replace(Str, "<", "&lt;")
    Str = Replace(Str, Chr(32), "&nbsp;")
    Str = Replace(Str ,Chr(9), "&nbsp;")
    Str = Replace(Str, Chr(34), "&quot;")
    Str = Replace(Str, Chr(39), "&#39;")
    Str = Replace(Str, Chr(13), "")
    Str = Replace(Str, Chr(10) & Chr(10), "</p><p>")
    Str = Replace(Str, Chr(10), "<br> ")
    FilterHtml = Str
    End If
End Function
%>
<!--#include file=byshop_conn.asp-->
<!--#include file="cookie.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from byshop_user where ( reglx=1 or reglx=0 ) and user ='"&replace(request.cookies("byshop")("user"),"'","")&"'"
rs.open sql,conn,1,1
if (rs.bof and rs.eof) then
 response.write"<SCRIPT language=JavaScript>alert('提交失败！');"
   response.write"this.location.href='pubsell.asp';</SCRIPT>" 
    response.end
    else
    userid=rs("id")
    end if
    rs.close
    set rs=nothing
    
    
action=request("action")
if action="add" then
set rs=server.createobject("adodb.recordset")
sql="select * from rent2"
rs.open sql,conn,1,3
rs.AddNew
rs("address")=FilterHtml(trim(request.form("address")))'详细地址
if IsNumeric(request.QueryString("province"))=false or request("province")="xxx" then
rs("province") =0
else
rs("province")=int(request("province"))'市区
end if
if IsNumeric(request("city"))=False  or request("city")="xxx" then
rs("city") = 0
else
rs("city")=int(request("city"))'城区
end if

rs("room")=int(request.form("room"))'室
rs("hall")=int(request.form("hall"))'厅
rs("toilet")=int(request.form("toilet"))'卫
rs("build")=FilterHtml(trim(request.form("build")))'建成日期
rs("property")=FilterHtml(trim(request.form("property")))'房屋产权
rs("fitment")=FilterHtml(trim(request.form("fitment")))'装修情况

'屋内设施_水
if FilterHtml(request.form("establishment1"))<>"" then
if FilterHtml(request.form("establishment1"))=1 then
rs("establishment1")=1
else
rs("establishment1")=0
end if
end if

'屋内设施_电
if FilterHtml(request.form("establishment2"))<>"" then
if FilterHtml(request.form("establishment2"))=1 then
rs("establishment2")=1
else
rs("establishment2")=0
end if
end if

'屋内设施_煤气
if FilterHtml(request.form("establishment3"))<>"" then
if  request.form("establishment3")=1 then
rs("establishment3")=1
else
rs("establishment3")=0
end if
end if

'屋内设施_天然气
if FilterHtml(request.form("establishment4"))<>"" then
if FilterHtml(request.form("establishment4"))=1 then
rs("establishment4")=1
else
rs("establishment4")=0
end if
end if

'屋内设施_暖气
if FilterHtml(request.form("establishment5"))<>"" then
if FilterHtml(request.form("establishment5"))=1 then
rs("establishment5")=1
else
rs("establishment5")=0
end if
end if

'屋内设施_互联网线
if FilterHtml(request.form("establishment6"))<>"" then
if FilterHtml(request.form("establishment6"))=1 then
rs("establishment6")=1
else
rs("establishment6")=0
end if
end if

'屋内设施_电话
if FilterHtml(request.form("establishment7"))<>"" then
if FilterHtml(request.form("establishment7"))=1 then
rs("establishment7")=1
else
rs("establishment7")=0
end if
end if

'屋内设施_有线电
if FilterHtml(request.form("establishment8"))<>"" then
if FilterHtml(request.form("establishment8"))=1 then
rs("establishment8")=1
else
rs("establishment8")=0
end if
end if

rs("sort")=int(request.form("sort"))'物业类型
rs("usearea")=FilterHtml(request.form("usearea"))'使用面积
rs("floor")=FilterHtml(trim(request.form("floor")))'楼
rs("floor2")=FilterHtml(trim(request.form("floor2")))'层
rs("face")=FilterHtml(trim(request.form("face")))'房屋朝向
rs("money")=FilterHtml(request.form("money"))'屋房售价
rs("carport")=FilterHtml(trim(request.form("carport")))'车棚情况
rs("content")=trim(request.form("content"))'详细介绍

rs("linkman")=FilterHtml(trim(request.form("linkman")))'联系人
rs("mobile")=FilterHtml(trim(request.form("mobile")))'联系电话
rs("tel")=FilterHtml(trim(request.form("tel")))'手机电话
rs("email")=FilterHtml(trim(request.form("email")))'电子邮箱
rs("Contract")=FilterHtml(trim(request.form("Contract")))'联式方式
rs("Contract2")=FilterHtml(trim(request.form("Contract2")))'联式方式
rs("period")=FilterHtml(trim(request.form("period")))'有效期
rs("adddate")=now()'登记日期
rs("by_shenhe")=0'审核
rs("count")=0'浏览次数
rs("pubsort")=FilterHtml(request.form("pubsort"))'发布类型
id=rs("id")
rs("ip")=Request.ServerVariables("REMOTE_ADDR")'发布IP
rs("userid")=userid
rs.Update
rs.Close
  response.write"<SCRIPT language=JavaScript>alert('租赁房求租--添加成功！');"
   response.write"this.location.href='editrent2.asp?id="&id&"';</SCRIPT>" 
   response.end 
end if 
%>




<%
if action="edit" then
id=trim(request("id"))
		if IsNumeric(request.QueryString("id"))=False or request.QueryString("id")="" then
		response.write"<SCRIPT language=JavaScript>alert('参数错误！');"
		response.end	
		end if
set rs=server.createobject("adodb.recordset")
sql="select * from rent2 where userid='"&userid&"' and id="&id
rs.open sql,conn,1,3
rs("address")=FilterHtml(trim(request.form("address")))'详细地址
if IsNumeric(request.QueryString("province"))=false or request("province")="xxx" then
rs("province") =0
else
rs("province")=int(request("province"))'市区
end if
if IsNumeric(request("city"))=False  or request("city")="xxx" then
rs("city") = 0
else
rs("city")=int(request("city"))'城区
end if

rs("room")=int(request.form("room"))'室
rs("hall")=int(request.form("hall"))'厅
rs("toilet")=int(request.form("toilet"))'卫
rs("build")=FilterHtml(trim(request.form("build")))'建成日期
rs("property")=FilterHtml(trim(request.form("property")))'房屋产权
rs("fitment")=FilterHtml(trim(request.form("fitment")))'装修情况

'屋内设施_水
if FilterHtml(request.form("establishment1"))<>"" then
if FilterHtml(request.form("establishment1"))=1 then
rs("establishment1")=1
else
rs("establishment1")=0
end if
end if
'屋内设施_电
if FilterHtml(request.form("establishment2"))<>"" then
if FilterHtml(request.form("establishment2"))=1 then
rs("establishment2")=1
else
rs("establishment2")=0
end if
end if
'屋内设施_煤气
if FilterHtml(request.form("establishment3"))<>"" then
if  request.form("establishment3")=1 then
rs("establishment3")=1
else
rs("establishment3")=0
end if
end if
'屋内设施_天然气
if FilterHtml(request.form("establishment4"))<>"" then
if FilterHtml(request.form("establishment4"))=1 then
rs("establishment4")=1
else
rs("establishment4")=0
end if
end if
'屋内设施_暖气
if FilterHtml(request.form("establishment5"))<>"" then
if FilterHtml(request.form("establishment5"))=1 then
rs("establishment5")=1
else
rs("establishment5")=0
end if
end if
'屋内设施_互联网线
if FilterHtml(request.form("establishment6"))<>"" then
if FilterHtml(request.form("establishment6"))=1 then
rs("establishment6")=1
else
rs("establishment6")=0
end if
end if
'屋内设施_电话
if FilterHtml(request.form("establishment7"))<>"" then
if FilterHtml(request.form("establishment7"))=1 then
rs("establishment7")=1
else
rs("establishment7")=0
end if
end if
'屋内设施_有线电
if FilterHtml(request.form("establishment8"))<>"" then
if FilterHtml(request.form("establishment8"))=1 then
rs("establishment8")=1
else
rs("establishment8")=0
end if
end if
rs("sort")=int(request.form("sort"))'物业类型
rs("usearea")=FilterHtml(request.form("usearea"))'使用面积
rs("floor")=FilterHtml(trim(request.form("floor")))'楼
rs("floor2")=FilterHtml(trim(request.form("floor2")))'层
rs("face")=FilterHtml(trim(request.form("face")))'房屋朝向
rs("money")=FilterHtml(request.form("money"))'屋房售价
rs("carport")=FilterHtml(trim(request.form("carport")))'车棚情况
rs("content")=trim(request.form("content"))'详细介绍

rs("linkman")=FilterHtml(trim(request.form("linkman")))'联系人
rs("mobile")=FilterHtml(trim(request.form("mobile")))'联系电话
rs("tel")=FilterHtml(trim(request.form("tel")))'手机电话
rs("email")=FilterHtml(trim(request.form("email")))'邮箱
rs("period")=FilterHtml(trim(request.form("period")))'有效期

rs("Contract")=FilterHtml(trim(request.form("Contract")))'联式方式
rs("Contract2")=FilterHtml(trim(request.form("Contract2")))'联式方式
id=rs("id")
rs("ip")=Request.ServerVariables("REMOTE_ADDR")'发布IP
rs.Update
rs.Close
  response.write"<SCRIPT language=JavaScript>alert('租赁房求租--修改成功！');"
   response.write"this.location.href='editrent2.asp?id="&id&"';</SCRIPT>" 
   response.end 
end if 


%>
 
 
  