⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sheeppei.asp

📁 功能强大的bbs
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="connsheep.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="sheepconfig.asp"-->
<!-- #include file="inc/DvADChar.asp" -->
<%
Response.Buffer=True 
Dvbbs.stats="我的宠物"
Dvbbs.nav()
Dvbbs.Head_var 2,0,"",""

dim action,freez
dim username,sheepname,sheeptype,id
username=dvbbs.membername
if username=""  then
response.redirect"login.asp"
end if
sheepname=request.form("sheepname")
id=request.form("id")
if sheepname="" then
response.redirect"login.asp"
end if
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
freez=rs("freez")
set rs=nothing
action=request("action")
if freez and action<>"freez" then
	  Errmsg=Errmsg+"<br>"+"<li>你的宠物还在冬眠房呆着呢,在你领出来之前本农场怒不允许照顾!!!"
      dvbbs.FoundIsChallenge=true
call bank_err("checksheep.asp?id="&id)
else
 if freez="" then
Errmsg=Errmsg+"<li>请不要以翻越围墙的方式进入农场,否则我们的狼狗会对你的安全不利。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
 end if
	select case action
     case "pei"
	   call pei()
	 case "eat"
	    call eat()
     case "freez"
        call freeza()
	 case "clean"
	    call clean()
	 case "sun"
	   call sun()
	 case  else
Errmsg=Errmsg+"<li>请不要以翻越围墙的方式进入农场,否则我们的狼狗会对你的安全不利。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
	end select
end if
sub freeza()
dim username,sheepname,sheeptype,freezpay,id
username=dvbbs.membername
if username=""  then
response.redirect"login.asp"
exit sub
end if
sheepname=request.form("sheepname")
id=request.form("id")
if sheepname="" then
response.redirect"login.asp"
exit sub
end if
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
dim workload
dim clean
workload=rs("workload")
	if rs("freez") then
	content="从冬眠房领出:"&rs("type")&rs("sheepname")
sucmsg="<br>"+"<li>你的"&rs("type")&rs("sheepname")&"伸了个懒腰,睁开了眼睛,看到你后大叫一声飞扑到你的怀里......"
	else
	content="送进冬眠房:"&rs("type")&rs("sheepname")
sucmsg="<br>"+"<li>你的"&rs("type")&rs("sheepname")&"恋恋不舍地一边看着你一边跟着农场管理员走了......"
if workload<3 then
Errmsg=Errmsg+"<li>"&rs("type")&"委屈地跟你说:主人,俺还没吃饱喝足呐,您怎么忍心让我进去呀?俺不去!!!"
dvbbs.FoundIsChallenge=true
  dvbbs_error() 
exit sub
end if
	end if
    sheeptype=rs("type")
	rs.close
rs.open"select * from rules where type='"&sheeptype&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>没有找到"&sheeptype&"的照料规则!!,请跟管理员联系。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
    freezpay=rs("freezpay")
    conn.execute"update [dv_user] set userWealth=userWealth-'"&freezpay&"' where username='"&username&"'"
	call logs("用户","宠物事务管理",dvbbs.membername)
	
    conn1.execute"update [sheep] set logintoday=date() where sheepname='"&sheepname&"' and username='"&username&"'"
    conn1.execute"update [sheep] set freez=not(freez) where sheepname='"&sheepname&"' and username='"&username&"'"
	sucmsg=sucmsg+"<br>"+"<li>您的操作信息已经记录在案"
	call bank_suc("checksheep.asp?id="&id)
end sub
sub eat()
dim username,sheepname,sheeptype,id
username=dvbbs.membername
if username=""  then
response.redirect"login.asp"
exit sub
end if
sheepname=request.form("sheepname")
id=request.form("id")
if sheepname="" then
response.redirect"login.asp"
exit sub
end if
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>您不是小宠物的主人,无权照料。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
dim eatdel
dim eatplushungry
dim eatplusmilk
sheeptype=rs("type")
rs.close
rs.open"select * from rules where type='"&sheeptype&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>没有找到"&sheeptype&"的照料规则!!,请跟管理员联系。"
	dvbbs.founderr=true
    dvbbs_error() 
exit sub
end if
eatdel=rs("eatdel")
eatplushungry=rs("eatplushungry")
eatplusmilk=rs("eatplusmilk")
rs.close
rs.open"select userWealth from [dv_user] where username='"&username&"'",conn,1,1
dim tempuserWealth
tempuserWealth=rs("userWealth")-eatdel
if tempuserWealth<0 then
Errmsg=Errmsg+"<li>照顾一次需要"&eatdel&"元,您没有足够的钱!先去工作赚点钱吧!!"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
rs.close
conn.close
exit sub
end if
rs.close
dim feeddate
dim workload
dim hungry
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
feeddate=rs("feeddate")
workload=rs("workload")
hungry=rs("hungry")+eatplushungry
if hungry>100 then
hungry=100
end if
dim milk
milk=rs("milk")+eatplusmilk
rs.close
if datediff("d",feeddate,date)<>0 then 
dim tempdate
tempdate=date
conn1.execute"update sheep set milk='"&milk&"',hungry='"&hungry&"',feeddate='"&date&"',feedsheepday=feedsheepday+1,workload='1' where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&eatdel&"' where username='"&username&"'"
sucmsg=sucmsg+"<br>"+"<li>喂养完毕!"
call bank_suc("checksheep.asp?id="&id)
exit sub
end if
if workload>=3 then
conn1.close
	Errmsg=Errmsg+"<br>"+"<li>今天您已经照顾"&sheeptype&"三次了!"&sheeptype&"需要休息了,明天再来吧"
	dvbbs.FoundIsChallenge=true
call bank_err("checksheep.asp?id="&id)
exit sub
end if
conn1.execute"update sheep set milk='"&milk&"',hungry='"&hungry&"',workload=workload+1 where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&eatdel&"' where username='"&username&"'"
conn.close
sucmsg=sucmsg+"<br>"+"<li>喂养完毕!"
call bank_suc("checksheep.asp?id="&id)
exit sub
end sub
sub sun()
username=request.cookies("aspsky")("username")
dim username,sheepname,sheeptype,id
username=dvbbs.membername
if username=""  then
response.redirect"login.asp"
exit sub
end if
sheepname=request.form("sheepname")
id=request.form("id")
if sheepname="" then
Errmsg=Errmsg+"<li>宠物名字不能为空,请填写宠物名字。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>您不是小宠物的主人,无权照料。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
sheeptype=rs("type")
rs.close
rs.open"select * from rules where type='"&sheeptype&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>没有找到"&sheeptype&"的照料规则!!,请跟管理员联系。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
dim sundel
dim sunplushealth
dim sunplusmilk
sundel=rs("sundel")
sunplushealth=rs("sunplushealth")
sunplusmilk=rs("sunplusmilk")
rs.close
dim tempuserWealth
rs.open"select userWealth from [dv_user] where username='"&username&"'",conn,1,1
tempuserWealth=rs("userWealth")-sundel
if tempuserWealth<0 then
Errmsg=Errmsg+"<li>照顾一次需要"&sundel&"元,您没有足够的钱!先去工作赚点钱吧!!"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
rs.close
conn.close
exit sub
end if
rs.close
dim feeddate
dim workload
dim sheephealth
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
feeddate=rs("feeddate")
workload=rs("workload")
sheephealth=rs("sheephealth")+sunplushealth
if sheephealth>100 then
sheephealth=100
end if
dim milk,tempdate
milk=rs("milk")+sunplusmilk
rs.close
if datediff("d",feeddate,date)<>0 then 
tempdate=date
conn1.execute"update sheep set milk='"&milk&"',sheephealth='"&sheephealth&"',feeddate='"&date&"',feedsheepday=feedsheepday+1,workload='1' where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&sundel&"' where username='"&username&"'"
sucmsg=sucmsg+"<br>"+"<li>日光浴完毕!"
call bank_suc("checksheep.asp?id="&id)
exit sub
end if
if workload>=3 then
conn1.close
	Errmsg=Errmsg+"<br>"+"<li>今天您已经照顾"&sheeptype&"三次了!"&sheeptype&"需要休息了,明天再来吧"
	dvbbs.FoundIsChallenge=true
call bank_err("checksheep.asp?id="&id)
exit sub
end if
conn1.execute"update sheep set milk='"&milk&"',sheephealth='"&sheephealth&"',workload=workload+1 where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&sundel&"' where username='"&username&"'"
conn.close
sucmsg=sucmsg+"<br>"+"<li>日光浴完毕!"
call bank_suc("checksheep.asp?id="&id)
end sub

sub pei()
username=request.cookies("aspsky")("username")
dim username,sheepname,sheeptype,id
username=dvbbs.membername
if username=""  then
response.redirect"login.asp"
exit sub
end if
sheepname=request.form("sheepname")
id=request.form("id")
if sheepname="" then
Errmsg=Errmsg+"<li>宠物名字不能为空,请填写宠物名字。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Dvbbs.AddErrMsg("<li>您不是小宠物的主人,无权照料。")
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
sheeptype=rs("type")
rs.close
rs.open"select * from rules where type='"&sheeptype&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>没有找到"&sheeptype&"的照料规则!!,请跟管理员联系。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
dim peidel
dim peiplushappy
dim peipluslife
peidel=rs("peidel")
peiplushappy=rs("peiplushappy")
peipluslife=rs("peipluslife")
rs.close
dim tempuserWealth
rs.open"select userWealth from [dv_user] where username='"&username&"'",conn,1,1
tempuserWealth=rs("userWealth")-peidel
if tempuserWealth<0 then
Errmsg=Errmsg+"<li>照顾一次需要"&peidel&"元,您没有足够的钱!先去工作赚点钱吧!!"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
rs.close
conn.close
exit sub
end if
rs.close
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
dim feeddate
dim workload
dim sheephappy
feeddate=rs("feeddate")
workload=rs("workload")
sheephappy=rs("sheephappy")+peiplushappy
if sheephappy>100 then
sheephappy=100
end if
dim life
life=rs("life")+peipluslife
if life>100 then
life=100
end if
rs.close
if datediff("d",feeddate,date)<>0 then 
dim tempdate
tempdate=date
conn1.execute"update sheep set life='"&life&"',sheephappy='"&sheephappy&"',feeddate='"&date&"',feedsheepday=feedsheepday+1,workload='1' where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&peidel&"' where username='"&username&"'"

sucmsg=sucmsg+"<br>"+"<li>陪伴完毕!"
call bank_suc("checksheep.asp?id="&id)
exit sub
end if

if workload>=3 then
conn1.close
	Errmsg=Errmsg+"<br>"+"<li>今天您已经照顾"&sheeptype&"三次了!"&sheeptype&"需要休息了,明天再来吧"
     dvbbs.FoundIsChallenge=true
call bank_err("checksheep.asp?id="&id)
exit sub
end if

conn1.execute"update sheep set life='"&life&"',sheephappy='"&sheephappy&"',workload=workload+1 where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&peidel&"' where username='"&username&"'"
conn.close
sucmsg=sucmsg+"<br>"+"<li>陪伴完毕!"
call bank_suc("checksheep.asp?id="&id)
end sub
sub clean()
dim username,sheepname,sheeptype,id
username=dvbbs.membername
if username=""  then
response.redirect"login.asp"
else
sheepname=request.form("sheepname")
id=request.form("id")
if sheepname="" then
response.redirect"login.asp"
else
end if
end if
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>您不是这只小宠物的主人,无权照料。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
exit sub
end if
sheeptype=rs("type")
rs.close
rs.open"select * from rules where type='"&sheeptype&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+"<li>没有找到"&sheeptype&"的照料规则!!,请跟管理员联系。"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
	exit sub
end if
dim cleandel
dim cleanplusclean
dim cleanpluslife
cleandel=rs("cleandel")
cleanplusclean=rs("cleanplusclean")
cleanpluslife=rs("cleanpluslife")
rs.close
dim tempuserWealth
rs.open"select userWealth from [dv_user] where username='"&username&"'",conn,1,1
tempuserWealth=rs("userWealth")-cleandel
if tempuserWealth<0 then
Errmsg=Errmsg+"<li>照顾一次需要"&cleandel&"元,您没有足够的钱!先去工作赚点钱吧!!"
	dvbbs.FoundIsChallenge=true
    dvbbs_error() 
rs.close
conn.close
exit sub
end if
rs.close
rs.open"select * from sheep where sheepname='"&sheepname&"' and username='"&username&"'",conn1,1,1
dim feeddate
dim workload
dim clean
feeddate=rs("feeddate")
workload=rs("workload")
clean=rs("clean")+cleanplusclean
if clean>100 then
clean=100
end if
dim life
life=rs("life")+cleanpluslife
if life>100 then
life=100
end if
rs.close
if datediff("d",feeddate,date)<>0 then 
dim tempdate
tempdate=date
'dim tempuserWealth
'tempuserWealth=10
conn1.execute"update sheep set life='"&life&"',clean='"&clean&"',feeddate='"&date&"',feedsheepday=feedsheepday+1,workload='1' where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&cleandel&"' where username='"&username&"'"
sucmsg=sucmsg+"<br>"+"<li>清洗完毕!"
call bank_suc("checksheep.asp?id="&id)
else
if workload>=3 then
conn1.close
	Errmsg=Errmsg+"<br>"+"<li>今天您已经照顾"&sheeptype&"三次了!"&sheeptype&"需要休息了,明天再来吧"
	dvbbs.FoundIsChallenge=true
call bank_err("checksheep.asp?id="&id)
exit sub
end if
'tempuserWealth=10
conn1.execute"update sheep set life='"&life&"',clean='"&clean&"',workload=workload+1 where sheepname='"&sheepname&"' and username='"&username&"'"
conn.execute"update [dv_user] set userWealth=userWealth-'"&cleandel&"' where username='"&username&"'"
conn.close

sucmsg=sucmsg+"<br>"+"<li>清洗完毕!"
call bank_suc("checksheep.asp?id="&id)
end if
end sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -