<!-- #include file="setup.asp" -->
<%
top
if Request.Cookies("username")=empty then error("<li>您还未<a href=login.asp>登录</a>社区")
sql="select * from [user] where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3

username=Request.Cookies("username")

select case Request("menu")
case "buy"
succtitle="成功购买住宅"
buy
end select

%>
<table border=0 width=750 align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <a href=main.asp><%ClubTree%></a> → <a href=building.asp>社区住宅</a></td>
</tr>
</table><br><html><head>
<title>社区住宅</title>
<table width="700" border="0" cellspacing="0" cellpadding="0" height="352" align="center">
  <tr> 
    <td height="97" width="245" valign="top"><img src="images/building_img/building.gif" border="0" width="200" height="130"></td>
    <td height="97" width="455" valign="top"> 
      <table width="100" border="0" cellspacing="0" cellpadding="0" height="20">
        <tr> 
          <td>　</td>
        </tr>
      </table>
       <fieldset style="border:1px solid #a4b6d7;WIDTH: 440" >
       <legend>你的状态</legend> 
      <table border="0" cellspacing="0" cellpadding="0" height="105" align="center" width="408">
        <tr> 
          <td width="91">社区昵称：</td>
          <td width="136"><%=rs("username")%></td>
          <td width="91">注册日期：</td>
          <td width="136"> <%=rs("regtime")%></td>
        </tr>
<tr> 
          <td width="91">发表贴数：</td>
          <td width="136"> <%=rs("posttopic")+rs("postrevert")%></td>
          <td width="84">精华贴数：</td>
          <td width="97"><%=rs("goodtopic")%></td>
        </tr>
        <tr> 
 <td width="84">社区金币：</td>
          <td width="97"><%=rs("money")%></td>
          <td width="84">体 力 值：</td>
          <td width="97"><%=rs("userlife")%></td>
          
        </tr>
<tr> 
          <td width="91">经 验 值：</td>
          <td width="136"> <%=rs("experience")%></td>
          <td width="84"> 魅 力 值：</td>
          <td width="97"> <%=rs("magicpower")%></td>
        </tr>
                <tr> 
          <td width="91">登陆次数：</td>
          <td width="136"> <%=rs("degree")%></td>
<td width="84">当前门派：</td>
          <td width="97"> 
            <%
if ""&rs("faction")&""="" then
response.write "无"
else
response.write rs("faction")
end if
%>
          </td>
          
        </tr>
       
<tr> 
          <td width="95">社区威望：</td>
          <td width="142"> 
           <%=rs("power")%>
          </td>
 <td width="95">社区头衔：</td>
          <td width="142"> 
            <%
if ""&rs("honor")&""="" then
response.write "无"
else
response.write rs("honor")
end if
%>
          </td>
</tr>
        <tr> 
          <td width="91">社区住宅：</td>
          <td width="136"> 
            <%
if ""&rs("building")&""="" then
response.write "无"
else
response.write rs("building")
end if
%>
          </td>
          <td width="91">社区伴侣：</td>
          <td width="136"> 
         <%
if ""&rs("consort")&""="" then
response.write "无"
else
response.write rs("consort")
end if
%>
          </td>
        </tr>
      </table>
      <br>
     &nbsp;&nbsp; 要买住宅,经验值必须在500以上!&nbsp;&nbsp;&nbsp;您现在的住宅小区是：<font color="#0066CC"><%
if ""&rs("building")&""="" then
response.write "无"
else
response.write rs("building")
end if
%></font></fieldset>
      <br>
      <br> </td>
  </tr>
  <tr valign="top" align="center"> 
    <td colspan="2"> 
      <form name="form1" method="post" action="?menu=buy">
        <fieldset style="border:1px solid #a4b6d7;WIDTH: 670">
<legend>住宅选购</legend>
        <table width="650" border="0" cellspacing="0" cellpadding="0" height="80">
           <tr> 
            <td height="90" width="121"><img src="images/building_img/b1.gif" width="100" height="75" border="1"></td>
            <td height="90" width="190"> <B>小 木 房</B><br>
              简陋的木屋，虽然不怎么好看，但是也是自己温暖的家了！<br>
              价格：500元<br>
              <input type="radio" name="radiobutton" value="1">
              购买</td>
            <td height="90" width="117"><img src="images/building_img/b2.gif" width="100" height="75" border="1"></td>
            <td height="90" width="222"> <B>阳 光 屋</B><br>
              欧式风情的小房子，虽然小了点，却有异国风味！<br>
              价格：2000元<br>
              <input type="radio" name="radiobutton" value="2">
              购买</td>
          </tr>
          <tr> 
            <td height="90" width="121"><img src="images/building_img/b3.gif" width="100" height="75" border="1"></td>
            <td height="90" width="190"> <B>叮 当 窝</B><br>
              日式风情的二层楼，像不像机器猫里的房子？呵呵<br>
              价格：3000元<br>
              <input type="radio" name="radiobutton" value="3">
              购买</td>
            <td height="90" width="117"><img src="images/building_img/b4.gif" width="100" height="75" border="1"></td>
            <td height="90" width="222"> <B>清 风 居</B><br>
              完全古色古香的中国典型民居，让你回到古代！<br>
              价格：5000元<br>
              <input type="radio" name="radiobutton" value="4">
              购买</td>
          </tr>
          <tr> 
            <td height="90" width="121"><img src="images/building_img/b5.gif" width="100" height="75" border="1"></td>
            <td height="90" width="190"> <B>豪华宾馆</B><br>
              五星级的宾馆，在这里可以看城市的风景哟！<br>
              价格：7000元<br>
              <input type="radio" name="radiobutton" value="5">
              购买</td>
            <td height="90" width="117"><img src="images/building_img/b6.gif" width="100" height="75" border="1"></td>
            <td height="90" width="222"> <B>小型别墅</B><br>
              地处悠远的神秘之林，有周到的仆人为你服务，还可以探索大自然的奥秘<br>
              价格：7000元<br>
              <input type="radio" name="radiobutton" value="6">
              购买</td>
          </tr>
          <tr> 
            <td height="90" width="121"><img src="images/building_img/b7.gif" width="100" height="75" border="1"></td>
            <td height="90" width="190"> <B>花园别墅</B><br>
              从此远离糟糕的空气，污染的水源，嘈杂的声音，这里是富豪的天堂！<br>
              价格：10000元<br>
              <input type="radio" name="radiobutton" value="7">
              购买</td>
            <td height="90" width="117"><img src="images/building_img/b8.gif" width="100" height="75" border="1"></td>
            <td height="90" width="222"> <B>红色宫殿</B><br>
              庄严，气派，典雅，让你过皇帝般的生活！<br>
              价格：15000元<br>
              <input type="radio" name="radiobutton" value="8">
              购买</td>
          </tr>
          <tr> 
            <td height="90" width="121"><img src="images/building_img/b9.gif" width="100" height="75" border="1"></td>
            <td height="90" width="190"> <B>黄金圣殿</B><br>
              想知道俄罗斯沙皇什么滋味吗？嘿嘿，他住的和我一样！<br>
              价格：30000元<br>
              <input type="radio" name="radiobutton" value="9">
              购买</td>
            <td height="90" width="117"><img src="images/building_img/b10.gif" width="100" height="75" border="1"></td>
            <td height="90" width="222"> <B>钻石圣殿</B><br>
              全部镶嵌钻石，配有室外游泳池，露天足球场，美国总统也不过如此！<br>
              价格：40000元<br>
              <input type="radio" name="radiobutton" value="10">
              购买</td>
          </tr>
          <tr> 
            <td height="90" width="121"><img src="images/building_img/b11.gif" width="100" height="75" border="1"></td>
            <td height="90" width="190"> <B>云莱仙境</B><br>
              童话里才会出现的城堡，为你心爱的公主特意造的仙境！<br>
              价格：50000元<br>
              <input type="radio" name="radiobutton" value="11">
              购买</td>
            <td height="90" colspan="2" valign="middle" align="center"> 看了这么多漂亮的住宅，哪所令你心动了呢？<br>
              快快选择购买吧！当然你的钱可要带够噢！
              <input type="submit" name="Submit" value="确定购买" class=input>
            </td>
          </tr>
        </table></fieldset>
      </form>
    </td>
  </tr>
</table>

<%
rs.close
htmlend

sub buy
rs.close
int price
building=Request("radiobutton")
if building="" then
error("你还没有选择你喜欢的住宅呢!")
end if
select case building
case "1"
price=500
info="<a href=# onclick=javascript:open('mybuilding.asp?building=1&username="&username&"','','width=282,height=248')><font color=#0066CC>小 木 房</font></a>"
case "2"
price=2000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=2&username="&username&"','','width=282,height=248')><font color=#0066CC>阳 光 屋</font></a>"
case "3"
price=3000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=3&username="&username&"','','width=282,height=248')><font color=#0066CC>叮 当 窝</font></a>"
case "4"
price=5000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=4&username="&username&"','','width=282,height=248')><font color=#0066CC>清 风 居</font></a>"
case "5"
price=7000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=5&username="&username&"','','width=282,height=248')><font color=#0066CC>豪华宾馆</font></a>"
case "6"
price=7000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=6&username="&username&"','','width=282,height=248')><font color=#0066CC>小型别墅</font></a>"
case "7"
price=10000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=7&username="&username&"','','width=282,height=248')><font color=#0066CC>花园别墅</font></a>"
case "8"
price=15000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=8&username="&username&"','','width=282,height=248')><font color=#0066CC>红色宫殿</font></a>"
case "9"
price=30000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=9&username="&username&"','','width=282,height=248')><font color=#0066CC>黄金圣殿</font></a>"
case "10"
price=40000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=10&username="&username&"','','width=282,height=248')><font color=#0066CC>钻石圣殿</font></a>"
case "11"
price=50000
info="<a href=# onclick=javascript:open('mybuilding.asp?building=11&username="&username&"','','width=282,height=248')><font color=#0066CC>云莱仙境</font></a>"

end select
rs.Open "select consort,money,experience,building from [user] where username='"&username&"'",Conn,1,3
if rs("money")<price then
error("<li>你的钱不够,以后带够钱再来!")
end if
if rs("experience")<500 then
error("<li>你的经验值低于500,不能购买住宅!")
end if
if rs("consort")<>empty then consort1=rs("consort")
rs("building")=info
rs("money")=rs("money")-price
rs.update
rs.close
if consort1<>empty then
rs.Open "select building from [user] where username='"&consort1&"'",Conn,1,3
rs("building")=info
rs.update
rs.close
end if
sql="select * from ecc"
rs.Open sql,Conn,1
rs("trend13")="<font color=blue>"&Request.Cookies("username")&"</font>花了<font color=#FF0000>"&price&"</font>金币买了一座"&info&"<a href=building.asp>"
rs.update
rs.close

succeed("恭喜你,你已经成功购买了"&info&"<meta http-equiv=refresh content=3;url='building.asp'")
end sub

%>
