⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.asp

📁 简单明晰的asp后台代码 新闻 产品
💻 ASP
字号:
<!--#include file = "../inc/dbclass.inc.asp"-->
<!--#include file="../inc/md5.asp" -->

<%
dim position, aaction, errmsg, auserid, apasswd, arepasswd, alevel

position = getsafeint(trim(request("position")),0)

if position < 1 then
	errmsg = ""
	position = 1
else
	errmsg="<font color=#ff0000><b>您没有登陆或者停留的时间过长,请重新登陆!</b></font>"
end if

aaction = getsafestr(request.form("action"))
if aaction = "true" then
	dim server_v1, server_v2
   	server_v1 = cstr(request.servervariables("http_referer"))
   	server_v2 = cstr(request.servervariables("server_name"))
   	if mid(server_v1,8,len(server_v2)) <> server_v2 then '外部提交的数据
		call oktowhere("数据提交错误!","-1")
	else
		auserid = trim(request("a_userid"))
		apasswd = trim(request("a_pwd"))
		arepasswd = trim(request("a_rpwd"))
	
		if auserid <> "" and apasswd <> "" and arepasswd <> "" then
			if arepasswd = cstr(session("psn")) then
				ssql = "select * from admin where a_userid ='"&auserid&"'"
				ors.open ssql, oconn, 0, 1
				if not ors.eof then
					if ors("a_pwd") = md5(apasswd) then
						' 登录成功
						alevel = ors("a_level")
						session("sys_admin") = auserid
						session("sys_level") = alevel
					
						if position = 2 then
							response.write "<script language='javascript'>top.document.location.reload();</script>"
						else
							response.redirect "admin.asp"
							response.end
						end if
						'session(psn) = ""
					else
						errmsg = "提示:密码输入错误!"
					end if
				else
					errmsg = "提示:该用户名输入错误或者不存在!"
				end if
				ors.close
				set ors = nothing
			else 
				errmsg = "提示:附加码输入错误!"
			end if
		else
			errmsg = "提示:用户名或、密码、附加码不能为空!"
		end if
	end if
end if
%>

<html>
<head>
<title><%=homepage_title%>--管理中心-用户登陆</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">

<script language="javascript">
<!--
function window_onload() {
	document.mail.a_userid.focus();
}
function cancel()
{
	mail.reset();
}

function isvalid()
{
	if (document.mail.a_userid.value=="")
	{
		alert("用户名不能为空");
		document.mail.a_userid.focus();
		return false;
	}
	if (document.mail.a_pwd.value=="")
	{
		alert("密码不能为空");
		document.mail.a_pwd.focus();
		return false;
	}
	
	if (document.mail.a_rpwd.value=="")
	{
		alert("附加码不能为空");
		document.mail.a_rpwd.focus();
		return false;
	}
	return true;
}
//-->
</script>
<link rel="stylesheet" href="../css/style.css" type="text/css">
</head>

<body bgcolor=#ffffff topmargin=0 leftmargin="0" onload="return window_onload()">
<p>&nbsp;</p>

<div align="center"><font color="#ff0000"><b><%=errmsg%></b></font></div>
<table width="450" height="289" border="0" cellpadding="0" cellspacing="0" background="images/admin.gif" align="center">
  <form name=mail action="login.asp" onsubmit="return isvalid();" method=post>
    <tr> 
      <td width="83" height="133">&nbsp;</td>
      <td width="283">&nbsp;</td>
      <td width="84">&nbsp;</td>
    </tr>
    <tr> 
      <td height="98">&nbsp;</td>
      <td valign="top"> 
        <table cellspacing=0 cellpadding=0 width=260 border=0 align="center">
          <tbody> 
          <tr> 
            <td height="28" style="line-height:180%"> 帐&nbsp;&nbsp;号: 
              <input name="a_userid" type="text" class="button1" id="a_userid" size="20">
            </td>
          </tr>
          <tr> 
            <td height="28" style="line-height:180%"> 密&nbsp;&nbsp;码: 
              <input name="a_pwd" type="password" class="button1" id="a_pwd" size="20">
            </td>
          </tr>
          <tr>
            <td height="28" style="line-height:180%"> 附加码: 
              <input name="a_rpwd" type="text" class="button1" id="a_rpwd" size="20">&nbsp;<img src="getcode.asp">
              <input type="hidden" name="action" value="true">
			  <input type="hidden" name="position" value="<%=position%>">
			  </td>
          </tr>
          </tbody> 
        </table>
      </td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td valign="top"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td> 
              <div align="center"> <a href="/index.asp"><font color="#0000ff">返回首页</font></a> 
              </div>
            </td>
            <td> 
              <input type=image height=23 width=62 src="images/btn_index_ok.gif" border=0 name=submit1>
              <img onmouseover="event.srcelement.style.cursor='hand'" onclick=cancel() height=23 src="images/btn_index_cancel.gif" width=62 border=0> </td>
          </tr>
        </table>
      </td>
      <td>&nbsp;</td>
    </tr>
  </form>
</table>
</body>
</html>

                                                                                              
                                                                                                    

⌨️ 快捷键说明

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