<%
'-------share dim -----------
dim dbfilename
dbfilename="mdb.mdb" '此为数据库文件名
dim connstr
dim conn
server.scripttimeout=10000
set conn=server.createobject("adodb.connection")
conn.connectionstring="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("../data/"&dbfilename)
conn.open

'-------share dim end -------
%>
<%
'#checkerr
sub checkerr
	if conn.errors.count > 0 then
		response.write "<font color=red>Error!</font> "
		for i=0 to conn.errors.count-1
			response.write conn.errors(i).description&"<br>"
		next
	response.end
	end if
end sub
%>
<%
'#opendb
sub opendb
	'connstr="dbq="+server.mappath("data/23798drlkkj345#$%#%")+";defaultdir=;driver={microsoft access driver (*.mdb)}"
	'set conn=server.createobject("adodb.connection")
	'conn.open connstr
end sub
%>
<%
'#closedb
sub closedb
	conn.close
	set conn=nothing
end sub
%>
<%
'#addusersn
sub addusersn
	sql="select * from userinfo where uid='"&uid&"'"
	set rs=server.createobject("adodb.recordset")
	'opendb
	rs.open sql, conn, 1, 3
	if rs.eof then 
		'response.redirect "error.asp?emsg=data error, no such user!"
		'response.end
	else
	sn=rs("sn")
	rs("sn")=sn+1
	rs.update
	end if
	rs.close
	set rs=nothing
	'closedb
end sub
%>
<%
'#adduserpos
sub adduserpos
	sql="select * from userinfo where uid='"&uid&"'"
	'opendb
	on error resume next
	set rs=server.createobject("adodb.recordset")
	rs.open sql, conn , 1,3
	pos=rs("pos")
	rs("pos")=pos+1
	rs.update
	rs.close
	checkerr
	set rs=nothing
	'closedb
end sub
%>


<%
sub checkauthority
if session("bluelogin")="yes" then
	if session("blueauthority")<2 then
		%><script language="javascript">alert("你的权限不够，无法访问此页！");window.location.href="..";</script><%
		response.end
	end if
else
	%><script language="javascript">alert("你没有登录，无法访问此页！");window.location.href="..";</script><%
	response.end
end if
end sub
%>