<%@ LANGUAGE=VBScript codepage ="936" %>
<!--#include file="check.asp"-->
<!--#include file="../pass.asp"-->
<%Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl = "No-Cache"
Response.Expires=0
sjjh_name=Session("sjjh_name")
if sjjh_name<>Application("sjjh_user") then 
	Response.Write "<script language=JavaScript>{alert('提示：你不是主站长，无权操作!');location.href = 'javascript:history.go(-1)';}</script>"
	Response.End
end if
cardlx=clng(trim(Request.Form("cardlx")))
cardsl=clng(trim(Request.Form("cardsl")))
cardsm=trim(Request.Form("cardsm"))
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("sjjh_usermdb")
for t=1 to cardsl
do while true
	ontime=now()
	n=Year(ontime)
	y=Month(ontime)
	r=Day(ontime)
	s=Hour(ontime)
	f=Minute(ontime)
	m=Second(ontime)
	if len(s)=1 then s="0" & s
	if len(f)=1 then f="0" & f
	if len(m)=1 then m="0" & m
	if len(y)=1 then y="0" & y
	if len(r)=1 then r="0" & r
	'时间
	sn1=clng(n & y & r)
	sn2=clng(s & f & m)
	if Second(ontime)/2=int(Second(ontime)/2) then 
		sn=sn1+sn2
	else
		sn=sn1-sn2
	end if
	ssn=sn & "-"
	'类别
	'密码
	randomize()
	pass=int(rnd*899999)+100000
	do while true
		randomize()
		rndid=int(rnd*89999)+10000
		if (rndid mod 15)=cardlx then exit do
	loop
	sn=sn & rndid 
	ssn=ssn & rndid & "-"
	'随机1
	randomize(rndid)
	rndid=int(rnd*89999)+10000
	sn=sn & rndid
	ssn=ssn & rndid & "-"
	'随机2
	randomize(rndid)
	rndid=int(rnd*89999)+10000
	sn=sn & rndid
	ssn=ssn & rndid & "-"
	'随机3
	randomize(rndid)
	rndid=int(rnd*89999)+10000
	sn=sn & rndid
	ssn=ssn & rndid 
	rs.open "Select * from sjjh_czc Where sn='" & sn & "' and pass<>'" & md5(pass) &"'",conn,1,3
	if rs.eof then
		'rs.close
		exit do
	end if
	rs.close
loop
rs.AddNew
rs("type")=cardlx
rs("sn")=sn
rs("pass")=md5(pass)
rs("cz_time")=ontime
rs("remark")=cardsm
rs("cz_use")=0
rs.update
rs.close
Response.Write "序列号:"& ssn &"  密码:"& pass &"<br>"
next
%>
