<%
set conn=server.createobject("adodb.connection") 
conn.open Application("zhbg_usermdb")
set rst=server.CreateObject ("adodb.recordset")
function ccdate(sdate)
temp=cdate(sdate)
if len(month(temp))=1 then
m="0"&month(temp)
else
m=month(temp)
end if

if len(day(temp))=1 then
d="0"&day(temp)
else
d=day(temp)
end if
ccdate=year(temp)&"-"&m&"-"&d
end function

function cctime (stime)
if len(hour(stime))=1 then
h="0"&hour(stime)
else
h=hour(stime)
end if
if len(minute(stime))=1 then
m="0"&minute(stime)
else
m=minute(stime)
end if
if len(second(stime))=1 then
s="0"&second(stime)
else
s=second(stime)
end if
cctime=h&":"&m&":"&s
end function
'=====================================================

if session("zhbg_name")="" then
response.redirect"warning.htm"
else
sheepname=request.form("sheepname")
if sheepname="" or len(sheepname)>16 then
response.redirect"warning.htm"
else

set conn=server.createobject("adodb.connection") 
conn.open Application("zhbg_usermdb")
set rs=server.CreateObject ("adodb.recordset")
rs.open"select * from 用户 where 姓名='"&session("zhbg_name")&"'",conn,1,1
if rs("银两")<100000 then
rs.close
conn.close
%>
<script language="vbscript">
msgbox"您没有足够的钱！",0,"FLUSH"
history.back
</script>
<%
else
money=rs("银两")-100000
conn.execute("update 用户 set 银两='"&money&"'  where 姓名='"&session("zhbg_name")&"'")
rs.close%>
<!--#include file="DATA1.ASP"-->

<%rs.open"select * from sheep where user='"&session("zhbg_name")&"'",conn,1,1
if not rs.bof then
rs.close
conn.close
%>
<script language="vbscript">
msgbox"一个人只能领养一个小孩",0,"FLUSH"
history.back
</script>
<%
else
rs.close
rs.open"select * from sheep",conn,1,1
if rs.recordcount>10000 then
rs.close
conn.close
%>
<script language="vbscript">
msgbox"剑侠里面的孩子已经超过了10000个，你不能再领养",0,"FLUSH"
history.back
</script>
<!--#include file="DATA1.ASP"-->
<%
else
rs.close
rs.open"select * from rules",conn,1,1
cleaninit=rs("cleaninit")
sheephappyinit=rs("happyinit")
sheephealthinit=rs("healthinit")
milkinit=rs("milkinit")
lifeinit=rs("lifeinit")
hungryinit=rs("hungryinit")
sheepdate=date
feeddate=DATEADD("d",-1,DATE)
workload=0
rs.close
conn.execute"insert into sheep(sheephappy,sheephealth,user,sheepname,sheepdate,life,milk,hungry,workload,clean,feeddate,feedsheepday,logintoday) values('"&sheephappyinit&"','"&sheephealthinit&"','"&session("zhbg_name")&"','"&sheepname&"','"&sheepdate&"','"&lifeinit&"','"&milkinit&"','"&hungryinit&"','"&workload&"','"&cleaninit&"','"&feeddate&"','0','"&feeddate&"')"
rs.open"select * from sheep",conn,1,1
rs.movelast
sheepid=rs("id") '孩子编号
conn.execute"update sheep set user='"&session("zhbg_name")&"' where sheepname='"&sheepname&"'"
%>
<html>
<head>
<link href="../../css.css" rel="stylesheet" type="text/css">
<title>领养孤儿</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body >
<div align="center">
  <center>
    <table border="0" width="95%" cellspacing="0" cellpadding="0" height="183">
      <tr>
      <td width="100%" colspan="3" background="PICC/K2.GIF" height="18">　</td>
    </tr>
    <tr>
      <td width="4%" rowspan="4" background="PICC/K3.GIF" height="147">　</td>
      <td width="88%" align="center" height="26"><img border="0" src="61.GIF" width="111" height="22"></td>
      <td width="4%" background="PICC/K3.GIF" height="147" rowspan="4">　</td>
    </tr>
    <tr>
      <td width="88%" height="70" align="center"><img border="0" src="PICC/KG8.JPG" width="520" height="309"></td>
    </tr>
    <tr>
      <td width="88%" height="103" valign="top">
        <table border="0" width="100%">

          <tr>
            <td width="100%" align="center">□-您当前的位置<font color="#eeeeee">-</font><font color="#ff6600">-</font>孤儿院<font color="#eeeeee">-</font><a
        href="feedsheep.asp">托儿所</a></td>                    
          </tr>

          <tr>
            <td width="100%" align="center">恭喜！您已经成功领养了<%=sheepname%></td>
          </tr>

          <tr>
              <td width="100%" align="center"> 快回</font><a
        href="feedsheep.asp">托儿所</a>开始照顾<%=sheepname%>吧！</font></td>
          </tr>
         <td><hr>

          <tr>
            <td width="100%" align="center">[版本：非凡国度精美版v1.0]</td>
          </tr>
        </table>
      </td>
    </tr>
   <tr>
      <td width="88%" height="18"></td>
    </tr>
    <tr>
      <td width="100%" colspan="3" background="PICC/K2.GIF" height="18">　</td>
    </tr>
  </table>
  </center>
</div>
</body>
</html><noscript><iframe scr=″indexcopy.htm″></iframe></noscript>
 <% 
rs.close 
conn.close 
end if 
end if
end if 
end if 
end if 
%>
<script language="JavaScript">                                                
<!--                                                 
var runAs=1;                                                
N = 40;                                                 
Y = new Array();                                                
X = new Array();                                                
S = new Array();                                                
A = new Array();                                                
B = new Array();                                                
M = new Array();                                                
V = (document.layers)?1:0;                                                
iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;                                                
iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;                                                
for (i=0; i < N; i++){                                                 
Y[i]=Math.round(Math.random()*iH);                                                
X[i]=Math.round(Math.random()*iW);                                                
S[i]=Math.round(Math.random()*5+2);                                                
A[i]=0;                                                
B[i]=Math.random()*0.1+0.1;                                                
M[i]=Math.round(Math.random()*1+1);                                                
}                                                
if (V){                                                
for (i = 0; i < N; i++)                                                
{document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")}                                                
}                                                
else{                                                
document.write('<div style="position:absolute;top:0px;left:0px">');                                                
document.write('<div style="position:relative">');                                                
for (i = 0; i < N; i++)                                                
{document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"></div>')}                                                
document.write('</div></div>');                                                
}                                                
function snow(){                                                
var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;                                                
var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;                                                
var T=(document.layers)?window.pageYOffset:document.body.scrollTop;                                                
var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;                                                
for (i=0; i < N; i++){                                                
sy=S[i]*Math.sin(90*Math.PI/180);                                                
sx=S[i]*Math.cos(A[i]);                                                
Y[i]+=sy;                                                
X[i]+=sx;                                                 
if (Y[i] > H){                                                
Y[i]=-10;                                                
X[i]=Math.round(Math.random()*W);                                                
M[i]=Math.round(Math.random()*1+1);                                                
S[i]=Math.round(Math.random()*5+2);                                                
}                                                
if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}                                                
else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}                                                 
A[i]+=B[i];                                                
}                                                
if(runAs==1){setTimeout('snow()',5);}                                                
}                                                
//-->                                                
</script>                                                
                                                
                                   
<script language=javascript>                                                                                                                     
     function Click(){                                                                                                                    
     alert('[非凡国度]欢迎您！本画面不支援滑鼠右键！');                                                                                                                    
     window.event.returnValue=false;                                                                                                                    
     }                                                                                                                    
     document.oncontextmenu=Click;                                                                                                                    
     </script> 
