checklogin.asp

来自「<1> 优化了部分代码及一些BUG.提高了浏览速度 <2&」· ASP 代码 · 共 62 行

ASP
62
字号
<!--#include file=system/include/config.asp-->
<!--#include file=conn_system.asp-->
<!--#include file=system/include/function.asp-->
<%
	dim user,password,strSql,rsTmp,retValue
	user=request("username")
	password=request("password")
	if request("username")="" then
%>
<SCRIPT LANGUAGE=vbscript>
<!--
msgbox("用户名不能为空!")
window.top.location.href="login.htm"
-->
</SCRIPT>
<%
	end if
	if password="" then
%>
<SCRIPT LANGUAGE=vbscript>
<!--
msgbox("密码不能为空!")
window.top.location.href="login.htm"
-->
</SCRIPT>
<%
	end if
	set rsTmp=Server.CreateObject("ADODB.RecordSet")
	strSql = "select * from [user] where username='" & convertsql(user) & "'"
	strSql = strSql & " and password='" & convertsql(password) & "'"
	rsTmp.open strSql,conn,3,3
	if rsTmp.eof then
        retValue=1
%>
<SCRIPT LANGUAGE=vbscript>
<!--
msgbox("'该用户不存在' 或 '密码不正确'!")
window.top.location.href="login.htm"
-->
</SCRIPT>
<%
		
	else
		retValue=0
		'##设置session
		session("zjlogin")=""
		session("adminlogin")="ok"
		session("user_id")=rsTmp("id")
		session("user_name")=rsTmp("username")
                rsTmp("last_date")=now()
                rsTmp.update
	end if
	rsTmp.close
	set rsTmp=nothing
	conn.close
	set conn=nothing
	'##跳转到另一页去
	if retValue=0 then
		response.redirect "member.asp"
	end if
%>
<!--#include file=system/include/foot.asp-->

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?