ASP实现多用户登录
来源:百度知道 编辑:UC知道 时间:2024/05/13 10:46:15
我是有数据库的。在其他页面不加吗?那个是登录的。但是数据库链接方面呢?谢谢回答。请补充回答好吗?
<%
if up=0 then
Response.Redirect("page1.asp")
else if up=1 then
Response.Redirect("page2.asp")
else if up=2 then
Response.Redirect("page3.asp")
end if
end if
end if
%>
这个是登陆的时候用
另外在包括一个power.asp
在每一个页面的最前面设置一句:
userpowerneed=n
其中n表示最低的权限
在power.asp中写入
if up<userpowerneed then
Response.Redirect("nopower.asp")
end if
function OpenDB(dbdir){
/*
*--------------- OpenDB(sdbname) -----------------
* OpenDB(sdbname)
* 功能:打开数据库sdbname,返回conn对象.
* 参数:sdbname,字符串,数据库名称.
* 实例:var conn = OpenDB("database.mdb");
*--------------- OpenDB(sdbname) -----------------
下面的dbn是数据库名称,dbdir是数据库相对于调用页面的相对位置目录写法,如../db,如果用odbc做的话就不用这么麻烦
*/
var connstr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath(dbdir+dbn);
var conn = Server.CreateObject("ADODB.Co