📄 sale.asp
字号:
<%@ Language=VBScript %>
<%
if Session.Contents("UserName")="" then
%>
<script language="vbscript">
MsgBox "不能进入,你还没有登录"
location.href = "../index.htm"
</script>
<%
else
sid=Request.Form ("sid")
ushare=abs(Request.Form ("ushare"))
dim username
username=Session.Contents("UserName")
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("stock.asp")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
set uconn=server.createobject("adodb.connection")
DBPath = Server.MapPath("../../data/members.asp")
uconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
set rs_s=conn.execute ("select sprice_y,sshare,sprice_t from stock where sid="&sid)
set rs_u=conn.execute ("select indate,ushare,inprice,lastcount from ustock where sid="&sid&" and username='"&username&"'")
set rs_c=uconn.execute ("select * from users where name='"&username&"'")
if rs_u("indate")>=date() then
Response.Redirect ("ndate.html")
else
if CSng(rs_s("sprice_t"))/CSng(rs_s("sprice_y"))<0.9 then
response.write "<link rel='stylesheet' type='text/css' href='../style1.css'><table border=0 width='100%' bgcolor=#FBE651 cellspacing=0 cellpadding=0><tr><td width='100%' height=20><p align=center>股票跌停不能进行交易</td></tr></table><dl><dd align='center'><p align='center'><a href=index.asp>返回股票交易大厅</a></p></dd></dl>"
else
dsshare=rs_s("sshare")+ushare
addmoney=ushare*rs_s("sprice_t")
if rs_u.eof then
Response.Redirect ("nserror.html")
else
dushare=rs_u("ushare")-ushare
if dushare<0 then
Response.Redirect ("userror.html")
elseif datediff("d",now,rs_u("indate"))=0 and ushare > rs_u("ushare")-rs_u("lastcount") then
Response.Redirect ("ndate.html")
elseif dushare=0 then
sprice=((dsshare-ushare)/dsshare)*rs_s("sprice_t")
conn.execute "update stock set sprice_t="&sprice&", sshare="&dsshare&" where sid="&sid
conn.execute "delete from ustock where username='"&username&"' and sid="&sid
uconn.execute "update users set cash=cash+"&addmoney&" where name='"&username&"'"
'session("umoney")=dumoney
else
sprice=((dsshare-ushare)/dsshare)*rs_s("sprice_t")
conn.execute "update stock set sprice_t="&sprice&", sshare="&dsshare&" where sid="&sid
conn.execute "update ustock set ushare="&dushare&" where username='"&username&"' and sid="&sid
uconn.execute "update users set cash=cash+"&addmoney&" where name='"&username&"'"
'session("umoney")=dumoney
end if
end if
%>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0">
<link rel="stylesheet" type="text/css" href="../style1.css">
<title>股票交易成功</title>
<link rel="stylesheet" href="../../CSS/STYLE.CSS">
</head>
<body bgcolor="#FFFEF4">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr bgcolor="#FFFAE1">
<td width="100%" height="20">
<p align="center"><span class="p"><font color="#006633">你已经成功的买出了</font></span>
</td>
</tr>
</table>
<dl>
<dd align="center"><p align="center"><a href="index.asp">返回股票交易大厅</a></p>
</dd>
</dl>
</body>
</html>
<%end if
end if
end if
%>
<%conn.close
set conn=nothing
uconn.close
set uconn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -