<%
'==========================
' file: ex_sm_const.asp
' writer: cnxk
' qq: 29510683
' web: http://www.czie.com
'==========================
exsm.st_setting
class cls_stock
	public placename,userip,scriptname,reloadon
	public forumname,bbsuserid,stockholder,stockadmin,hidename,assignwidth,cookiesplace,exsmuserinfo
	public reloadtime,stockdata,stock_setting,setting_info,members,userfreeze,userid,usercash
	public errmess,sucmess,rurl,definerurl
	private localplacename,cache_data
	private sub class_initialize()
		reloadtime=14400
		reloadon=1
		placename=replace(replace(replace(server.mappath("ex_sm_index.asp"),"ex_sm_index.asp",""),":",""),"\","")
		userip=request.servervariables("http_x_forwarded_for")
		if userip="" then userip=request.servervariables("remote_addr")
		dim tmpstr,i
		tmpstr=request.servervariables("path_info")
		tmpstr=split(tmpstr,"/")
		i=ubound(tmpstr)
		i=replace(i,"$","")
		i=replace(i,"'","")
		scriptname=lcase(tmpstr(i))
	end sub
	private sub usersession()
		dim tempuserid,exsmuserpage,autornda,autorndb,autotime,exsmtempsave,window
		window=request("window")
		if window="" or isnumeric(window)=0 then window=0
		'exsm_sn=lcase(replace(request.servervariables("server_name")&request.servervariables("url"),split(request.servervariables("script_name"),"/")(ubound(split(request.servervariables("script_name"),"/"))),""))
		tempuserid=replace(request.cookies("exsm_sn")("autouserid"),"'","")
		exsmuserpage=replace(request.cookies("exsm_sn")("exsmuserpage"),"'","")
		if tempuserid="" then
			randomize
			autornda=cint(rnd*197)+33
			randomize
			autorndb=cint(rnd*133)+97
			autotime=replace(tetime,".","")
			response.cookies("exsm_sn").expires=date+7
			response.cookies("exsm_sn")("autouserid")=autornda*autorndb+autotime
			response.cookies("exsm_sn")("exsmuserpage")=window
			response.cookies("exsm_sn").path=cookiesplace
			tempuserid=autornda*autorndb+autotime
			exsmuserpage=window
		end if
		exsmtempsave="exsm$$$"&now()&"$$$"&now()&"$$$"&tempuserid&"$$$"&now()&"$$$"&scriptname&"$$$"&now()&"$$$"&now()&"$$$"&now()&"$$$"&exsmuserpage&"$$$"&now()&""
		session(placename&"exsmteuserid")=split(exsmtempsave,"$$$")
	end sub
	public property let name(byval dataname)
		localplacename=lcase(dataname)
	end property
	public property let value(byval datacontent)
		if localplacename<>"" then
			redim cache_data(2)
			cache_data(0)=datacontent
			cache_data(1)=now()
			application.lock
			application(placename&"_"&localplacename)=cache_data
			application.unlock
		else
			response.write "readindataerror"
			response.end
		end if
	end property
	public property get value()
		if localplacename<>"" then
			cache_data=application(placename&"_"&localplacename)
			if isarray(cache_data) then
				value=cache_data(0)
			else
				response.write "readindataerror"
				response.end
			end if
		else
			response.write "readindataerror"
			response.end
		end if
	end property
	public function inspectisdata()
		inspectisdata=true
		cache_data=application(placename&"_"&localplacename)
		if not isarray(cache_data) then exit function
		if not isdate(cache_data(1)) then exit function
		if datediff("s",cdate(cache_data(1)),now())<(60*reloadtime) then inspectisdata=false
	end function
	public sub st_setting()
		forumname=dvbbs.forum_info(0)
		bbsuserid=dvbbs.userid
		stockholder=dvbbs.membername
		hidename=dvbbs.userhidden
		assignwidth=dvbbs.mainsetting(0)
		cookiesplace=dvbbs.cookiepath
		name="exsm_imitate_info"
		if inspectisdata() then getsetting
		stockdata=value
		name="exsm_imitate_quotations"
		if inspectisdata() then call getreload(1,1)
		if not isarray(session(placename&"exsmteuserid")) then usersession
		exsmuserinfo=session(placename&"exsmteuserid")
		name="exsm_imitate_date"
		if inspectisdata() then
			value=date()
			exsm_reset
		else
			if cstr(value)<>cstr(date()) or cstr(stockdata(5,0))<>cstr(date()) then exsm_reset
		end if
		stock_setting=split(stockdata(6,0),"|||")
		setting_info=split(stockdata(7,0),",")
		stockadmin=false
		set rs=stock_conn.execute("select id,username,userclass,lockuser,userwealth,autoupname from ex_user where userbbsid>0 and userbbsid="&bbsuserid&"")
		if not rs.eof then
			members=true
			userfreeze=false
			userid=rs("id")
			if rs("autoupname")=1 and stockholder<>rs("username") then
				call autousername()
			else
				stockholder=rs("username")
			end if
			if rs("userclass")=1 then stockadmin=true
			if rs("lockuser")=1 then userfreeze=true
			usercash=rs("userwealth")
		else
			members=false
			userfreeze=false
			userid=0
			usercash=0
		end if
		if not stockadmin then getstockstatus
	end sub
	private sub getstockstatus()
		if cint(setting_info(5))=0 and bbsuserid=0 then
			errmess="对不起，股市未对游客开放请您先[<a href=""login.asp"">登录</a>]或[<a href=""reg.asp"">注册</a>]。"
			call endinfo("noentry.gif")
			exit sub
		end if
		if userfreeze then
			errmess="您的股市帐户被冻结！请联系管理员。"
			call endinfo("lock.gif")
			exit sub
		end if
		if cint(setting_info(1))=0 then
			errmess="当前股市状态["&stockdata(15,0)&"]"
			call endinfo("no")
			exit sub
		end if
		if cint(setting_info(2))=1 then
			if hour(time)<cint(split(setting_info(3),"||")(0)) or hour(time)>=cint(split(setting_info(3),"||")(1)) then
				errmess="亲爱的股民您好！现在股市已经收市了，请每天的["&split(setting_info(3),"||")(0)&":00～"&split(setting_info(3),"||")(1)&":00]再来。谢谢合作！"
				call endinfo("rest.gif")
				exit sub
			end if
		end if
		if cint(setting_info(7))=1 then
			dim doreflashpage
			doreflashpage=false
			if not datediff("s",session(placename&"exsmteuserid")(1),now())<0.1 then
				if trim(setting_info(9))<>"" and instr(lcase(setting_info(9)),scriptname)>0 then doreflashpage=true
				if (not isempty(session(placename&"exsmteuserid")(1))) and cint(setting_info(6))>0 and doreflashpage then
					if datediff("s",session(placename&"exsmteuserid")(1),now())<cint(setting_info(8)) then
						exsm.title 2,""&setting_info(0)&"-错误提示"
						response.write "<meta http-equiv=refresh content="&setting_info(8)&"><div align=""left""><br>请不要连续刷新本页面，"&setting_info(8)&"秒之后将会自动打开页面。<br>正在打开页面，请稍等……</div>"
						response.end
					else
						exsmuserinfo(1)=now()
						session(placename&"exsmteuserid")=exsmuserinfo
					end if
				elseif isempty(session(placename&"exsmteuserid")(1)) and cint(setting_info(8))>0 and doreflashpage then
					exsmuserinfo(1)=now()
					session(placename&"exsmteuserid")=exsmuserinfo
				end if
			end if
		end if
	end sub
	private sub autousername()
		dim rst,se_nameon
		se_nameon=split(stockdata(13,0),",")
		set rst=stock_conn.execute("select username from ex_user where username='"&stockholder&"'")
		if not rst.eof then
			stock_conn.execute("update ex_user set autoupname=0 where id="&userid&"")
			definerurl="<a href=""ex_sm_mymanage.asp?action=userinfo"">转到帐户设置页</a>"
			if round(se_nameon(9),2)>0 then definerurl=definerurl&"<br><li><a href=""ex_sm_stockserve.asp?action=exeditname""><font color=""#ff0000"">转到手动更改用户名服务页</font></a>"
			errmess="您的用户名已经存在！系统无法完成自动同步。"
			call endinfo("sorry_.gif")
			exit sub
		end if
		stock_conn.execute("update ex_user set username='"&stockholder&"' where id="&userid&"")
		stock_conn.execute("update ex_customer set username='"&stockholder&"' where userid="&userid&"")
		stock_conn.execute("update ex_oneselfstock set username='"&stockholder&"' where userid="&userid&"")
		stock_conn.execute("update ex_stock set management='"&stockholder&"' where managementid="&userid&"")
	end sub
	public sub getsetting()
		set rs=stock_conn.execute("select * from ex_config")
		value=rs.getrows(1)
		set rs=nothing
	end sub
	public sub getreload(quota,online)
		dim qrs,quotations
		if quota=1 and online=1 then
			set qrs=stock_conn.execute("select top 1 todaybuy,todaysell,todaytotal,excolexp from ex_config order by id")
			quotations=""&qrs(0)&"|"&qrs(1)&"|"&qrs(2)&"|"&replace(formatnumber(qrs(3),2,-1),",","")&"|"&regusernum&"|"&guestusernum&"|"&now()&""
			value=split(quotations,"|")
		else
			quotations=value
			if quota=1 then
				set qrs=stock_conn.execute("select top 1 todaybuy,todaysell,todaytotal,excolexp from ex_config order by id")
				quotations(0)=qrs(0):quotations(1)=qrs(1):quotations(2)=qrs(2):quotations(3)=replace(formatnumber(qrs(3),2,-1),",","")
				value=quotations
			end if
			if online>=1 then
				quotations(4)=regusernum:quotations(5)=guestusernum
				if online>1 then quotations(6)=now()
				value=quotations
			end if
		end if
	end sub
	public sub delstockcahe(stockcahe)
		application.lock
		application.contents.remove(placename&"_"&lcase(stockcahe))
		application.unlock
	end sub
	private sub nowanalyse(inname)
		dim autouserid,quotations,guestname
		autouserid=clng(exsmuserinfo(3))
		if autouserid="" then exit sub
		if userid="" then userid=0
		name="exsm_imitate_quotations"
		quotations=value
		if ccur(userid)=0 then
			if stockholder<>"" then guestname=stockholder else guestname="客人"
			set rs=stock_conn.execute("select * from ex_analyse where statuserid='"&autouserid&"'")
			if rs.eof then
				stock_conn.execute("insert into ex_analyse(username,userip,usertime,nowseat,userid,movetime,hideuser,statuserid) values ('"&guestname&"','"&userip&"',"&sqlsmnowstring&",'"&replace(inname,"'","")&"','"&userid&"',"&sqlsmnowstring&",'"&hidename&"','"&autouserid&"')")
				call getreload(0,1)
			else
				stock_conn.execute("update ex_analyse set username='"&guestname&"',movetime="&sqlsmnowstring&",nowseat='"&replace(inname,"'","")&"',userid='"&userid&"',hideuser='"&hidename&"' where statuserid='"&autouserid&"'")
			end if
		else
			set rs=stock_conn.execute("select * from ex_analyse where userid="&ccur(userid)&"")
			if rs.eof then
				stock_conn.execute("insert into ex_analyse(username,userip,usertime,nowseat,userid,movetime,hideuser,statuserid) values ('"&stockholder&"','"&userip&"',"&sqlsmnowstring&",'"&replace(inname,"'","")&"','"&userid&"',"&sqlsmnowstring&",'"&hidename&"','"&autouserid&"')")
				call getreload(0,1)
			else
				stock_conn.execute("update ex_analyse set username='"&stockholder&"',movetime="&sqlsmnowstring&",nowseat='"&replace(inname,"'","")&"',userid='"&userid&"',hideuser='"&hidename&"' where userid="&ccur(userid)&"")
			end if
			stock_conn.execute("delete from ex_analyse where userid="&userid&" and usertime not in(select top 1 usertime from ex_analyse where userid="&userid&" order by usertime desc)")
		end if
		if datediff("s",quotations(6),now())>clng(setting_info(10))*10 then
			if issqlsmdatabase=1 then
				stock_conn.execute("delete from ex_analyse where datediff(s,movetime,"&sqlsmnowstring&") > "&setting_info(10)&"*60")
			else
				stock_conn.execute("delete from ex_analyse where datediff('s',movetime,"&sqlsmnowstring&") > "&setting_info(10)&"*60")
			end if
			call getreload(0,2)
		end if
		stock_conn.execute("delete from ex_analyse where statuserid='"&autouserid&"' and usertime not in(select top 1 usertime from ex_analyse where statuserid='"&autouserid&"' order by usertime desc)")
	end sub
	public sub title(dist,inname)
		dim exsmjava
		exsmjava="<script language=""javascript"" src=""inc/ex_stock/ex_sm_function.js""></script>"
		if exsmuserinfo(9)=0 then
			if dist=0 then
				dvbbs.stats=inname
				dvbbs.nav()
				dvbbs.head_var 2,0,"",""
				response.write exsmjava
			elseif dist=2 then
				dvbbs.stats=inname
				dvbbs.head()
			else
				dvbbs.stats=inname
				dvbbs.nav()
				dvbbs.head_var 0,0,""&setting_info(0)&"","ex_sm_index.asp"
				response.write exsmjava
				if dist=1 and not instr(scriptname,"admin")>0 then usermenu
			end if
		else
			dvbbs.stats=inname
			dvbbs.head()
			response.write exsmjava
			if dist=1 then nav:usermenu
		end if
		if cint(setting_info(10))>0 then
			dim activepagelasttime,lasttemppage
			activepagelasttime=session(placename&"exsmteuserid")(2)
			lasttemppage=session(placename&"exsmteuserid")(5)
			if not isdate(activepagelasttime) then activepagelasttime=now()
			if datediff("s",activepagelasttime,now())<60 and lasttemppage=scriptname then exit sub
			exsmuserinfo(2)=now()
			exsmuserinfo(5)=scriptname
			session(placename&"exsmteuserid")=exsmuserinfo
			call nowanalyse(inname)
		end if
		dvbbs.activeonline
	end sub
	public sub exsm_reset()
		dim rst,newtradesum,statement,highprice,lowprice
		set rst=stock_conn.execute("select top 1 todaydate from ex_config order by id")
		if not datediff("d",rst(0),now())<>0 then exit sub
		name="exsm_imitate_quotations"
		stock_conn.execute("update ex_user set todaybuy=0,todaysell=0")
		stock_conn.execute("update ex_config set todaybuy=0,todaysell=0,todaytotal=0,excolexp=0,todaydate='"&date()&"'")
		call getreload(1,0)
		set rst=stock_conn.execute("select sid,tradeprice,surplusshare,todaytradesum,todaypermittradesum,statement from ex_stock where tradeprice<>closingprice or todayadtradesum>0")
		if not rst.eof then
			do while not rst.eof
				if rst(2)>rst(3) then
					newtradesum="todaypermittradesum=todaytradesum"
				elseif rst(2)>0 then
					newtradesum="todaypermittradesum=surplusshare"
				else
					newtradesum="todaypermittradesum=0"
				end if
				statement=rst(5)
				if statement="" or isnull(statement) then statement="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0"
				statement=mid(statement,instr(statement,"|")+1)&"|"&round(rst(1),2)
				stock_conn.execute("update ex_stock set closingprice=tradeprice,oqprice=0,todayadtradesum=0,todaybuynumber=0,todaysellnumber=0,todaywave=0,"&newtradesum&",statement='"&statement&"' where sid="&rst(0))
			rst.movenext
			loop
		end if
		name="exsm_imitate_date"
		value=date()
	end sub
	public sub calculatefund(tradeuserid,stockid)
		dim suserid,sid,rsuser,rsstnum,totalfund,stocktypenum,currentprice,agvinprice,mygupiaonum,mygupiaovalue,mygupiaocost,stockstatistic,newstockpricea,newstockpriceb
		sid=stockid
		if isnumeric(tradeuserid) then
			suserid="lockuser=0"
			if tradeuserid>0 then suserid="id="&tradeuserid&""
			set rsuser=stock_conn.execute("select id from ex_user where "&suserid&"")
			if not rsuser.eof then
				do while not rsuser.eof
					totalfund=0 :	stocktypenum=0	:	currentprice=0	:	agvinprice=0	:	mygupiaonum=0 :	mygupiaovalue=0 :	mygupiaocost=0
					sql="select d.*,g.closingprice,g.tradeprice from ex_customer d inner join ex_stock g on d.sid=g.sid where d.userid="&rsuser(0)&""
					set rsstnum=stock_conn.execute(sql)
					do while not rsstnum.eof
						currentprice=round(rsstnum("tradeprice"),2)
						agvinprice=round(rsstnum("averageprice"),2)
						mygupiaonum=mygupiaonum+rsstnum("possessstocksum")
						mygupiaovalue=mygupiaovalue+(rsstnum("possessstocksum"))*currentprice
						mygupiaocost=mygupiaocost+(rsstnum("possessstocksum"))*agvinprice
						totalfund=totalfund+(rsstnum("possessstocksum"))*rsstnum("tradeprice")
						stocktypenum=stocktypenum+1
					rsstnum.movenext
					loop
					stockstatistic=""&mygupiaonum&"|||"&mygupiaovalue&"|||"&mygupiaocost&""
					stock_conn.execute("update ex_user set userassets=userwealth+"&round(totalfund,2)&",possesssort="&stocktypenum&",userstatistic='"&stockstatistic&"' where id="&rsuser(0)&"")
				rsuser.movenext
				loop
			end if
		end if
		if sid>0 then
			set rs=stock_conn.execute("select tradeprice,lowestprice,highestprice from ex_stock where sid="&sid&"")
			if not rs.eof then
				if rs(0)>rs(2) then
					newstockpricea="highestprice=tradeprice"
				else
					newstockpricea="highestprice=highestprice"
				end if
				if rs(0)<rs(1) then
					newstockpriceb="lowestprice=tradeprice"
				else
					newstockpriceb="lowestprice=lowestprice"
				end if
				stock_conn.execute("update ex_stock set "&newstockpricea&","&newstockpriceb&" where sid="&sid&"")
			end if
			call excolexp()
			name="exsm_imitate_quotations"
			call getreload(1,0)
			delstockcahe("exsm_imitate_news")
		end if
	end sub
	public sub excolexp()
		dim excolexp,exfloatprice
		excolexp=0
		set rs=stock_conn.execute("select tradeprice,closingprice from ex_stock where tradeprice<>closingprice or todayadtradesum>0")
		if not rs.eof then
			do while not rs.eof
				exfloatprice=round((rs(0)-rs(1))/rs(1)*100,2)
				excolexp=round(excolexp+exfloatprice,2)
			rs.movenext
			loop
			stock_conn.execute("update ex_config set excolexp="&excolexp&"")
		end if
	end sub
	private function regusernum()
		dim regrs
		regrs=stock_conn.execute("select count(*) from ex_analyse where userid>0")
		regusernum=regrs(0)
		set regrs=nothing
		if isnull(regusernum) then regusernum=0
	end function
	private function guestusernum()
		dim guestrs
		guestrs=stock_conn.execute("select count(*) from ex_analyse where userid=0")
		guestusernum=guestrs(0)
		set guestrs=nothing
		if isnull(guestusernum) then guestusernum=0
	end function
	public function syllable(str)
		on error resume next
		dim winnt_chinese
		winnt_chinese=(len("例子")=2)
		if winnt_chinese then
			dim l,t,c,i
			l=len(str)
			t=l
			for i=1 to l
				c=asc(mid(str,i,1))
				if c<0 then c=c+65536
				if c>255 then
					t=t+1
				end if
			next
			syllable=t
		else
			syllable=len(str)
		end if
		if err.number<>0 then err.clear
	end function
	public function siftname(bbsname)
		dim ex_bbsname,exi
		ex_bbsname=split("$,"&split(stockdata(8,0),"|")(6)&"",",")
		for exi=0 to ubound(ex_bbsname)
			if not isnull(ex_bbsname(exi)) then
				bbsname=replace(bbsname,ex_bbsname(exi),"")
				siftname=bbsname
			end if
		next
	end function
	public function htmlencode(fstring)
		if not isnull(fstring) then
			fstring=replace(fstring,">","&gt;")
			fstring=replace(fstring,"<","&lt;")
			fstring=replace(fstring,chr(9),"&nbsp;")
			fstring=replace(fstring,chr(10),"<br>")
			fstring=replace(fstring,chr(13),"")
			fstring=replace(fstring,chr(32),"&nbsp;")
			fstring=replace(fstring,chr(34),"&quot;")
			fstring=replace(fstring,chr(39),"&#39;")
			fstring=replace(fstring,chr(44),"&#44;")
			htmlencode=fstring
		end if
	end function
	public function ubbcode(content)
		dim re
		if stockadmin then
			content=replace(content,"[exu]","<a title=""使用了用户名保护模式""><u>")
			content=replace(content,"[/exu]","</u></a>")
		elseif instr(content,"[exu]")>0 then
			set re=new regexp
			re.pattern="\[exu\](.[^\[]*)(\[\/exu\])"
			content=re.replace(content,"<a title=""使用了用户名保护模式"">***</a>")
			set re=nothing
		end if
		ubbcode=content
	end function
	public function outsiderefer()
		dim server_v1,server_v2
		outsiderefer=false
		server_v1=cstr(request.servervariables("http_referer"))
		server_v2=cstr(request.servervariables("server_name"))
		if not mid(server_v1,8,len(server_v2))=server_v2 then outsiderefer=true
	end function
	public function repeatrefer()
		repeatrefer=false
		if not isnumeric(trim(session("ex_sm"))) then
			repeatrefer=true
		elseif not cstr(session("ex_sm"))=0 then
			repeatrefer=true
		end if
	end function
	public function scriptnameurl()
		if request.servervariables("server_port")="80" then
			scriptnameurl="http://" & request.servervariables("server_name")&replace(lcase(request.servervariables("script_name")),scriptname,"")
		else
			scriptnameurl="http://" & request.servervariables("server_name")&":"&request.servervariables("server_port")&replace(lcase(request.servervariables("script_name")),scriptname,"")
		end if
	end function
	public sub savelog(logtargetname,logcontent,logtype)
		stock_conn.execute("insert into ex_log (l_boardid,l_touser,l_username,l_content,l_addtime,l_ip,l_type) values ("&userid&",'"&logtargetname&"','"&stockholder&"','"&logcontent&"',"&sqlsmnowstring&",'"&userip&"',"&logtype&")")
	end sub
	private sub getstockann()
		set rs=stock_conn.execute("select top 5 title,color from ex_announcement order by id desc")
		if not rs.eof then
			exsm.value=rs.getrows(5)
		else
			exsm.value=""
		end if
		set rs=nothing
	end sub
	public sub nav()
		dim exsm_ann
		name="exsm_imitate_ann"
		if inspectisdata() then getstockann
		exsm_ann=value
		response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""1"" align=""center"" border=""0"">"
		response.write "<tr><th height=""25"" width=""20%"" align=""left"" id=""tabletitlelink"" style=""font-weight:normal"">&nbsp;&nbsp;<a href=""index.asp"" title=""返回论坛"" onmouseover=""cziemenu(event,'<div>"
		if stockadmin then response.write "<a href=\'ex_sm_admin_index.asp\'>股市管理</a></div><div>"
		if exsmuserinfo(9)=0 then
			response.write "<a href=\'ex_sm_help.asp?action=exsession&window=1\' title=\'将窗口切换到独立模式\'>独立模式</a>"
		else
			response.write "<a href=\'ex_sm_help.asp?action=exsession&window=0\' title=\'将窗口切换到论坛模式\'>论坛模式</a>"
		end if
		response.write "</div><div><a href=\'ex_sm_stockserve.asp\'><font color=\'#ff0000\'>股市服务</font></a>"
		response.write "</div><div><a href=\'ex_sm_billboard.asp\'>股市排行</a></div><div><a href=\'ex_sm_help.asp\'>股市帮助</a></div>','',0)"">股市导航</a></th>"
		response.write "<th>-=> 欢 迎 光 临 - "&setting_info(0)&" - <=-<a name=""topex""></a></th><th width=""20%"" align=""right""></th></tr>"
		response.write "<tr><td class=""tablebody1"" colspan=""3"">"
		response.write "<table cellspacing=""0"" cellpadding=""1"" align=""center"" border=""0"" width=""100%"">"
		response.write "<tr><td class=""tablebody1"" valign=""center"" width=""28%"">&nbsp;&nbsp;<font color=""#333399""> </font><span id=""timeczie""></span></td>"
		response.write "<td class=""tablebody1"" width=""44%"" height=""30"" align=""center""><span id=""announc""><layer id=""announcns""></layer></span></td>"
		response.write "<form method=""post"" name=""myform"" action=""ex_sm_search.asp"">"
		response.write "<td class=""tablebody1"" align=""right"" width=""28%""> 股票查询：<input type=""text"" name=""keyword"" size=""9"" class=""pageinput"" value="""">&nbsp;<input type=""submit"" name=""submit2"" class=""pageinput"" value=""查询"">&nbsp;&nbsp;</td>"
		response.write "</form>"
		response.write "</tr>"
		response.write "</table>"
		response.write "</td></tr>"
		response.write "</table>"
		response.write "<br>"
		response.write "<script language=""javascript"">"
		if not isarray(exsm_ann) then
			response.write "messages[0]=""欢迎光临“"&htmlencode(setting_info(0))&"”"";"
			response.write "mescolor[0]=""blue"";"
			response.write "messages[1]=""证监会提醒：股市风险莫测，谨慎入市！"";"
			response.write "mescolor[1]=""red"";"
		else
			for i=0 to ubound(exsm_ann,2)
				response.write "messages["&i&"]="""&htmlencode(server.htmlencode(left(exsm_ann(0,i),25)))&"…"";"
				response.write "mescolor["&i&"]="""&exsm_ann(1,i)&""";"
			next
			response.write "messages["&i&"]=""证监会提醒：股市风险莫测，谨慎入市！"";"
			response.write "mescolor["&i&"]=""blue"";"
		end if
		response.write "gp_time();announcement();"
		response.write "</script>"
	end sub
	public sub usermenu()
		response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
		response.write "<tr><td align=""left"" height=""25"" class=""tablebody2"">"
		response.write "&nbsp;<a href=""ex_sm_index.asp"" onmouseover=""cziemenu(event,'"
		if exsmuserinfo(9)=0 then
			response.write "<div><a href=\'ex_sm_help.asp?action=exsession&window=1\' title=\'将窗口切换到独立模式\'>独立"
		else
			response.write "<div><a href=\'ex_sm_help.asp?action=exsession&window=0\' title=\'将窗口切换到论坛模式\'>论坛"
		end if
		response.write "模式</a></div><div><a href=\'index.asp\'>返回论坛</a></div>','',0)"">"&setting_info(0)&"</a>"
		response.write " | <a href=""ex_sm_help.asp"">股市帮助</a>"
		if members then
			response.write " | <a href=""ex_sm_mymanage.asp"" onmouseover=""cziemenu(event,'<div><a href=\'ex_sm_mymanage.asp\'>帐户管理</a></div><div><a href=\'ex_sm_mymanage.asp?action=userinfo\'>帐户设置</a></div>','',0)"">帐户管理</a>"
		else
			response.write " | <a href=""ex_sm_mymanage.asp""><font color=""#ff0000"">开户</font></a>"
		end if
		response.write " | <a href=""ex_sm_eachstock.asp"" onmouseover=""cziemenu(event,'<div><a href=\'ex_sm_eachstock.asp\'>个股上市</a></div><div><a href=\'ex_sm_eachstock.asp?action=newstock\'>申请上市</a></div>','',0)"">个股上市</a>"
		response.write " | <a href=""ex_sm_stockserve.asp""><font color=""#ff0000"">股市服务</font></a>"
		response.write " | <a href=""ex_sm_topuser.asp"" onmouseover=""cziemenu(event,'<div><a href=\'ex_sm_topuser.asp\'>详细排名</a></div><div><a href=\'ex_sm_userlist.asp\'>在线股民</a></div>','',0)"">详细排名</a>"
		response.write " | <a href=""ex_sm_billboard.asp"" title="""&setting_info(0)&"排行榜"">排行榜</a>"
		if stockadmin then response.write " | <a href=""ex_sm_admin_index.asp"">管理</a>"
		response.write " | <a href=""javascript:history.go(-1)"">返回上一页</a>"
		response.write "</td></tr>"
		response.write "</table><br>"
	end sub
	public sub endinfo(flag)
		dim titleinfo
		if errmess<>"" then
			titleinfo="错误信息"
		else
			titleinfo="操作信息提示"
		end if
		exsm.title 2,""&setting_info(0)&"-"&titleinfo&""
		if rurl="" or isnull(rurl) then rurl=request.servervariables("http_referer")
		if errmess<>"" and rurl<>"" then rurl="javascript:history.go(-1)"
		response.write "<table border=0 width=""100%"" height=""100%"">"
		response.write "<tr><td width=""100%"" height=""100%"" valign=""middle"" align=""center"">"
		response.write "<table cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
		response.write "<tr><td>"
		if errmess<>"" then
			if flag="no" then flag="warn.gif"
			response.write "<div align=""center""><a href="""&rurl&"""><img border=""0"" src=""inc/ex_stock/ex_img/"&flag&"""></a></div><br>"
			response.write "<font color=""red""><li><b>错误："&errmess&" 您可以选择以下操作：</b></font>"
			response.write "<li><a href=""ex_sm_help.asp"">查看股市帮助</a>"
			response.write "<li><a href="""&rurl&""">返回上一页</a>"
		else
			if flag="ok" then flag="tradeok.gif"
			response.write "<div align=""center""><a href="""&rurl&"""><img border=""0"" src=""inc/ex_stock/ex_img/"&flag&"""></a></div><br>"
			response.write "<font color=""navy""><li><b>"&sucmess&" 您可以选择以下操作：</b></font>"
			response.write "<li><a href="""&rurl&""">返回上一页</a>"
		end if
		if definerurl<>"" then response.write "<li>"&definerurl&""
		response.write "<li><a href=""ex_sm_index.asp"">返回股市首页</a>"
		if stockadmin and instr(scriptname,"admin")>0 then response.write "<li><a href=""ex_sm_admin_index.asp"">返回股市管理首页</a>"
		response.write "</td></tr>"
		response.write "</table>"
		response.write "</td></tr>"
		response.write "</table>"
		if rurl<>"" then
			response.write "<meta http-equiv=""refresh"" content=""3;url="&rurl&""">"
		end if
		response.end
	end sub
	public function rndcolor()
		dim selcolor,colornum
		randomize
		colornum=cint(rnd*11)
		select case colornum
			case 0
				selcolor="blue"
			case 1
				selcolor="black"
			case 2
				selcolor="fuchsia"
			case 3
				selcolor="olive"
			case 4
				selcolor="red"
			case 5
				selcolor="maroon"
			case 6
				selcolor="navy"
			case 7
				selcolor="gray"
			case 8
				selcolor="green"
			case 9
				selcolor="teal"
			case 10
				selcolor="purple"
			case 11
				selcolor="lime"
			case else
				selcolor="black"
		end select
		rndcolor=selcolor
	end function
	public sub disppagenum(totalrec,pagesize,curpage,pagecount,urlprefix,pageform)
		dim pagewidth,p,ii
		if cdbl(totalrec)>0 and cdbl(pagecount)>0 then
			if stockadmin and instr(scriptname,"admin")>0 then pagewidth="100%" else pagewidth=assignwidth
			response.write "<table width="""&pagewidth&""" cellpadding=""0"" cellspacing=""0"" align=""center"" border=""0"">"
			response.write "<tr><td height=""3""></td></tr>"
			response.write "<tr><td width=""100%"" align=""right"">"
			response.write "<table class=""tableborder5"" cellpadding=""0"" cellspacing=""1"">"
			response.write "<form action="""&pageform&""" method=""post"" name=""pageform"">"
			response.write "<tr align=""center"">"
			response.write "<td class=""tabletitle1"" title=""总条数(只)"">&nbsp;"&totalrec&"&nbsp;</td>"
			response.write "<td class=""tabletitle1"" title=""本页条数(只)"">&nbsp;"&pagesize&"&nbsp;</td>"
			response.write "<td class=""tabletitle1"">&nbsp;"&curpage&"/"&pagecount&"页&nbsp;</td>"
			if cdbl(pagecount)<>0 then
				p=(curpage-1) \ 10
				if cdbl(curpage)=1 then
				response.write "<td class=""tablebody1"">&nbsp;<img src=""images/pagelist/first.gif"" border=""0"">&nbsp;</td>"
			else
				response.write "<td class=""tablebody1"">&nbsp;<a href="""&urlprefix&"1"" title=""首页""><img src=""images/pagelist/first.gif"" border=""0""></a>&nbsp;</td>"
			end if
			if cdbl(p)>0 then response.write "<td class=""tablebody1"">&nbsp;<a href="""&urlprefix&cstr(p*10)&"""><img src=""images/pagelist/previous.gif"" border=""0"" title=""上10页""></a>&nbsp;</td>"
				for ii=p*10+1 to p*10+10
					if cdbl(ii)=cdbl(curpage) then
						response.write "<td class=""tablebody2"">&nbsp;<font class=""normaltextsmall""><u><b>"&cstr(ii)&"</b></u></font>&nbsp;</td>"
					else
						response.write "<td class=""tablebody1"">&nbsp;<a href="""&urlprefix&cstr(ii)&""">"&cstr(ii)&"</a>&nbsp;</td>"
					end if
					if cdbl(ii)=cdbl(pagecount) then exit for
				next
				if cdbl(ii)>cdbl(p*10+10) then ii=ii-1
				if cdbl(ii)<cdbl(pagecount) then response.write "<td class=""tablebody1"">&nbsp;<a href="""&urlprefix&cstr(ii+1)&"""><img src=""images/pagelist/next.gif"" border=""0"" title=""下10页""></a>&nbsp;</td>"
				if cdbl(curpage)=cdbl(pagecount) then
					response.write "<td class=""tablebody1"">&nbsp;<img src=""images/pagelist/last.gif"" border=""0"">&nbsp;</td>"
				else
					response.write "<td class=""tablebody1"">&nbsp;<a href="""&urlprefix&cstr(pagecount)&"""><img src=""images/pagelist/last.gif"" border=""0"" title=""尾页""></a>&nbsp;</td>"
				end if
			end if
			response.write "<td class=""tablebody1""><input type=""text"" name=""page"" class=""pageinput"" size=""1"" value="""&cdbl(curpage+1)&"""><input type=""submit"" name=""submit"" class=""pageinput"" value=""GO""></td>"
			response.write "</tr>"
			response.write "</form>"
			response.write "</table>"
			response.write "</td></tr>"
			response.write "</table>"
		end if
	end sub
	public sub rootshow()
		response.write "<br>"
		response.write "<table class=""tableborder1"" cellspacing=""1"" cellpadding=""3"" align=""center"" border=""0"">"
		response.write "<tr><td class=""tablebody1"" width=""100%"">"
		response.write "<table cellspacing=""0"" cellpadding=""0"" align=""center"" border=""0"" width=""100%"">"
		response.write "<tr><td align=""left"" width=""35%"">&#27426;&#36814;&#24744;:"
		if stockholder="" then
			response.write "&#23458;&#20154;"
		else
			response.write stockholder&"</td>"
		end if
		response.write "<td align=""center"" width=""30%"">"&forumname&"-"&setting_info(0)&"</td>"
		response.write "<td align=""right"" width=""35%"">&#25191;&#34892;&#26102;&#38388;:"&formatnumber(timer()-tetime,6,-1)&"&#31186;</td>"
		response.write "</tr>"
		response.write "</table></td></tr>"
		response.write "</table>"
		call stockquotations()
		if exsmuserinfo(9)=0 then call dvbbs.footer()
	end sub
	public sub rootshowa()
		if exsmuserinfo(9)=0 then call dvbbs.footer() else response.write "<br>"
	end sub
	public sub stockquotations()
		dim quotations,todaytradenum,todaytrademoney,colexp
		exsm.name="exsm_imitate_quotations"
		quotations=exsm.value
		todaytradenum=clng(quotations(0))+clng(quotations(1))
		todaytrademoney=quotations(2)
		colexp=quotations(3)
		response.write "<script language=javascript>"
		response.write "var reloadon="&reloadon&";"
		response.write "var exreload="&exsm.setting_info(6)&";"
		response.write "var bargainmoney="&todaytrademoney&";"
		response.write "var bargainnum="&todaytradenum&";"
		response.write "var cziedxp="&colexp&";"
		response.write "czstatus();"
		response.write "</script>"
	end sub
end class
%>