关于session问题?很简单!

jshao 2003-05-23 04:01:34
如何判断一个用户应经登录,没超时则显示用户名,否则显示登录框?
...全文
28 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jshao 2003-05-24
  • 打赏
  • 举报
回复
谢谢!!
esaler 2003-05-23
  • 打赏
  • 举报
回复
是的
sina1680 2003-05-23
  • 打赏
  • 举报
回复
agree
wdfboy1978 2003-05-23
  • 打赏
  • 举报
回复
agree!
fangpeng2003 2003-05-23
  • 打赏
  • 举报
回复
还是一样的原理啊,用session判断

<%if session("login")="false" then%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#B6D9EB" align="center" height="180">
<tr align=center bgcolor="#B6D9EB">
<td height="22" bgcolor="#B6D9EB">
<table align=center width="100" border="0" cellspacing="1" cellpadding="0" bgcolor="#B6D9EB">
<tr bgcolor="#FFFFFF">
<td>
<div align="center" class=green>登录论坛 </div>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#FFFFFF" align=center>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center" >
<tr>
<td align=center>
<form method="post" action="logon.asp" target=_top>
<div align="center">帐号:
<input type="text" name="uid" size="10" maxlength="20" class=text>
<br>
<br>
密码:
<input type="password" name="pwd" size="10" maxlength="20" class=text>
<br>
<br>
<input type="submit" name="Submit3" value=" 进入 " class=submit>
<input type="button" value=" 注册 " class="submit" onClick="javascript:window.document.location.href='register.asp';" name="button">
</div>
</form>
[注册仅需20秒] </td>
</tr>
</table>
</td>
</tr>
</table>
<%else%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#B6D9EB" align="center" height="180">
<tr align=center bgcolor="#B6D9EB">
<td height="22" bgcolor="#B6D9EB">
<table align=center width="100" border="0" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td>
<div align="center" class=green>个人信息 </div>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#FFFFFF" align=center>
<td>
<table border="0" cellspacing="0" cellpadding="8" align="center" width="100%">
<tr>
<td><font color=red><%
sql="select * from user where uid='"&uid&"'"
set rs=conn.execute(sql)
%><%=rs("uid")%></font>,你还好吗?<br>
这是你第<font color=red><%=rs("lt")%></font>次来到这里,
你已经发帖:<font color=red><%=rs("plan")%></font>个,阅帖:<font color=red><%=rs("readed")%></font>个,
你现在经验值为<font color=red><%=rs("exp")%></font>,身份为<font color=red><%=userclass(rs("id"))%> </font>。
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select id from message where receive='"&uid&"'"
rs.open sql,conn,1,1
%>
<br>你有<font color=red><%=rs.recordcount%></font>个留言, <%
rs.close
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select id from message where new=1 and receive='"&uid&"'"
rs.open sql,conn,1,1
%> 其中<font color=red><%=rs.recordcount%></font>个新留言 。<a href="readmessage.asp" title="查阅短消息">>></a><%rs.close%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%end if%>
jshao 2003-05-23
  • 打赏
  • 举报
回复
我想实现的就像csdn论坛上边的那个,没登陆时显示的是
用户名_____密码_____[登陆] [注册]
登陆后显示的是
你是____信誉分____[注销我的登陆]
zhangguagua 2003-05-23
  • 打赏
  • 举报
回复
同意楼上
sailor001 2003-05-23
  • 打赏
  • 举报
回复
if session("login")="ok" then
response.redirect("index.asp")
else
response.redirect("login.asp")
end if

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧