<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/ex_stock/ex_sm_conn.asp"-->
<!--#include file="inc/ex_stock/ex_sm_const.asp"-->
<%
	dim se_info
	se_info=split(exsm.stockdata(13,0),",")
	if not exsm.members then
		exsm.errmess="您还没有股票帐户，不能使用服务功能，请先开户。"
		call exsm.endinfo("no")
	elseif cint(se_info(0))=0 then
		exsm.errmess="股市服务功能暂时关闭，请等待开放。"
		call exsm.endinfo("no")
	elseif round(se_info(1),2)<=0 and round(se_info(2),2)<=0 and round(se_info(3),2)<=0 and round(se_info(4),2)<=0 and round(se_info(5),2)<=0 and round(se_info(6),2)<=0 and round(se_info(7),2)<=0 and round(se_info(8),2)<=0 and round(se_info(9),2)<=0 then
		exsm.errmess="股市服务功能暂时关闭，请等待开放。"
		call exsm.endinfo("no")
	elseif round(exsm.usercash,2)>round(9999999999999.99,2) then
		exsm.rurl="ex_sm_mymanage.asp"
		exsm.errmess="您帐户中资金大于["&formatnumber(9999999999999.99,2,-1)&"]元，不能使用服务功能。"
		call exsm.endinfo("no")
	else
		select case request("action")
			case "rbuylimit"
				call rbuylimit()
			case "saverbuylimit"
				call saverbuylimit()
			case "rselllimit"
				call rselllimit()
			case "saverselllimit"
				call saverselllimit()
			case "rtlimit"
				call rtlimit()
			case "savertlimit"
				call savertlimit()
			case "rsblimit"
				call rsblimit()
			case "saversblimit"
				call saversblimit()
			case "savebuynumlimit"
				call savebuynumlimit()
			case "savesellnumlimit"
				call savesellnumlimit()
			case "saveralllimit"
				call saveralllimit()
			case "exeditname"
				call exeditname()
			case "saveexeditname"
				call saveexeditname()
			case "saveanna"
				call saveanna()
			case else
				call main()
		end select
	end if
	sub main()
		dim trade_info
		exsm.title 1,"股市服务"
		trade_info=split(exsm.stockdata(10,0),",")
		session("ex_sm")=0
		exsm.reloadon=0
%>
		<table class="tableborder1" cellspacing="1" cellpadding="3" align="center" border="0">
			<tr>
				<th colspan="2" height="25">-=> 股 市 服 务 <=-</th>
			</tr>
			<%if round(se_info(1),2)>0 then%>
			<form method="post" name="f2" action="?action=rbuylimit">
			<tr>
				<td class="tablebody1" width="50%"><u>解除某股票再次买入时间限制</u><br>购买后可以解除单只股票再次买入时间限制。</td>
				<td class="tablebody1" width="50%">&nbsp;<input type="submit" name="submit" value="购买">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(1),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(2),2)>0 then%>
			<form method="post" name="f2" action="?action=rselllimit">
			<tr>
				<td class="tablebody2" width="50%"><u>解除某股票再次卖出时间限制</u><br>购买后可以解除单只股票再次卖出时间限制。</td>
				<td class="tablebody2" width="50%">&nbsp;<input type="submit" name="submit" value="购买">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(2),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(3),2)>0 then%>
			<form method="post" name="f3" action="?action=rtlimit">
			<tr>
				<td class="tablebody1" width="50%"><u>解除某股票[T+0]、买入时间限制</u><br>购买后可以解除单只股票[T+0]及买入时间限制。</td>
				<td class="tablebody1" width="50%">&nbsp;<input type="submit" name="submit" value="购买">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(3),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(4),2)>0 then%>
			<form method="post" name="f4" action="?action=rsblimit">
			<tr>
				<td class="tablebody2" width="50%"><u>解除分红操作时间限制</u><br>购买后可以解除分红操作时间限制。</td>
				<td class="tablebody2" width="50%">&nbsp;<input type="submit" name="submit" value="购买" onclick="javascript:{if(confirm('您确定要购买解除分红操作时间限制吗？此次购买需要资金[<%=formatnumber(se_info(4),2,-1)%>]元。')){return true;}return false;}">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(4),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(5),2)>0 and trade_info(16)>0 then%>
			<form method="post" name="f4" action="?action=savebuynumlimit">
			<tr>
				<td class="tablebody1" width="50%"><u>复位买入次数限制</u><br>购买后可以重新获得买入次数。</td>
				<td class="tablebody1" width="50%">&nbsp;<input type="submit" name="submit" value="购买" onclick="javascript:{if(confirm('您确定要购买复位买入次数限制吗？此次购买需要资金[<%=formatnumber(se_info(5),2,-1)%>]元。')){return true;}return false;}">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(5),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(6),2)>0 and trade_info(17)>0 then%>
			<form method="post" name="f4" action="?action=savesellnumlimit">
			<tr>
				<td class="tablebody2" width="50%"><u>复位卖出次数限制</u><br>购买后可以重新获得卖出次数。</td>
				<td class="tablebody2" width="50%">&nbsp;<input type="submit" name="submit" value="购买" onclick="javascript:{if(confirm('您确定要购买复位卖出次数限制吗？此次购买需要资金[<%=formatnumber(se_info(6),2,-1)%>]元。')){return true;}return false;}">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(6),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(7),2)>0 then%>
			<form method="post" name="f5" action="?action=saveralllimit">
			<tr>
				<td class="tablebody1" width="50%"><u>解除所有时间限制</u><br>购买后可以解除所有时间（买卖次数）限制。</td>
				<td class="tablebody1" width="50%">&nbsp;<input type="submit" name="submit" value="购买" onclick="javascript:{if(confirm('您确定要购买解除所有时间限制吗？此次购买需要资金[<%=formatnumber(se_info(7),2,-1)%>]元。')){return true;}return false;}">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(7),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
			<%if round(se_info(9),2)>0 then%>
			<form method="post" name="f5" action="?action=exeditname">
			<tr>
				<td class="tablebody2" width="50%"><u>更改用户名</u><br>更改自已在股市的用户名。</td>
				<td class="tablebody2" width="50%">&nbsp;<input type="submit" name="submit" value="购买">&nbsp;单价：<font color="#ff0000"><%=formatnumber(se_info(9),2,-1)%></font> 元</td>
			</tr>
			</form>
			<%end if%>
		</table>
		<%if round(se_info(8),2)>0 then%>
		<br>
		<table class="tableborder1" cellspacing="1" cellpadding="3" align="center" border="0">
			<tr>
				<th colspan="2" height="25">-=> 发 布 公 告 <=-</th>
			</tr>
			<form method="post" name="form" action="?action=saveanna">
			<tr>
    				<td class="tablebody1" width="30%"><b>用 户 名</b>：</td>
				<td class="tablebody1"><%=exsm.stockholder%><input name="username" type="hidden" value="<%=exsm.stockholder%>"></td>
			</tr>
			<tr>
				<td class="tablebody2"><b>标　　题</b>：<br>发布公告主题请控制在[100]byte以内</td>
				<td class="tablebody2"><input type="text" name="anntitle" size="60"></td>
			</tr>
			<tr>
				<td class="tablebody1"><b>颜　　色</b>：<br>发布公告内容颜色</td>
				<td class="tablebody1">
				<select name="color">
					<option style="background-color:black;color: black" value="black" selected> black </option>
					<option style="background-color:blue;color: blue" value="blue"> blue </option>
					<option style="background-color:red;color: red" value="red"> red </option>
					<option style="background-color:olive;color: olive" value="olive"> olive </option>
					<option style="background-color:teal;color: teal" value="teal"> teal </option>
					<option style="background-color:maroon;color: maroon" value="maroon"> maroon </option>
					<option style="background-color:navy;color: navy" value="navy"> navy</option>
					<option style="background-color:gray;color: gray" value="gray"> gray</option>
					<option style="background-color:lime;color: lime" value="lime"> lime</option>
					<option style="background-color:fuchsia;color: fuchsia" value="fuchsia"> fuchsia </option>
					<option style="background-color:yellow;color: yellow" value="yellow"> yellow </option>
					<option style="background-color:green;color: green" value="green"> green</option>
					<option style="background-color:purple;color: purple" value="purple"> purple</option>
				</select>
				</td>
			</tr>
			<tr>
				<td class="tablebody2" valign="top"><b>内　　容</b>：<br>控制在[500]byte以内<br><br>html 语法 支持<br>ubb 语法 不支持<br><br>单价：<font color="#ff0000"><%=formatnumber(se_info(8),2,-1)%></font> 元。</td>
				<td class="tablebody2"><textarea cols="60" name="content" rows="8"></textarea></td>
			</tr>
			<tr>
				<td class="tablebody1" colspan="2" align="center"><input type="submit" name="submit" value="发布">&nbsp;&nbsp;<input type="reset" name="submit" value="重填"></td>
			</tr>
			</form>
		</table>
		<%end if%>
<%
		exsm.rootshow
	end sub
	sub rbuylimit()
		dim trade_info,rsl
		trade_info=split(exsm.stockdata(10,0),",")
		if round(se_info(1),2)<=0 then
			exsm.errmess="解除某股票再次买入时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rsl=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff(n,buytime,"&sqlsmnowstring&")<"&round(trade_info(14))&"")
		else
			set rsl=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff('n',buytime,"&sqlsmnowstring&")<"&round(trade_info(14))&"")
		end if
		if not rsl.eof then
			exsm.title 1,"解除某股票再次买入时间限制"
			session("ex_sm")=0
			exsm.reloadon=0
			exsm.rurl=request.servervariables("http_referer")
			response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
			response.write "<tr><th height=""25"">-=> 解 除 某 股 票 再 次 买 入 时 间 限 制 <=-</th></tr>"
			response.write "<form method=""post"" name=""form"" action=""?action=saverbuylimit"">"
			response.write "<tr><td class=""tablebody1"" align=""center"">"
			response.write "<br><font color=""#3366cc"">您的股票帐户里现有资金[<font color=""#9900cc"">"&formatnumber(exsm.usercash,2,-1)&"</font>]元</font><br><br>请选择要解除再次买入时间限制的股票：&nbsp;<select name=""stockid"">"
			do while not rsl.eof
				response.write "<option value="""&rsl("sid")&""">"&rsl("company")&"</option>"
			rsl.movenext
			loop
			response.write "</select>&nbsp;<input type=""submit"" name=""submit"" value=""解除"">"
			response.write "<br><br><font color=""#3366cc"">此次解除需要资金[<font color=""#006633"">"&formatnumber(se_info(1),2,-1)&"</font>]元</font><br><br></td></tr>"
			response.write "<input type=""hidden"" name=""rurl"" value="""&exsm.rurl&""">"
			response.write "</form>"
			response.write "</table>"
			exsm.rootshow
		else
			exsm.errmess="您还没有可以使用该服务的股票。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub saverbuylimit()
		dim trade_info,stockid,l_content
		trade_info=split(exsm.stockdata(10,0),",")
		stockid=request.form("stockid")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(1),2)<=0 then
			exsm.errmess="解除某股票再次买入时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if stockid="" or not isnumeric(stockid) then
			exsm.errmess="没有输入参数或参数非法。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(1),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(1),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff(n,buytime,"&sqlsmnowstring&")<"&round(trade_info(14))&"")
		else
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff('n',buytime,"&sqlsmnowstring&")<"&round(trade_info(14))&"")
		end if
		if not rs.eof then
			if issqlsmdatabase=1 then
				stock_conn.execute("update ex_customer set buytime=dateadd(n,"&round(-trade_info(14))&",buytime) where userid="&exsm.userid&" and sid="&stockid&"")
			else
				stock_conn.execute("update ex_customer set buytime=dateadd('n',"&round(-trade_info(14))&",buytime) where userid="&exsm.userid&" and sid="&stockid&"")
			end if
			stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(1),2)&",userassets=userassets-"&round(se_info(1),2)&" where id="&exsm.userid&"")
			set rs=stock_conn.execute("select company from ex_stock where sid="&stockid&"")
			l_content=replace("资金流向：用户["&exsm.stockholder&"]解除["&rs("company")&"]股票再次买入时间限制 ","'","")
			call exsm.savelog(exsm.scriptname,l_content,6)
			session("ex_sm")=1
			exsm.rurl=request("rurl")
			exsm.sucmess="解除某股票再次买入时间限制提交成功。"
			call exsm.endinfo("ok")
		else
			exsm.errmess="您还没有可以使用该服务的股票。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub rselllimit()
		dim trade_info,rsl
		trade_info=split(exsm.stockdata(10,0),",")
		if round(se_info(2),2)<=0 then
			exsm.errmess="解除某股票再次卖出时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rsl=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff(n,selltime,"&sqlsmnowstring&")<"&round(trade_info(15))&"")
		else
			set rsl=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff('n',selltime,"&sqlsmnowstring&")<"&round(trade_info(15))&"")
		end if
		if not rsl.eof then
			exsm.title 1,"解除某股票再次卖出时间限制"
			session("ex_sm")=0
			exsm.reloadon=0
			exsm.rurl=request.servervariables("http_referer")
			response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
			response.write "<tr><th height=""25"">-=> 解 除 某 股 票 再 次 卖 出 时 间 限 制 <=-</th></tr>"
			response.write "<form method=""post"" name=""form"" action=""?action=saverselllimit"">"
			response.write "<tr><td class=""tablebody1"" align=""center"">"
			response.write "<br><font color=""#3366cc"">您的股票帐户里现有资金[<font color=""#9900cc"">"&formatnumber(exsm.usercash,2,-1)&"</font>]元</font><br><br>请选择要解除再次卖出时间限制的股票：&nbsp;<select name=""stockid"">"
			do while not rsl.eof
				response.write "<option value="""&rsl("sid")&""">"&rsl("company")&"</option>"
			rsl.movenext
			loop
			response.write "</select>&nbsp;<input type=""submit"" name=""submit"" value=""解除"">"
			response.write "<br><br><font color=""#3366cc"">此次解除需要资金[<font color=""#006633"">"&formatnumber(se_info(2),2,-1)&"</font>]元</font><br><br></td></tr>"
			response.write "<input type=""hidden"" name=""rurl"" value="""&exsm.rurl&""">"
			response.write "</form>"
			response.write "</table>"
			exsm.rootshow
		else
			exsm.errmess="您还没有可以使用该服务的股票。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub saverselllimit()
		dim trade_info,stockid,l_content
		trade_info=split(exsm.stockdata(10,0),",")
		stockid=request.form("stockid")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(2),2)<=0 then
			exsm.errmess="解除某股票再次卖出时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if stockid="" or not isnumeric(stockid) then
			exsm.errmess="没有输入参数或参数非法。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(2),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(2),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff(n,buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		else
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff('n',buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		end if
		if not rs.eof then
			exsm.errmess="您持有的股票["&rs("company")&"]处于[T+0]限制中，请使用解除[T+0]服务。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff(n,selltime,"&sqlsmnowstring&")<"&round(trade_info(15))&"")
		else
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff('n',selltime,"&sqlsmnowstring&")<"&round(trade_info(15))&"")
		end if
		if not rs.eof then
			if issqlsmdatabase=1 then
				stock_conn.execute("update ex_customer set selltime=dateadd(n,"&round(-trade_info(15))&",selltime) where userid="&exsm.userid&" and sid="&stockid&"")
			else
				stock_conn.execute("update ex_customer set selltime=dateadd('n',"&round(-trade_info(15))&",selltime) where userid="&exsm.userid&" and sid="&stockid&"")
			end if
			stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(2),2)&",userassets=userassets-"&round(se_info(2),2)&" where id="&exsm.userid&"")
			set rs=stock_conn.execute("select company from ex_stock where sid="&stockid&"")
			l_content=replace("资金流向：用户["&exsm.stockholder&"]解除["&rs("company")&"]股票再次卖出时间限制 ","'","")
			call exsm.savelog(exsm.scriptname,l_content,6)
			session("ex_sm")=1
			exsm.rurl=request("rurl")
			exsm.sucmess="解除某股票再次卖出时间限制提交成功。"
			call exsm.endinfo("ok")
		else
			exsm.errmess="您还没有可以使用该服务的股票。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub rtlimit()
		dim trade_info,rsl
		trade_info=split(exsm.stockdata(10,0),",")
		if round(se_info(3),2)<=0 then
			exsm.errmess="解除某股票[T+0]时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rsl=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff(n,buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		else
			set rsl=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff('n',buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		end if
		if not rsl.eof then
			exsm.title 1,"解除某股票[T+0]时间限制"
			session("ex_sm")=0
			exsm.reloadon=0
			exsm.rurl=request.servervariables("http_referer")
			response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
			response.write "<tr><th height=""25"">-=> 解 除 某 股 票 [T+0] 时 间 限 制 <=-</th></tr>"
			response.write "<form method=""post"" name=""form"" action=""?action=savertlimit"">"
			response.write "<tr><td class=""tablebody1"" align=""center"">"
			response.write "<br><font color=""#3366cc"">您的股票帐户里现有资金[<font color=""#9900cc"">"&formatnumber(exsm.usercash,2,-1)&"</font>]元</font><br><br>请选择要解除[T+0]时间限制的股票：&nbsp;<select name=""stockid"">"
			do while not rsl.eof
				response.write "<option value="""&rsl("sid")&""">"&rsl("company")&"</option>"
			rsl.movenext
			loop
			response.write "</select>&nbsp;<input type=""submit"" name=""submit"" value=""解除"">"
			response.write "<br><br><font color=""#3366cc"">此次解除需要资金[<font color=""#006633"">"&formatnumber(se_info(3),2,-1)&"</font>]元</font><br><br></td></tr>"
			response.write "<input type=""hidden"" name=""rurl"" value="""&exsm.rurl&""">"
			response.write "</form>"
			response.write "</table>"
			exsm.rootshow
		else
			exsm.errmess="您还没有可以使用该服务的股票。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub savertlimit()
		dim trade_info,stockid,l_content
		trade_info=split(exsm.stockdata(10,0),",")
		stockid=request.form("stockid")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(3),2)<=0 then
			exsm.errmess="解除某股票[T+0]时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if stockid="" or not isnumeric(stockid) then
			exsm.errmess="没有输入参数或参数非法。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(3),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(3),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff(n,buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		else
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and sid="&stockid&" and datediff('n',buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		end if
		if not rs.eof then
			if issqlsmdatabase=1 then
				stock_conn.execute("update ex_customer set buytime=dateadd(n,"&round(-trade_info(7))&",buytime),selltime=dateadd(n,"&round(-trade_info(15))&",selltime) where userid="&exsm.userid&" and sid="&stockid&"")
			else
				stock_conn.execute("update ex_customer set buytime=dateadd('n',"&round(-trade_info(7))&",buytime),selltime=dateadd('n',"&round(-trade_info(15))&",selltime) where userid="&exsm.userid&" and sid="&stockid&"")
			end if
			stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(3),2)&",userassets=userassets-"&round(se_info(3),2)&" where id="&exsm.userid&"")
			set rs=stock_conn.execute("select company from ex_stock where sid="&stockid&"")
			l_content=replace("资金流向：用户["&exsm.stockholder&"]解除["&rs("company")&"]股票[T+0]时间限制 ","'","")
			call exsm.savelog(exsm.scriptname,l_content,6)
			session("ex_sm")=1
			exsm.rurl=request("rurl")
			exsm.sucmess="解除某股票[T+0]时间限制提交成功。"
			call exsm.endinfo("ok")
		else
			exsm.errmess="您还没有可以使用该服务的股票。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub rsblimit()
		dim sb_info,l_content
		sb_info=split(exsm.stockdata(12,0),",")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(4),2)<=0 then
			exsm.errmess="解除分红操作时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(4),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(4),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_user where id="&exsm.userid&" and datediff(n,sharebonusdate,"&sqlsmnowstring&")<"&round(sb_info(3))&"")
		else
			set rs=stock_conn.execute("select * from ex_user where id="&exsm.userid&" and datediff('n',sharebonusdate,"&sqlsmnowstring&")<"&round(sb_info(3))&"")
		end if
		if not rs.eof then
			if issqlsmdatabase=1 then
				stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(4),2)&",userassets=userassets-"&round(se_info(4),2)&",sharebonusdate=dateadd(n,"&round(-sb_info(3))&",sharebonusdate) where id="&exsm.userid&"")
			else
				stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(4),2)&",userassets=userassets-"&round(se_info(4),2)&",sharebonusdate=dateadd('n',"&round(-sb_info(3))&",sharebonusdate) where id="&exsm.userid&"")
			end if
			l_content=replace("资金流向：用户["&exsm.stockholder&"]解除分红操作时间限制 ","'","")
			call exsm.savelog(exsm.scriptname,l_content,6)
			session("ex_sm")=1
			exsm.sucmess="解除分红操作时间限制提交成功。"
			call exsm.endinfo("ok")
		else
			exsm.errmess="您暂时不需要该服务。"
			call exsm.endinfo("no")
			exit sub
		end if
	end sub
	sub savebuynumlimit()
		dim trade_info,l_content
		trade_info=split(exsm.stockdata(10,0),",")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(5),2)<=0 or trade_info(16)<=0 then
			exsm.errmess="复位买入次数限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(5),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(5),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select * from ex_user where id="&exsm.userid&" and todaybuy<>"&trade_info(16)&"")
		if not rs.eof then
			exsm.errmess="您买入次数未达到限制数量暂时不需要该服务。"
			call exsm.endinfo("no")
			exit sub
		end if
		stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(5),2)&",userassets=userassets-"&round(se_info(5),2)&",todaybuy=0 where id="&exsm.userid&"")
		l_content=replace("资金流向：用户["&exsm.stockholder&"]复位买入次数限制 ","'","")
		call exsm.savelog(exsm.scriptname,l_content,6)
		session("ex_sm")=1
		exsm.sucmess="复位买入次数限制提交成功。"
		call exsm.endinfo("ok")
	end sub
	sub savesellnumlimit()
		dim trade_info,l_content
		trade_info=split(exsm.stockdata(10,0),",")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(6),2)<=0 or trade_info(17)<=0 then
			exsm.errmess="复位卖出次数限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(6),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(6),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select * from ex_user where id="&exsm.userid&" and todaysell<>"&trade_info(17)&"")
		if not rs.eof then
			exsm.errmess="您卖出次数未达到限制数量暂时不需要该服务。"
			call exsm.endinfo("no")
			exit sub
		end if
		stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(6),2)&",userassets=userassets-"&round(se_info(6),2)&",todaysell=0 where id="&exsm.userid&"")
		l_content=replace("资金流向：用户["&exsm.stockholder&"]复位卖出次数限制 ","'","")
		call exsm.savelog(exsm.scriptname,l_content,6)
		session("ex_sm")=1
		exsm.sucmess="复位卖出次数限制提交成功。"
		call exsm.endinfo("ok")
	end sub
	sub saveralllimit()
		dim trade_info,sb_info,l_content
		trade_info=split(exsm.stockdata(10,0),",")
		sb_info=split(exsm.stockdata(12,0),",")
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(7),2)<=0 then
			exsm.errmess="解除所有时间限制服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(7),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(7),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff(n,buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		else
			set rs=stock_conn.execute("select * from ex_customer where userid="&exsm.userid&" and datediff('n',buytime,"&sqlsmnowstring&")<"&round(trade_info(7))&"")
		end if
		if not rs.eof then
			do while not rs.eof
				if issqlsmdatabase=1 then
					stock_conn.execute("update ex_customer set buytime=dateadd(n,"&round(-trade_info(7))&",buytime) where userid="&exsm.userid&" and sid="&rs("sid")&"")
				else
					stock_conn.execute("update ex_customer set buytime=dateadd('n',"&round(-trade_info(7))&",buytime) where userid="&exsm.userid&" and sid="&rs("sid")&"")
				end if
			rs.movenext
			loop
		end if
		if issqlsmdatabase=1 then
			set rs=stock_conn.execute("select * from ex_user where id="&exsm.userid&" and datediff(n,sharebonusdate,"&sqlsmnowstring&")<"&round(sb_info(3))&"")
		else
			set rs=stock_conn.execute("select * from ex_user where id="&exsm.userid&" and datediff('n',sharebonusdate,"&sqlsmnowstring&")<"&round(sb_info(3))&"")
		end if
		if not rs.eof then
			if issqlsmdatabase=1 then
				stock_conn.execute("update ex_user set sharebonusdate=dateadd(n,"&round(-sb_info(3))&",sharebonusdate) where id="&exsm.userid&"")
			else
				stock_conn.execute("update ex_user set sharebonusdate=dateadd('n',"&round(-sb_info(3))&",sharebonusdate) where id="&exsm.userid&"")
			end if
		end if
		stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(7),2)&",userassets=userassets-"&round(se_info(7),2)&",todaybuy=0,todaysell=0 where id="&exsm.userid&"")
		l_content=replace("资金流向：用户["&exsm.stockholder&"]解除所有时间限制 ","'","")
		call exsm.savelog(exsm.scriptname,l_content,6)
		session("ex_sm")=1
		exsm.sucmess="解除所有时间限制提交成功。"
		call exsm.endinfo("ok")
	end sub
	sub exeditname()
		dim reg_info,trade_info
		reg_info=split(exsm.stockdata(9,0),",")
		trade_info=split(exsm.stockdata(10,0),",")
		if round(se_info(9),2)<=0 then
			exsm.errmess="更改用户名服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		exsm.title 1,"更改自已在股市的用户名"
		session("ex_sm")=0
		exsm.reloadon=0
		exsm.rurl=request.servervariables("http_referer")
		response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
		response.write "<tr><th height=""25"">-=> 更 改 自 已 在 股 市 的 用 户 名 <=-</th></tr>"
		response.write "<form method=""post"" name=""form"" action=""?action=saveexeditname"">"
		response.write "<tr><td class=""tablebody1"" align=""center"">"
		response.write "<br><font color=""#3366cc"">您的股票帐户里现有资金[<font color=""#9900cc"">"&formatnumber(exsm.usercash,2,-1)&"</font>]元</font><br><br>*请文明用语！如发现恶意文字您的帐户将被锁定<br><br>请填写您在股市中的新名字：&nbsp;"
		response.write "<input type=""text"" name=""username"" maxlength="""&reg_info(7)&""" value="""&exsm.stockholder&""">&nbsp;<input type=""submit"" name=""submit"" value=""确定"">"
		response.write "<br><br>您在修改名称后[<a href=""ex_sm_mymanage.asp?action=userinfo"">帐户设置</a>]中“自动跟踪用户名”功能将自动关闭<br><br><font color=""#3366cc"">此次修改服务需要资金[<font color=""#006633"">"&formatnumber(se_info(9),2,-1)&"</font>]元</font><br><br></td></tr>"
		response.write "<input type=""hidden"" name=""rurl"" value="""&exsm.rurl&""">"
		response.write "</form>"
		response.write "</table>"
		exsm.rootshow
	end sub
	sub saveexeditname()
		dim reg_info,exeditname,mycontent,l_content
		reg_info=split(exsm.stockdata(9,0),",")
		exeditname=trim(replace(request.form("username"),"'",""))
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(9),2)<=0 then
			exsm.errmess="更改用户名服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(9),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(9),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exeditname="" or exeditname=exsm.stockholder or len(exeditname)>cint(reg_info(7)) then
			exsm.errmess="请正确输入用户名。"
			call exsm.endinfo("no")
			exit sub
		end if
		set rs=stock_conn.execute("select username from ex_user where username='"&exeditname&"'")
		if not rs.eof then
			exsm.errmess="您输入的用户名已经存在。<li>或您输入的用户名含有仅用字符，请重新填写用户名。"
			call exsm.endinfo("no")
			exit sub
		end if
		stock_conn.execute("update ex_user set username='"&exeditname&"',userwealth=userwealth-"&round(se_info(9),2)&",userassets=userassets-"&round(se_info(9),2)&",autoupname=0 where id="&exsm.userid&"")
		stock_conn.execute("update ex_customer set username='"&exeditname&"' where userid="&exsm.userid&"")
		stock_conn.execute("update ex_oneselfstock set username='"&exeditname&"' where userid="&exsm.userid&"")
		stock_conn.execute("update ex_stock set management='"&exeditname&"' where managementid="&exsm.userid&"")
		mycontent=replace("系统消息：股民["&exsm.stockholder&"]将用户名修改为["&exeditname&"]。","'","")
		stock_conn.execute("insert into ex_news (content,color,addtime) values('"&mycontent&"','"&exsm.rndcolor&"',"&sqlsmnowstring&")")
		exsm.delstockcahe("exsm_imitate_news")
		exsm.delstockcahe("exsm_imitate_usersequence")
		l_content=replace("资金流向：用户["&exsm.stockholder&"]将用户名修改为["&exeditname&"] ","'","")
		call exsm.savelog(exsm.scriptname,l_content,6)
		session("ex_sm")=1
		exsm.sucmess="您已经成功的修改了名称。"
		call exsm.endinfo("ok")
	end sub
	sub saveanna()
		dim anntitle,mycontent
		anntitle=trim(replace(request.form("anntitle"),"'",""))
		mycontent=trim(replace(request.form("content"),"'",""))
		if exsm.outsiderefer() then
			exsm.errmess="请不要从外部提交数据。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if exsm.repeatrefer() then
			exsm.errmess="您提交的数据已经保存，请不要重复提交。"
			call exsm.endinfo("stop.gif")
			exit sub
		end if
		if round(se_info(8),2)<=0 then
			exsm.errmess="发布公告服务暂时关闭，请等待开放。"
			call exsm.endinfo("no")
			exit sub
		end if
		if exsm.stockadmin then
			exsm.errmess="管理员["&exsm.stockholder&"]您好，请到后台进行公告发布。"
			call exsm.endinfo("no")
			exit sub
		end if
		if round(exsm.usercash,2)<round(se_info(8),2) then
			exsm.errmess="您股票帐户资金不足无法进行买入（您帐户资金["&formatnumber(exsm.usercash,2,-1)&"]元，购买需要["&formatnumber(se_info(8),2,-1)&"]元）。"
			call exsm.endinfo("no")
			exit sub
		end if
		if anntitle="" or exsm.syllable(anntitle)>100 then
			exsm.errmess="请输入公告标题，或主题长度大于了[100]byte。"
			call exsm.endinfo("no")
			exit sub
		end if
		if request("content")="" or exsm.syllable(request("content"))>500 then
			exsm.errmess="请输入公告内容，或内容长度大于了[500]byte。"
			call exsm.endinfo("no")
			exit sub
		end if
		stock_conn.execute("insert into ex_announcement (title,content,color,addtime,username) values ('"&anntitle&"','"&mycontent&"','"&replace(request.form("color"),"'","")&"',"&sqlsmnowstring&",'"&exsm.stockholder&"')")
		stock_conn.execute("update ex_user set userwealth=userwealth-"&round(se_info(8),2)&",userassets=userassets-"&round(se_info(8),2)&" where id="&exsm.userid&"")
		exsm.delstockcahe("exsm_imitate_ann")
		session("ex_sm")=1
		exsm.sucmess="您已经成功的发布了公告。"
		call exsm.endinfo("ok")
	end sub
%>