页面Cookies无法保存
在本地测试的时候(XP3)可以正常使用,但传到服务器(2003)却不行,好像是Cookies无法保存,用session也是一样。数据库连接时成功的。每次登陆时,显示登陆成功后,就又跳回到登陆页面了登陆页:
<%@ LANGUAGE = VBScript %>
<%
set file=server.createobject("scripting.FileSystemObject")
addr1=server.mappath("top1.asp")
addr2=server.mappath("top1.asp")
If Not file.FileExists(addr1) or Not file.FileExists(addr2) Then
response.write "<script LANGUAGE='javascript'>alert('系统发生严重错误即将关闭!!!');window.close();</script>"
End If
%>
<%response.expires=0%>
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="kq/conn.asp"-->
<%
function find_online_user(oabusyusername)
dim i,dimsums,siteinfo,findok
findok=0
Application.Lock
onlineuser=application("onlineuser")
dimsums=ubound(onlineuser)
for i=0 to dimsums
siteinfo=onlineuser(i)
if siteinfo<>"" then
if instr(siteinfo,oabusyusername&"$")>0 then
findok=1
exit for
end if
end if
next
Application.UnLock
find_online_user=findok
end function
sub write_online_user(username,name,dept)
dim userinfo
Application.Lock
userinfo=username&"$"&name&"$"&dept&"$"&request.servervariables("REMOTE_ADDR")
onlineuser=application("onlineuser")
dimsums=ubound(onlineuser)
redim preserve onlineuser(dimsums+1)
onlineuser(dimsums+1)=userinfo
application("onlineuser")=onlineuser
Application.UnLock
end sub
sub checkkqdatabase()
set fileobject=server.createobject("Scripting.FileSystemObject")
if not fileobject.FileExists(server.mappath("kq/"&cstr(year(date()))&".mdb")) then
file1=server.mappath("kq\backup\new.mdb")
file2=server.mappath("kq\"&cstr(year(date()))&".mdb")
fileobject.copyfile file1,file2
end if
set fileobject=nothing
end sub
call checkkqdatabase
username=request.form("username")
password=request.form("password")
if username<>"" and password<>"" then
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
on error resume next
sql="select * from userinf where username=" & sqlstr(username) & " and password=" & sqlstr(password) & " and forbid='no'"
rs.open sql,conn,1,1
'如果有此用户就进入系统
if not rs.eof and not rs.bof then
response.cookies("oabusyname")=rs("name")
response.cookies("oabusyuserid")=cstr(rs("ID"))
response.cookies("oabusyusername")=rs("username")
response.cookies("oabusyuserdept")=rs("userdept")
response.cookies("oabusyuserlevel")=rs("userlevel")
response.cookies("oabusyuserarea")=rs("userarea")
response.cookies("oabusyusercity")=rs("usercity")
response.cookies("cook_allow_see_all_workrep")=rs("allow_see_all_workrep")
response.cookies("cook_allow_see_dept_workrep")=rs("allow_see_dept_workrep")
response.cookies("cook_allow_control_dept_user")=rs("allow_control_dept_user")
response.cookies("cook_allow_control_area_user")=rs("allow_control_area_user")
response.cookies("cook_allow_control_city_user")=rs("allow_control_city_user")
response.cookies("cook_allow_control_all_user")=rs("allow_control_all_user")
response.cookies("cook_allow_send_note")=rs("allow_send_note")
response.cookies("cook_allow_control_note")=rs("allow_control_note")
response.cookies("cook_allow_control_file")=rs("allow_control_file")
response.cookies("cook_allow_send_file")=rs("allow_send_file")
response.cookies("allow_transmit_file")=rs("allow_transmit_file")
response.cookies("cook_allow_control_level")=rs("allow_control_level")
response.cookies("allow_check_resource_requirement")=rs("allow_check_resource_requirement")
response.cookies("allow_auditing_workthings")=rs("allow_auditing_workthings")
response.cookies("allow_manage_workthings")=rs("allow_manage_workthings")
response.cookies("allow_lookallinfo_workthings")=rs("allow_lookallinfo_workthings")
response.cookies("allow_look_all_kq_info")=rs("allow_look_all_kq_info")
response.cookies("allow_edit_help")=rs("allow_edit_help")
response.cookies("allow_edit_person_personinf") =rs("allow_edit_person_personinf")
Response.Cookies("default.asp").path = "/"
response.write "<script language=JavaScript>alert('登陆成功!');window.location.href = 'main.asp'"&" </script>"
conn.close
set conn=nothing
else
response.write "<script language=JavaScript>alert('登陆失败!');window.location.href = 'default.asp'"&" </script>"
response.end
end if
end if
%>
<html>
<head>
<title>OA办公系统</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<link rel="stylesheet" href="inc/style.css" type="text/css">
<style type="text/css">
<!--
.sr {
height: 17px;
width: 140px;
}
.style1 {color: #3c4d82}
body {
background-image: url(images/bg_index.gif);
}
-->
</style>
</head>
<body bgcolor="menu" text="#000000" leftmargin="1" topmargin="1" scroll="no" style="border:0px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50"> </td>
</tr>
<tr>
<td><table width="640" height="447" border="0" align="center" cellpadding="0" cellspacing="0" background="images/login_bg.gif">
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="65%"> </td>
<td width="35%" height="145"> </td>
</tr>
<tr>
<td> </td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="default.asp">
<tr>
<td> </td>
<td valign="bottom"><span class="style1">请输入用户名</span></td>
</tr>
<tr>
<td> </td>
<td><input name="username" type="text" class="sr" size="15" maxlength="50"></td>
</tr>
<tr>
<td> </td>
<td height="25" valign="bottom"><span class="style1">请输入密码</span></td>
</tr>
<tr>
<td width="7"> </td>
<td><input name="password" type="password" class="sr" size="15" maxlength="50"></td>
</tr>
<tr>
<td height="50" colspan="2"><INPUT name="S1" type=image
src="images/bt_login.gif" width="98" height="37" ></td>
</tr>
</form>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<div align="center"><script src="count/mystat.asp"></script></div>
</body>
</html>
主页面:
<%@ LANGUAGE = VBScript %>
<%
set file=server.createobject("scripting.FileSystemObject")
addr1=server.mappath("top1.asp")
addr2=server.mappath("top1.asp")
If Not file.FileExists(addr1) or Not file.FileExists(addr2) Then
response.write "<script LANGUAGE='javascript'>alert('系统发生严重错误即将关闭!!!');window.close();</script>"
End If
%>
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
oabusyuserarea=request.cookies("oabusyuserarea")
oabusyusercity=request.cookies("oabusyusercity")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='default.asp';")
response.write("</script>")
response.end
end if
%>
<html>
<head>
<title>OA办公系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="inc/style.css" type="text/css">
<SCRIPT language=javascript>
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu() {
event.cancelBubble = true
event.returnvalue = false;
return false;
}
function norightclick(e) {
if (window.Event) {
if (e.which == 2 || e.which == 3)
return false;
} else if (event.button == 2 || event.button == 3) {
event.cancelBubble = true
event.returnvalue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</SCRIPT>
<script>
function tick() {
var hours, minutes, seconds, ap;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
ap = "Midnight";
} else if (intHours < 12) {
hours = intHours+":";
ap = "A.M.";
} else if (intHours == 12) {
hours = "12:";
ap = "Noon";
} else {
hours = intHours + ":";
ap = "P.M.";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = hours+minutes+seconds+ap;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 1000);
}
window.onload = tick;
</script>
<script language="javascript">
//单击"注销"连接时,弹出对话框是否要求退出系统
function closesystem()
{
window.open('logout.asp?closeflag=1','closesystem','location=no,height=10, width=10, top=600, left=10,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
//-->
</SCRIPT>
<style type="text/css">
<!--
body {
background-color: #335e91;
}
.style2 {color: #2d4865}
.style3 {color: #334d66}
.style4 {color: #2e4869}
-->
</style>
</head>
<body topmargin="0" leftmargin="0" onmouseover="self.status='OA办公系统';return true">
<table width="1003" height="741" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="14"> </td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="28"><table width="951" height="28" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="A3B4C4">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="24" background="images/main/bg_t1.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="28%"><div align="center" class="style3">中国古玩网-秀宝网-兰科OA办公系统</div></td>
<td width="33%"><span class="style3">欢迎您,<span style="font-size:11px"><%=oabusyname%></span></span></td>
<td width="39%"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="951" height="32" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="4B779C">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"><img src="images/main/l1.gif" width="1" height="30"></td>
<td background="images/main/m1.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center" class="style3"><a href="desk.asp" target="main_body"><font color="#334d66" >我的办公桌面(D)</font></a></div></td>
<td><div align="center" class="style3"><a href="dayrep.asp" target="main_body"><font color="#334d66" >我的个人计划(P)</font></a></div></td>
<td><div align="center" class="style3"><a href="personlist.asp" target="main_body"><font color="#334d66" >我的通讯录(A)</font></a></div></td>
<td><div align="center" class="style3"><a href="online/onlineuser.asp" target="main_body"><font color="#334d66" >在线员工(O)</font></a></div></td>
<td><div align="center" class="style3"><a href="javascript:history.back(-1)"><font color="#334d66" >返回(B)</font></a></div></td>
<td><div align="center" class="style3"><a href="" onClick="history.go(0)"><font color="#334d66" >刷新(R)</font></a></div></td>
<td><div align="center" class="style3"><a href="" onClick="closesystem();"><font color="#334d66" >安全退出(Q)</font></a></div></td>
<td> </td>
</tr>
</table></td>
<td width="1"><img src="images/main/r1.gif" width="1" height="30"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="951" height="541" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="9EB4C9">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="155" height="539" valign="top"><table width="100%" height="540" border="0" cellpadding="0" cellspacing="1" bgcolor="4F769D">
<tr>
<td valign="top" bgcolor="#FFFFFF"><iframe name=main marginwidth=0 marginheight=0 src="leftbutton.asp" frameborder=0 scrolling="auto" width=153 height=540></iframe></td>
</tr>
</table></td>
<td width="583" valign="top"><iframe name=main_body marginwidth=0 marginheight=0 src="desk.asp" frameborder=0 scrolling="auto" width=583 height=542 ></iframe></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1" bgcolor="50769D"></td>
<td height="542" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="25"><img src="images/main/l3.gif" width="2" height="25"></td>
<td background="images/main/m3.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="21"><div align="center"><img src="images/main/icon.gif" width="15" height="12"></div></td>
<td><span class="style2">常用信息</span></td>
</tr>
</table></td>
<td width="1"><img src="images/main/r3.gif" width="1" height="25"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="6"></td>
</tr>
<tr>
<td><div align="center">
<table width="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="567B98">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"><img src="images/main/l4.gif" width="1" height="21"></td>
<td background="images/main/m4.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"> </td>
<td><span class="style4">登陆信息</span></td>
</tr>
</table></td>
<td width="1"><img src="images/main/r4.gif" width="1" height="21"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="20"><span style="font-size:11px">用户:<%=oabusyname%> </span></td>
</tr>
<tr>
<td height="20"><span style="font-size:11px">部门:<span style="font-size:11px"><%=oabusyuserdept%></span> </span></td>
</tr>
<tr>
<td height="20"><span style="font-size:11px">职位:<%=oabusyuserlevel%> </span></td>
</tr>
<tr>
<td height="20"><span style="font-size:11px">大区:<%=oabusyuserarea%> </span></td>
</tr>
<tr>
<td height="20"><span style="font-size:11px">城市:<%=oabusyusercity%> </span></td>
</tr>
<tr>
<td height="20"><span style="font-size:11px">时间:
<script language="JavaScript">
<!---
//取得日期和星期
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray("<font color=RED>星期日","<font color=black>星期一","<font color=black>星期二","<font color=black>星期三","<font color=black>星期四","<font color=black>星期五","<font color=GREEN>星期六");
document.write(today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",d[today.getDay()+1]);
//-->
</script>
</span></td>
</tr>
<tr>
<td><iframe name=fir1 marginwidth=0 marginheight=0 src="top0.asp" frameborder=0 scrolling="no" width=100% height=5 allowTransparency="true"></iframe></td>
</tr>
<tr>
<td><iframe name=fir2 marginwidth=0 marginheight=0 src="top1.asp" frameborder=0 scrolling="no" width=100% height=5 allowTransparency="true"></iframe></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td height="8"></td>
</tr>
<tr>
<td><table width="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="567B98">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"><img src="images/main/l4.gif" width="1" height="21"></td>
<td background="images/main/m4.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"> </td>
<td><span class="style4">办公常用信息</span></td>
</tr>
</table></td>
<td width="1"><img src="images/main/r4.gif" width="1" height="21"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td width="50%" height="20"><div align="center"><a href="cy/link.asp" target="main_body">常用网址</a></div></td>
<td height="20"><div align="center"><a href="cy/links.asp" target="main_body">网址管理</a></div></td>
</tr>
<tr>
<td height="20"><div align="center"><a href="rl/cal.htm" target="main_body">万 年 历</a></div></td>
<td height="20"><div align="center"><a href="ip/index.asp" target="main_body">手机及ip</a></div></td>
</tr>
<tr>
<td height="20"><div align="center"><a href="youbian/index.asp" target="main_body">邮编区号</a></div></td>
<td height="20"><div align="center"><a href="http://www.cma. target="main_body">天气查询</a></div></td>
</tr>
<tr>
<td height="20"><div align="center"><a href="http://www. target="main_body">网址大全</a></div></td>
<td height="20"><div align="center"><a href="http:// target="main_body">列车时刻</a></div></td>
</tr>
<tr>
<td height="20"><div align="center"><a href="http://www. target="main_body">航班查询</a></div></td>
<td height="20"><div align="center"><a href="http://www. target="main_body">在线翻译</a></div></td>
</tr>
<tr>
<td height="20"><div align="center"><a href="http://www. target="main_body">常用软件</a></div></td>
<td height="20"><div align="center"><a href="http://map.baidu.com/" target="main_body">电子地图</a></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="8"></td>
</tr>
<tr>
<td><table width="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="567B98">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"><img src="images/main/l4.gif" width="1" height="21"></td>
<td background="images/main/m4.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"> </td>
<td><span class="style4">今日天气</span></td>
</tr>
</table></td>
<td width="1"><img src="images/main/r4.gif" width="1" height="21"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="3"></td>
</tr>
<tr>
<td><IFRAME ID='ifm2' WIDTH='189' HEIGHT='190' ALIGN='CENTER' MARGINWIDTH='0' MARGINHEIGHT='0' HSPACE='0' VSPACE='0' FRAMEBORDER='0' SCROLLING='NO' SRC='http://weather.'></IFRAME>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="18"> </td>
</tr>
</table></td>
</tr>
</table>
<div align="center"><script src="count/mystat.asp"></script></div>
</body>
</html>