Implementation of Member Class in Member Management System

xiaoxiao2021-03-06  82

First: Database Design: (Database for Access)

Member Information Table User_Info

Field

Description

Type (length)

Note

Id

Member logo

auto numbering

Self Growth

User_name

username

text

User_password

password

text

Question

Password prompt problem

text

Answer

answer

text

Name

call

text

SEX

gender

text

Birthday

Birthday

Date type

Region

area

text

CITY

city

text

Address

address

text

Phone

phone

text

Email

e-mail

text

CIERTIFIED

Yes No certification

text

Ctype

Type of membership

text

User_grade

Member level text

2: Code Implementation: <% DIM CONN, ConnString, dbfiledbfile = server.mappath ("/ database / db.mdb") set conn = server.createObject ("AdoDb.Connection" 'Connstring = "proviker = Microsoft.jet. OLEDB.4.01; Data Source = "& dbfileConnstring =" DRIVER = {Microsoft Access Driver (* .mdb)}; dbq = "& dbfileconn.open connString

'Define user classes Class User_Info dim ID, User_Name, User_Password, Question, Answer, Name, Sex, Birthday, Region, City, Address dim Phone, Email, Ciertified, CType, User_Grade' class initialization Private Sub Class_Initialize ID = 0 User_Name = " "User_password =" "Question =" "Answer =" "name =" "SEX =" "birtHday =" 1910-01-01 "region =" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" CIERTIFIED = "No" CType = "Normal Member" User_Grade = "Bronze" End Sub 'Load User Information Public Sub Load (Byval UserName) DIM RS, SQL SQL = "SELECT * from user_info where user_name ='" & username "" "SET RS = conn.execute (SQL) if not (rs.bof and r.) THEN ID = rs (" ID ") user_name = rs (" user_name ") user_password = rs (" user_password ") Question = rs ( "Question") Answer = RS ("Answer") Name = RS ("Name") SEX = RS ("SEX") Birthday = RS ("Birthday") Region = RS ("Region") City = rs ("City" ") Address = rs (" address ") phone = rs (" phone ") Email = rs (" email ") ctyfied = rs (" ctyfied ") ctype = rs (" ctype ") user_grade = rs (" US) Er_Grade ") end if rs.close set = Nothing end sub 'detects the user's existing database' return value: true existence, false does not exist; public function isxist () DIM RS, SQL, FLAG SQL =" SELECT * from users_info Where user_name = '"& user_name" "SET RS =

Conn.execute (s.bof and rs.EOF) THEN flag = true else flag = false end if xi = flag = nothing meansxist = flag end function 'When logging in, it is determined whether the user password is correct.' Return value : True correctly, False returns Public Function IsPassed () dim rs, sql, Flag if User_Name <> "" and user_Password <> "" then sql = "select * from user_Info where User_Name = '" & User_Name & "' and user_Password = '"& Password &"' "SET RS = Conn.execute (SQL) if not (rs.bof and r.) THEN flag = true else flag = false end if rs.close set = Nothing else flag = false end If ISPASSED = Flag End Function 'Add New User Public Function Add () DIM STRSQL if ISEXIST () DIM STRSQL IF ISEXIST () = TRUE THEN ADD = FALSE EXIT FUNCTION END IF USER_NAME = "OR User_Password =" "Or Question =" "OR Answer =" "then Add = False exit function end if strSQL =" Insert into user_Info (User_Name, user_Password, Question, Answer, Name, Sex, Birthday, Region, City, Address, Phone, Email, Ciertified, CType, User_Grade) "strSQL = strSQL & "VALUES ('" & user_name & ",'" TRSQL = strsql & user_password & "" strsql = strsql & "'" & quhip & "," strsql = strsql & "" & answer & "", "strsql = strsql &" "& name" " , "Strsql = strsql &" '"& sex &"', "strsql = strsql &" # "& birthday &" #, "strsql = strsql &"

"& Region &" ', "strsql = strsql &"' "& city" "," strsql = strsql & "" "strsql = strsql &" "" & phone & "," Strsql = strsql & "'" & email & "," strsql = strsql & "'" & ciertified & "", "strsql = strsql &" "& ctype &", "strsql = strsql &" '" User_Grade & " ')"' response.write strSQL Conn.Execute (strSQL) Add = True End Function 'modify user Public Sub Update () dim strSQL If ID = 0 then exit sub end if strSQL = "Update user_Info set user_Password = '"& User_password &"' "strsql = strsql &", question = '"& quhip"' "strsql = strsql &", answer = '"& answer &" "strsql = strsql &", birthday = # " & birthday & "#" strsql = strsql & ", sex = '" & sex & "" strsql = strsql & ", region ='" & region & "" strsql = strsql & ", city = '& city & "STRSQL = strsql &", address = '"& address" "strsql = strsql &", phone =' "& phone &" "strsql = strsql &", email = '"& email" '"Strsql = strsql &", ciertified =' "

转载请注明原文地址:https://www.9cbs.com/read-94893.html

New Post(0)