如果Session("user_name")在这个文件里赋值包含文件的确不能放在这里。
left.asp的全部代码~~~
<Script language="javascript">
function newWin(url) {
var oth="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100";
oth = oth+",width=600,height=400";
var newWin=window.open(url,"newWin",oth);
newWin.focus();
}
</Script>
<div align="center">
<center><table border="0" width="100%" height="575" cellspacing="0" cellpadding="0">
<%
if (Session("isMember")!=1 && Request("flag")!=1){
%>
<tr>
<td width="168" height="18" valign="top" bgcolor="#028262" colspan="2">
<p align="center">
<b><font color="#FFFFFF"> 请先登录</font></b></td>
</tr>
<form name="frm0" action="default.asp?flag=1" method="post">
</center>
<tr>
<td width="63" height="15" valign="top" bgcolor="#E0FEFB" align="center">
<p align="left">用户名:</p>
</td>
<center>
<td width="119" height="15" valign="top" bgcolor="#E0FEFB"><font size="2">
<input name="loginname" type="text" id="loginname" width="25" size="15"></font>
</td>
</tr>
</center>
<tr>
<td width="63" height="25" valign="top" bgcolor="#E0FEFB" align="center">
<p align="left">
密 码: </p>
</td>
<center>
<td width="119" height="25" valign="top" bgcolor="#E0FEFB"><font size="2">
<input name="password" type="password" id="password" width="25" size="15"></font>
</td>
</tr>
<tr>
<td width="168" height="27" valign="top" bgcolor="#D3ECFE" colspan="2">
<p align="center"><font size="2"><input name="login" type="submit" id="login0" value="登录"><input name="reset" type="reset" id="reset0" value="重写">
</font>
<font size="2" face="华文楷体">注册会员?</font>
</td>
</tr>
</form>
<%}
if (Request("flag")==1){
var username = Request("loginname");
var userpwd = Request("password");
Session("user_name") = username(1);
Session("user_pwd") = userpwd(1);
}
if (Session("isMember") == 1){
username = Session("user_name");
userpwd = Session("user_pwd");
}
if (Request("flag")==1 || Session("isMember") == 1){
if (username!="" && userpwd!="" && username!=undefined && userpwd!=undefined) {
rs = Server.CreateObject("ADODB.Recordset");
sql = "Select * From Members Where UserName='"+username+"' And UserPwd='"+userpwd+"'";
rs.open(sql,Conn,2,3);
if (!rs.Eof ){
Session("isMember") = 1;
%>
<tr>
<td width="168" height="18" valign="top" bgcolor="#028262" colspan="2">
<p align="center"><font color="#FFFFFF"><b>会员信息</b></font>
</td>
</tr>
<tr>
<td width="168" height="17" valign="top" bgcolor="#E0FEFB" colspan="2">
您好,<font color="#FF0000"><%=rs("UserRealName")%></font>
欢迎您的光临!
</td>
</tr>
<!--1表示产品会员,2表示工程会员-->
<%
var usertype = parseInt(rs("UserType"));
Session("user_type") = usertype;
if(Session("user_type") == 1){
%>
<tr>
<td width="168" height="16" valign="top" bgcolor="#FFFFCC" colspan="2">
<p align="center"><font color="#800080">会员类型:产品会员</font><font color="#FF0000"><br>
<br>
</font>
<a href="javascript:newWin('shopping/basket_order.asp')">
查看订单</a>
<br>
<br>
<a href="javascript:newWin('shopping/message.asp')">
会员留言<br>
<br>
</div>
</center>
<%
sql1 = "Select * From Messages Where UserName = '"+username+"'";
rs1 = Conn.Execute(sql1);
while(!rs1.Eof){
var messagestate = messagestate+rs1("MessageState");
rs1.MoveNext();
}
var fenxi = new Array();
fenxi = messagestate.split("1");
var n = fenxi.length;
var fenxi1 = new Array();
fenxi1 = messagestate.split("2");
var n1 = fenxi1.length;
if(n>1){
%>
<a href="javascript:newWin('shopping/message_reply.asp')" style="color: #FF0000">有新的留言回复未查看</a>
<%}
else if(n==1 && n1>1){
%>
<a href="javascript:newWin('shopping/message_reply.asp')">查看留言回复</a>
<%}
else if(n==1 && n1==1){
Response.Write("");}
rs1.close();
%>
<%}
else if(Session("user_type") == 2){
%>
<table>
<tr>
<td width="168" height="17" valign="top" bgcolor="#FFFFCC" colspan="2">
<p align="center"><font color="#800080">会员类型:工程会员</font><font color="#FF0000"><br>
</font><br>
工程管理
</td>
</tr>
<%}%>
<tr>
<td width="168" height="17" valign="top" bgcolor="#D3ECFE" colspan="2">
<p align="center"><a href="login_exit.asp">退出登录</a>
</td>
</tr>
<% }
else {
Response.Write("<Script language='javascript'>");
Response.Write("alert('输入的用户名或密码错误!');");
Response.Write("history.go(-1)");
Response.Write("</Script>");
}
}
else {
Response.Write("<Script language='javascript'>");
Response.Write("alert('输入的用户名或密码错误!');");
Response.Write("history.go(-1)");
Response.Write("</Script>");
}
}
%>
<tr>
<td width="168" height="18" valign="top" bgcolor="#028262" colspan="2">
<p align="center"><font color="#FFFFFF"><b>网站公告</b></font>
</td>
</tr>
<tr>
<td width="168" height="167" valign="top" colspan="2" bgcolor="#E0FEFB"> </td>
</tr>
<tr>
<td width="168" height="197" valign="top" colspan="2" bgcolor="#E0FEFB"> </td>
</tr>
<tr>
<td width="168" height="34" valign="top" align="center" bgcolor="#D3ECFE" colspan="2"><font size="2" face="华文新魏">Copyright
© 2006 Bcbuu</font> <font size="2" face="华文新魏">
All Rights Reserved</font></td>
</tr>
<tr>
<td width="168" height="23" valign="top" align="center" bgcolor="#D3ECFE" colspan="2"><font size="1" face="华文中宋">制作单位:北京联合大学商务院</font></td>
</tr>
</table></center>
</div>
为了简单点
我把前面一楼的网页的内容改了一小下
<%
if(Session("isMember") != 1){
%>
<body background="images/bg.jpg">
<%}%>
<%
else{
sql2 = "Select * From Messages Where UserName = '"+Session("user_name")+"'";
rs2 = Conn.Execute(sql2);
while(!rs2.Eof){
var messagestate2 = messagestate2+rs2("MessageState");
rs2.MoveNext();
}
var fenxi2 = new Array();
fenxi2 = messagestate2.split("1");
var n2 = fenxi2.length;
Response.Write(n2);
if(n2>1){%>
<%
}
}
%>
那怎么分割亚??我都晕了 你帮我看看吧~~~谢谢~~~~