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

📄 usercls.asp

📁 足球推荐程序 功能齐全 还 不错 界面漂亮 容易修改
💻 ASP
字号:
<!--#include file="../com/SqlStr.asp"-->
<!--#include file="../com/md5.asp"-->
<!--#include file="../com/ComCls.asp"-->
<%
    Set AdoCn=Server.CreateObject("Adodb.Connection")
    Set AdoRs=Server.CreateObject("Adodb.RecordSet")
    Set FunCls=New FunctionClass
    Dim SQL,Page
'-------------------------------------------------------    
	Class UserCls
		Public Sub Class_Initialize()
			On Error Resume Next
			AdoCn.Open AdoSQL
			If Err.Number<>0 Then
				FunCls.ErrMessage Err.Description
			End If   
		End Sub
		Public Sub RsClose()
			If AdoRs.State=1 Then
				AdoRs.Close
			End If
		End Sub
 '------------------------------------------------------------------------	
'-----------------------------------------------------------
		public sub usercheck(UserName,UserPwd,UserNumber)'用户登录
			If Request("submitlogin")<>"" Then
				If session("Loginnum")<> ucase(UserNumber) Then
					FunCls.MessAgeShowDialog "验证码输入不正确!"
				Else
					UserName=FunCls.Sift_Str(UserName,2)
					UserPwd=FunCls.Sift_str(UserPwd,2)
					SQL="select UserName from ztsm_adminuser where username='"&UserName&"' and password='"&MD5(UserPwd,1)&"'"
					Set AdoRs=AdoCn.Execute(SQL)
					IF Not AdoRs.Eof and not AdoRs.bof  Then
						 Session("adminUserName")=AdoRs(0)
						FunCls.GoToUrl "Main.asp"
						 response.end 
					else
						FunCls.MessAgeShowDialog "用户名和密码不正确!"
					End If
					RsClose
				End If
			End If   
		end sub
'-----------------------------------------------------------
		public sub passwordchange(password,newpassword,newpassword1)'修改密码
			if request("submitpaschange")<>"" then
				password=FunCls.Sift_str(password,2)
				newpassword=FunCls.Sift_str(newpassword,2)
				newpassword1=FunCls.Sift_str(newpassword1,2)
				SQL="select username,id from ztsm_adminuser where username='"&session("adminusername")&"' and password='"&MD5(password,1)&"' "
				set AdoRs=AdoCn.execute(SQL)
				if not AdoRs.eof and not AdoRs.bof then
					if newpassword<>newpassword1 then
						FunCls.MessAgeShowDialog "对不起,你两次新密码输入有误!"
						response.end 
					else
						SQL="update ztsm_adminuser set [password]='"&MD5(newpassword,1)&"' where username='"&session("adminusername")&"' "
						AdoCn.execute(SQL)
						FunCls.MessAgeShowDialog "密码修改成功,你的新密码为:"&newpassword&""
						response.end 
					end if
				else
					FunCls.MessAgeShowDialog "对不起,你的旧密码输入有误!"
					response.end 
				end if
				RsClose
			end if
		end sub
'--------------------------------------------------------------
		'会员管理 
		public sub useradd(username,password,startdate,useday)'新增用户
		'username,password,cidusername,usertype,createdate,enddate
			if request("submituseradd")<>"" then
				username=FunCls.Sift_Str(username,2)
				password=md5(FunCls.Sift_Str(password,2),1)
				startdate=FunCls.Sift_Str(startdate,2)
				useday=funcls.sift_Str(useday,1)
				if username="" or password="" or startdate="" then
					FunCls.MessAgeShowDialog "请填写所有资料!"
					response.end 
				end if
				if IsDate(startdate)=false then
					Response.write "<script language>alert('时间格式有误,请确认!!!');history.back();</script>"
					Response.end
				end if
				SQL="insert INTO ztsm_user([username],[password],startdate,useday) values('"&username&"','"&password&"','"&startdate&"',"&useday&")"
				AdoCn.execute(SQL)
				FunCls.MessAgeShowDialog "新增成功"
				response.end 
			end if 
		end sub
'------------------------------------------------------------
		public sub userlist(page)'显示用户列表
			
				SQL="SELECT id,username,startdate,useday,allowuse FROM ztsm_user order by id desc"
			
			AdoRs.Open SQL ,AdoCn,1,1
			if not AdoRs.eof then
				FunCls.divpage 15,page
				pagestr=FunCls.Showpage
				Do While Not AdoRs.Eof and RowCount>0
					if adors(4)=1 then
						allowuse="<font color=red>是</font>"
					else
						allowuse="否"
					end if
					enddate=dateadd("d",adors(3),adors(2))
					body=body&"<tr bgcolor=""#CCCCCC"">"&vbcrlf 
                 	body=body&"<td>"&AdoRs("id")&"</td>"&vbcrlf 
                 	body=body&"<td>"&AdoRs("username")&"</td>"&vbcrlf 
                 	body=body&"<td>"&AdoRs("startdate")&"</td>"&vbcrlf 
                 	body=body&"<td>"&AdoRs("useday")&"</td>"&vbcrlf 
					body=body&"<td>"&enddate&"</td>"&vbcrlf 
					body=body&"<td>"&allowuse&"</td>"&vbcrlf 
                 	body=body&"<td><a href=""useredit.asp?userid="&AdoRs("id")&""">修改</a></td>"&vbcrlf 
					body=body&"</tr>"&vbcrlf 
                 	AdoRs.MoveNext
					RowCount=RowCount-1
				Loop 
				body=body&"<tr bgcolor=""#CCCCCC""><td colspan=""7"">"&pagestr&"</td></tr>"
			else
				body="<tr bgcolor=""#CCCCCC""><td colspan=""7"">暂无用户记录</td></tr>"
			end if
			RsClose
			response.write body
		end sub
'----------------------------------------------------------
		public sub userdatashow(userid)'显示修改用户信息
			userid=Funcls.Sift_Str(userid,1)
			SQL="SELECT id,username,password,startdate,useday,allowuse from ztsm_user where id="&userid&""
			set AdoRs=AdoCn.execute(SQL)
			if not AdoRs.eof and not AdoRs.bof then
				body="<input type=""hidden"" name=""userid"" value="""&AdoRs("id")&""">"&vbcrlf 
				body=body&"<tr bgcolor=""#CCCCCC"">"&vbcrlf 
				body=body&"<td>用户名:</td>"&vbcrlf 
				body=body&"<td><input type=""text"" name=""username"" value="""&AdoRs("username")&""" readonly></td>"&vbcrlf 
				body=body&"</tr>"&vbcrlf 
				body=body&"<tr bgcolor=""#CCCCCC"">"&vbcrlf 
				body=body&"<td>密码:</td>"&vbcrlf 
				body=body&"<td><input type=""password"" name=""password"" value="&AdoRs("password")&"></td>"&vbcrlf 
				body=body&"</tr>"&vbcrlf 
				body=body&"<tr bgcolor=""#CCCCCC"">"&vbcrlf 
				body=body&"<td>开始时间:</td>"&vbcrlf 
				body=body&"<td><input type=""text"" name=""startdate"" value="&AdoRs("startdate")&">格式如:2006-09-30</td>"&vbcrlf 
				body=body&"</tr>"&vbcrlf 
				body=body&"<tr bgcolor=""#CCCCCC"">"&vbcrlf 
				body=body&"<td>总天数:</td>"&vbcrlf 
				body=body&"<td><input type=""text"" name=""useday"" value="&AdoRs("useday")&"></td>"&vbcrlf 
				body=body&"</tr>"&vbcrlf 
				body=body&"<tr bgcolor=""#CCCCCC"">"&vbcrlf 
				body=body&"<td>是否可用:</td>"&vbcrlf 
				if adors("allowuse")=1 then
					body=body&"<td><input type=""checkbox"" name=""allowuse"" value=""1"" checked></td>"&vbcrlf 
				else
					body=body&"<td><input type=""checkbox"" name=""allowuse"" value=""1"" >是否可用</td>"&vbcrlf 
				end if
				
				body=body&"</tr>"&vbcrlf 
			end if
			RsClose
			response.write body
		end sub
'-----------------------------------------------------------
		public sub userdataedit(userid,password,startdate,useday,allowuse)'修改用户资料
			if request("submitedit")<>"" then
				userid=FunCls.Sift_Str(userid,1)
				password=md5(FunCls.Sift_Str(password,2),1)
				startdate=FunCls.Sift_Str(startdate,2)
				useday=funcls.sift_Str(useday,2)
				allowuse=funcls.sift_Str(allowuse,1)
				if allowuse="" then
					allowuse=0
				end if
				sql="SELECT password from ztsm_user where id="&userid&" "
				
				set AdoRs=AdoCn.execute(SQL)
				if not AdoRs.eof and not AdoRs.bof then
					passwordold=AdoRs(0)
				end if
				RsClose
				if password=passwordold then
					SQL="UPDATE ztsm_user set startdate='"&startdate&"',useday="&useday&",allowuse="&allowuse&" where [id]="&userid&""
				else
					SQL="UPDATE ztsm_user set startdate='"&startdate&"',useday="&useday&",allowuse="&allowuse&",[password]='"&password&"' where [id]="&userid&""
				end if
				
				AdoCn.execute(SQL)
				Response.write "<script language>alert('更新成功!!!');history.back();</script>"
				response.end
			end if
		end sub
'------------------------------------------------------- 
       Public Sub Class_Terminate()
           If AdoRs.State=1 Then
              AdoRs.Close
           End If
           If Not AdoRs Is Nothing Then
              Set AdoRs=Nothing
           End If
           If AdoCn.State=1 Then
              Adocn.Close
           End If
           If Not AdoCn Is Nothing Then
              Set AdoCn=Nothing
           End If
           Set FunCls=Nothing
       End Sub
    End Class
'-------------------------------------------------------  
%>

⌨️ 快捷键说明

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