28,409
社区成员




<!--#include file="conn.asp" -->
<%
username=Trim(Request.Form("username"))
password=Trim(Request.Form("password"))
if username<>"" then
set rs=server.CreateObject("adodb.recordset")
sql="select psw from admin where uid='"&username&"'"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
Response.Write("<script language='JavaScript'>alert('用户名错误!请重新登陆!')</script>")
else
if password<>rs("psw") then
Response.Write("<script language='JavaScript'>alert('密码错误!请重新登陆!')</script>")
else
session("uids")=username //这里明明赋值了...但是显示不了..
session("admin")="success"
response.Redirect("index.asp")
end if
end if
end if
set rs=nothing
set conn=nothing
%>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%if session("admin")<>"success" then
%>
<table width="200" border="0">
<tr>
<td>
<FORM name="form1" method="post" id="f1"action="login.asp" onSubmit="return CheckForm()">
用户名:
<input name="username" type="text" id="un" size="10" maxlength="20" style="border:0;border-bottom:1 solid black;background:;width=100px;"/>
<br>
密 码:
<input name="password" type="password" id="pw" size="10" maxlength="20" style="border:0;border-bottom:1 solid black;background:;width=100px;"/>
</td>
</tr>
<tr>
<td>
<div align="right"><input type="submit" name="post" value="提交"/>
<input type="button" name="regu" value="注册"/>
</div></td>
</tr>
</form>
</table>
<%else
response.Write("欢迎你:" & session("uids"))//这里显示,session("admin")有值..但这个就没!
%>
<table width="200" border="0">
<FORM name="form2" method="post" id="f2"action="logout.asp">
<div align="right">
<input type="submit" name="post" value="注销"/>
</div>
</FORM>
</table>
<%end if%>
<SCRIPT language="JavaScript">
function CheckForm()
{
if (document.f1.un.value.length == 0)
{
alert("请输入用户名.");
document.f1.un.focus();
return false;
}
if (document.f1.pw.value.length == 0)
{
alert("请输入密码.");
document.f1.pw.focus();
return false;
}
return true;
}
</SCRIPT>
[
<%
if isempty(Request.Form("username")) then
username = ""
else
username=Trim(Request.Form("username"))
end if
if isempty(Request.Form("password")) then
password = ""
else
username=Trim(Request.Form("password"))
end if
if username <>"" then
set rs=server.CreateObject("adodb.recordset")
sql="select psw from admin where uid='"&username&"'"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
Response.Write(" <script language='JavaScript'>alert('用户名错误!请重新登陆!') </script>")
else
if password <>rs("psw") then
Response.Write(" <script language='JavaScript'>alert('密码错误!请重新登陆!') </script>")
else
session("uids")=username //这里明明赋值了...但是显示不了..
session("admin")="success"
response.Redirect("index.asp")
end if
end if
end if
set rs=nothing
set conn=nothing
%>
<%
username=Trim(Request.Form("username"))
password=Trim(Request.Form("password"))
if username<>"" then
session("uids")=username //这里明明赋值了...但是显示不了..
session("admin")="success"
end if
%>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%if session("admin") <>"success" then
%>
<table width="200" border="0">
<tr>
<td>
<FORM name="form1" method="post" id="f1"action="login.asp" onSubmit="return CheckForm()">
用户名:
<input name="username" type="text" id="un" size="10" maxlength="20" style="border:0;border-bottom:1 solid black;background:;width=100px;"/>
<br>
密 码:
<input name="password" type="password" id="pw" size="10" maxlength="20" style="border:0;border-bottom:1 solid black;background:;width=100px;"/>
</td>
</tr>
<tr>
<td>
<div align="right"> <input type="submit" name="post" value="提交"/>
<input type="button" name="regu" value="注册"/>
</div> </td>
</tr>
</form>
</table>
<%else
response.Write("欢迎你:" & session("uids"))//这里显示,如果是session("admin")就有值..但这个就没!
%>
<table width="200" border="0">
<FORM name="form2" method="post" id="f2"action="logout.asp">
<div align="right">
<input type="submit" name="post" value="注销"/>
</div>
</FORM>
</table>
<%end if%>
<SCRIPT language="JavaScript">
function CheckForm()
{
if (document.f1.un.value.length == 0)
{
alert("请输入用户名.");
document.f1.un.focus();
return false;
}
if (document.f1.pw.value.length == 0)
{
alert("请输入密码.");
document.f1.pw.focus();
return false;
}
return true;
}
</SCRIPT>
response.Write("欢迎你:" & session("uids"))
response.Write "欢迎你:" & session("uids")