www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\adminadmin\admin_login.asp

    <!--#include file="../conn.asp"-->
<!--#include file="setup.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
Response.CacheControl = "no-cache"
Dim m_strUsername,m_strPassword,m_strValidate,showLogininfo
showLogininfo = 0
If showLogininfo = 1 Then
	m_strUsername = Replace(Trim(Request("u")), "'", "")
	m_strPassword = Replace(Trim(Request("p")), "'", "")
	m_strValidate = Replace(Trim(Request("v")), "'", "")
End If

FoundErr = False

Select Case Newasp.CheckStr(Request("action"))
	Case "logout" '退出系统
		Call logout()
	Case "login" '登陆系统
		Call chklogin()
	Case Else
		Call main()
End Select

If Founderr = True Then
	SaveLogInfo("非法登陆!")
	Response.Redirect("showerr.asp?action=error&message=" & Server.URLEncode(ErrMsg) & "")
End If
NewAsp.PageEnd

Sub main()
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理员登陆</title>
<style type="text/css">
<!--
body {color:#333;margin:100px 0;padding:0;background:#73A2D6;}
body,td,th,div,span,input,select {font-family:宋体, fantasy;font-size:12px;}
.STYLE1 {color:#42bfbf;text-align:left;}
a {font-size:12px;color:#42bfbf;text-decoration:none;}
.logininput{border:1px solid #7E94C7;background:#C0F8CA;height:16px;line-height:16px;vertical-align:middle;font-family:Verdana,宋体, fantasy;}
.mainTableborder {border:2px #fff solid ;width:600px;}
#img_checkcode {color:red;}
#isok_checkcode {margin-left:5px;}
span img {border:0;vertical-align:middle;}
#AdminName,#PassWord,#validate {width:165px;}
#checkcode {width:42px;height:16px;}
-->
</style>
</head>
<script language="javascript">
<!--//
window.onload = SetFocus;
function SetFocus(){
if (document.myform.AdminName.value=="")
	document.myform.AdminName.focus();
else
	document.myform.AdminName.select();
}
function checkForm(form1){
	if(form1.AdminName.value=="")
	{
		alert("请输入您的用户名!");
		form1.AdminName.focus();
		return false;
	}
	if(form1.PassWord.value == "")
	{
		alert("请输入您的密码!");
		form1.PassWord.focus();
		return false;
	}
<%
If IsAdminCheckCode Then
%>
	try{
		if (form1.verifycode.value=="" || form1.verifycode.value.length<4){
		   alert ("请输入您的验证码!");
		   form1.verifycode.focus();
		   return false;
		}
	}catch(e){}
<%
End If
%>
}
var show_checkcode = false;
function get_checkcode() {
	var chkCodeFile = "../<%=CodeFilePath%>";
	if(!show_checkcode){
		if(document.getElementById("img_checkcode"))
			document.getElementById("img_checkcode").innerHTML = '<img  id="checkcodeimg" src="'+chkCodeFile+'?t='+Math.random()+'" alt="点击刷新验证码" style="cursor:pointer;border:0;vertical-align:middle;height:18px;" onclick="this.src=\''+chkCodeFile+'?t=\'+Math.random()" />'
			show_checkcode = true;

		if(document.getElementById("isok_checkcode"))
			document.getElementById("isok_checkcode").innerHTML = '<a href="javascript://" onclick="setTimeout(function(){ document.getElementById(\'checkcodeimg\').src=\''+chkCodeFile+'?t=\'+Math.random()},100);">看不清<\/a>';
	}
}
//-->
</script>
<script type="text/javascript" language="javascript"  src="script/ajax.js"></script>
<body>
<div align="center">
<form id="myform" name="myform" method="post" action="?action=login" target="_top" onSubmit="return checkForm(this);">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="mainTableborder">
  <tr>
    <td colspan="4" height="72"><a href="http://www.801w.cn" target="_blank"><img alt="801w软件代理系统 www.801w.cn" src="images/newasp_admin2_r1_c1.jpg" border="0" width="600" height="72" /></a></td>
  </tr>
  <tr>
    <td width="223"><img src="images/newasp_admin2_r2_c1.jpg" width="223" height="204" /></td>
    <td width="102" valign="bottom" background="images/newasp_admin2_r2_c2.jpg"><a href="http://www.801w.cn" target="_blank"><img src="images/logo1.gif" alt="801w代理系统" width="88" height="31" border="0" /></a></td>
    <td width="245" background="images/newasp_admin2_r2_c3.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="3">
	<%
	On Error Resume Next
	Dim Rs
	Set Rs = NewAsp.Execute("SELECT id FROM [NC_Admin] WHERE username='admin' and password='7bbd73250516f069'")
	If Not(Rs.BOF And Rs.EOF) Then
%>	 <tr>
        <td class="STYLE1">默认用户:<font color="red"><b>admin</b></font>&nbsp;&nbsp;默认密码:<font color="red"><b>admin123</b></font></td>
	</tr><%
	End If
	Set Rs = Nothing
%>
      <tr>
        <td class="STYLE1">用户名称:
              <input name="AdminName" type="text" class="logininput" id="AdminName" size="22" value="<%=m_strUsername%>" onFocus="this.select();" />
          </td>
      </tr>
      <tr>
        <td class="STYLE1">用户密码:
          <input name="PassWord" type="password" class="logininput" id="PassWord" size="22" value="<%=m_strPassword%>" />
		</td>
      </tr>
<%If IsAdminValidate Then%>
      <tr>
        <td class="STYLE1">认 证 码:
          <input name="validate" type="password" class="logininput" id="validate" size="22" value="<%=m_strValidate%>" />
        </td>
      </tr>
<%
End If
If IsAdminCheckCode Then
%>
      <tr>
        <td class="STYLE1">验 证 码:
          <input name="checkcode" type="text" class="logininput" id="checkcode" size="5" maxlength="4" onfocus="get_checkcode();this.onfocus=null;" onkeyup="ajaxcheckcode('check_code','checkcode');" />
		  <span id="img_checkcode"><label style="cursor:pointer;" onclick="get_checkcode();">点击获取验证码</label></span><span id="isok_checkcode"></span></td>
      </tr>
<%
End If
%>
      <tr>
        <td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label>
          <input name="submit" type="image" src="images/admin_submit.gif" />
           <a href="../"><img alt="返回首页" src="images/admin_home.gif" border="0" width="80" height="24" /></a>
        </label></td>
      </tr>
    </table></td>
    <td width="30"><img src="images/newasp_admin2_r2_c4.jpg" width="30" height="204" /></td>
  </tr>
  <tr>
    <td colspan="4" height="44"><a href="http://www.newasp.net" target="_blank"><img alt="Newasp CMS" src="images/newasp_admin2_r3_c1.jpg" border="0" width="600" height="44" /></a></td>
  </tr>
</table>
</form>
</div>
</body>
</html>
<%
End Sub

Sub chklogin()
	Dim Rs,SQL
	Dim adminname, password,RandomCode
	adminname = Newasp.CheckBadstr(Request.Form("adminname"))
	password = md5(Trim(Replace(Request.Form("password"), "'", "")),16)
	If NewAsp.ChkPost = False Then
		ErrMsg = ErrMsg + "您提交的数据不合法,请不要从外部提交登陆!"
		Founderr = True
	End If
	If Len(adminname) = 0 Then
		ErrMsg = ErrMsg + "用户名不能为空!"
		Founderr = True
	End If
	If Len(Request.Form("password")) = 0 Then
		ErrMsg = ErrMsg + "用户密码不能为空!"
		Founderr = True
	End If
	If IsAdminValidate Then
		If Trim(Request.Form("validate")) <> AdminValidateCode Or Trim(Request.Form("validate")) = "" Then
			ErrMsg = ErrMsg+"<li>您输入的认证码或者密码错误,请重新输入!</li>"
			Founderr = True
			Exit Sub
		End if
	End If
	If IsAdminCheckCode Then
		If Not NewAsp.CodeIsTrue Then
			ErrMsg = ErrMsg + "<br>" + "<li>您输入的认码和系统产生的不一致,请重新输入!</li>"
			Founderr = True
			Exit Sub
		End If
	End If
	If Founderr = True Then Exit Sub
	If Not IsObject(Conn) Then ConnectionDatabase
	Set Rs = NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT * FROM NC_Admin WHERE password='" & Replace(password, "'", "''") & "' And username='" & adminname & "'"
	Rs.Open SQL, Conn, 1, 3
	If Rs.BOF And Rs.EOF Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>您输入的用户名和密码不正确或者您不是系统管理员。!</li>"
		Exit Sub
	Else
		If Rs("isLock") <> 0 Or Rs("isLock") = "" Then
			Founderr = True
			ErrMsg = "<li>你的用户名已被锁定,你不能登陆!如要开通此帐号,请联系管理员。</li>"
			Exit Sub
		End If
		RandomCode = NewAsp.GetRandomCode(16)
		Rs("LoginTime") = Now()
		Rs("Loginip") = NewAsp.UserTrueIP
		Rs("RandomCode") = RandomCode
		Rs.Update
		If FoundErr = False Then
			Session(AdminSessionName & "_AdminName") = Rs("username")
			Session(AdminSessionName & "_AdminPass") = Rs("password")
			Session(AdminSessionName & "_AdminGrade") = Rs("AdminGrade")
			Session(AdminSessionName & "_Adminflag") = Rs("Adminflag")
			Session(AdminSessionName & "_AdminStatus") = Rs("Status")
			Session(AdminSessionName & "_AdminRandomCode") = RandomCode
			Session(AdminSessionName & "_AdminID") = Rs("id")
			Session.Timeout=45
			If IsAdminValidate Then
				Session(AdminSessionName & "_validate") = Trim(Request.Form("validate"))
			End If
			If UseAdminCookies Then
				Response.Cookies(AdminCookiesName).path = "/"
				Response.Cookies(AdminCookiesName)("AdminName") = Rs("username")
				Response.Cookies(AdminCookiesName)("AdminPass") = Rs("password")
				Response.Cookies(AdminCookiesName)("AdminGrade") = Rs("AdminGrade")
				Response.Cookies(AdminCookiesName)("Adminflag") = Rs("Adminflag")
				Response.Cookies(AdminCookiesName)("AdminStatus") = Rs("Status")
				Response.Cookies(AdminCookiesName)("RandomCode") = RandomCode
				Response.Cookies(AdminCookiesName)("AdminID") = Rs("id")
				If IsAdminValidate Then
					Response.Cookies(AdminCookiesName)("validate") = Trim(Request.Form("validate"))
				End If
			End If
		End If
	End If
	Rs.Close:Set Rs = Nothing
	Response.Redirect("admin_index.asp")
End Sub

Sub logout()
	'清除COOKIES中管理员身份的验证信息.
	Session(AdminSessionName & "_AdminName")		= Empty
	Session(AdminSessionName & "_AdminPass")		= Empty
	Session(AdminSessionName & "_AdminGrade")		= Empty
	Session(AdminSessionName & "_Adminflag")		= Empty
	Session(AdminSessionName & "_AdminStatus")		= Empty
	Session(AdminSessionName & "_AdminRandomCode")	= Empty
	Session(AdminSessionName & "_AdminID")			= Empty
	Session(AdminSessionName & "_validate")			= Empty
	'Session.Abandon
	Response.Cookies(AdminCookiesName) = Empty
	Response.Redirect ("../")
End Sub

%>