www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > user/user_login.asp

    <%
'===================================================================
'= ASP FILENAME	: /user/user_login.asp
'= CREATED TIME : 2006-5-4
'= LAST MODIFIED: 2006-5-4
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION  : 用户登陆
'= Change Log:
'===================================================================
%>
<!-- #include file = "../inc/customer/include_customer_action_execute.asp" -->
<!-- #include file = "./user_inc.asp" -->
<!-- #include file = "../inc/inc_md5.asp" -->
<%
'========================================================
'==   Action参数设置
'========================================================
'== 页面名
Const CONST_PAGE_FILE	= "user/user_login.asp"

'== 页面标题/功能
Const CONST_PAGE_TITLE	= "用户登陆"

'== 功能函数名字空间
Const CONST_ACTION_FUNC	= "UserLoginCtl"

'== 相对根目录路径 
GBL_strHomeURL			= "../"

'== 页面构造
Call ActionBuild()

'== 请求校验与过滤
Call ActionFilter(CONST_PAGE_FILE,CONST_ACTION_FUNC)

'== 页面析构
Call ActionOver()

%>

<%
'===================================================================
'= Function    : UserLoginCtl()
'= Time		   : Created At 2006-5-4
'= Input       :
'= Description : 用户登陆
'===================================================================
Function UserLoginCtl()

	Dim strUserPwd,strUserName,strUserPassword
	Dim strAddInfo
	Dim intErrId
	Dim intCookie

	intErrId = 0

	strUserName = Trim(Request("iptUserName"))
	strAddInfo = "该用户帐号"
	intErrId = 			DataCheck("DT_FIX_LENGTH",strUserName,strAddInfo,"2|DTC_LESS_MORE_LEN|10|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")


	strUserPassword = Trim(Request("iptPassword"))
	strAddInfo = "该用户密码"
	intErrId = 			DataCheck("DT_FIX_LENGTH",strUserPassword,strAddInfo,"6|DTC_LESS_MORE_LEN|20|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	intCookie = Trim(Request.Form("iptCookie"))
	If IsNumeric(intCookie) Then
		intCookie = Cint(intCookie)
		Select Case intCookie
			Case    0 : intCookie = 0
			Case	1 : intCookie = 1
			Case	7 : intCookie = 7
			Case	31: intCookie = 31
			Case   365: intCookie = 365
			Case Else : intCookie = 365
		End Select
	Else
		intCookie = 0
	End If

	'== Encrypt user's pwd
	strUserPassword = Md5(strUserPassword)

	'== check username and pwd
	If CheckPass(strUserName,strUserPassword,0) Then
		'== set user login cookie
		If intCookie > 0 Then
			Response.Cookies(GBL_strCookieURL).Expires = Date + intCookie
			Response.Cookies(GBL_strCookieURL)("user") = strUserName
			Response.Cookies(GBL_strCookieURL)("pass") = strUserPassword
		End If

	End If
	

	'== Successfully login and redirect homepage
	Call ActionOver()
	Response.Redirect GBL_strHomeURL & "user/user_info_show.asp?action=ShowUserAllInfo"

End Function
%>