<%
'查看有无该用户
dim db,strsql,rs
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("userinfo.mdb")&";driver={microsoft access driver (*.mdb)};"
strSql="Select user_name,password,user_type From users"
strSql=strSql & " Where user_name='" & Request.Form("user_name") & "' And password='" & Request.Form("password") & "'"
Set rs=db.Execute(strSql)
If not rs.eof and not rs.bof Then
'如果有记录,表示有该用户,则将用户名和用户类型保存到Session中
Session("user_name")=rs("user_name")
session("user_type")=rs("user_type")
Session("password")=rs("password")
'如果是普通用户,重定向到首页;如果是管理员,重定向到管理员页面
If Session("user_type")="A" Then
Response.Redirect "houtai.asp"
ELse
Response.Redirect "houtai2.asp"
End If
Else
'如果没有记录,表示没有该用户,请给出提示信息
Response.Write "对不起,用户名或密码有误,请<a href='admin.asp'>返回</a>重新登录"
End If
%>
后台界面
Sign.asp页面源码:
<%option explicit%>
<%
If request.form("user_name")<>""and request.form("password")<>""then
dim db,rs
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("data/zhangrong.mdb")&";driver={microsoft access driver (*.mdb)};"
dim strsql,user_name ,Password ,realname ,mobi,email,name
name=request.form("user_name")
'检查新用户名与数据库是否重复,哈哈,终于调通了
strSql="select * from user Where user_name='" & Request.Form("user_name") & "'"
Set rs=db.Execute(strSql)
If not rs.eof then
Response.Write "对不起,用户名已被注册,请<a href='sign.htm'>重新注册</a>"
rs.close
else
user_name=request.form("user_name")
Password=request.form("Password")
realname=request.form("realname")
mobi=request.form("mobi")
email=request.form("email")
strsql="insert into user(user_name ,Password ,realname ,mobi,email)values('"&user_name&"','"&Password&"','"&realname&"','"&mobi&"','"&email&"')"
db.execute(strsql)
response.redirect "cg.htm"
end if
end if
%>
Update.asp页面源码:
<%
if request.form("password")<>""then
dim db
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("userinfo.mdb")&";driver={microsoft access driver (*.mdb)};"
dim strsql,Password ,id
Password=request.form("Password")
StrSql="Update user Set Password='" & Password & "'Where user_name='"&session("user_name")&"'"
db.execute(strsql)
response.redirect "login1.htm"
else
response.write"请将所有信息填写完整"
response.write"<A HREF='user.asp'>请重新修改</a>"
end if
%>
Sign1页面源码:
<%option explicit%>
<%
If request.form("user_name")<>""and request.form("password")<>""then
dim db,rs
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("userinfo.mdb")&";driver={microsoft access driver (*.mdb)};"
dim strsql,user_name ,Password,name
name=request.form("user_name")
strSql="select * from user Where user_name='" & Request.Form("user_name") & "'"
Set rs=db.Execute(strSql)
If not rs.eof then
Response.Write "对不起,用户名已被注册,请<a href='sign1.htm'>重新注册</a>"
rs.close
else
user_name=request.form("user_name")
Password=request.form("Password")
strsql="insert into user(user_name ,Password)values('"&user_name&"','"&Password&"')"
db.execute(strsql)
response.redirect "cg.htm"
end if
end if
%>
Sign.asp页面源码:
<%option explicit%>
<%
If request.form("user_name")<>""and request.form("password")<>""then
dim db,rs
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("userinfo.mdb")&";driver={microsoft access driver (*.mdb)};"
dim strsql,user_name ,Password,name
name=request.form("user_name")
strSql="select * from users Where user_name='" & Request.Form("user_name") & "'"
Set rs=db.Execute(strSql)
If not rs.eof then
Response.Write "对不起,用户名已被注册,请<a href='sign.htm'>重新注册</a>"
rs.close
else
user_name=request.form("user_name")
Password=request.form("Password")
strsql="insert into users(user_name ,Password)values('"&user_name&"','"&Password&"')"
db.execute(strsql)
response.redirect "admin.asp"
end if
<%
'查看有无该用户
dim db,strsql,rs
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("userinfo.mdb")&";driver={microsoft access driver (*.mdb)};"
strSql="Select user_name,password,user_type From users"
strSql=strSql & " Where user_name='" & Request.Form("user_name") & "' And password='" & Request.Form("password") & "'"
Set rs=db.Execute(strSql)
If not rs.eof and not rs.bof Then
'如果有记录,表示有该用户,则将用户名和用户类型保存到Session中
Session("user_name")=rs("user_name")
session("user_type")=rs("user_type")
Session("password")=rs("password")
'如果是普通用户,重定向到首页;如果是管理员,重定向到管理员页面
If Session("user_type")="A" Then
Response.Redirect "houtai.asp"
ELse
Response.Redirect "houtai2.asp"
End If
Else
'如果没有记录,表示没有该用户,请给出提示信息
Response.Write "对不起,用户名或密码有误,请<a href='admin.asp'>返回</a>重新登录"
End If
%>
Login1.asp页面源码:
<%Response.Buffer=True%>
<%
'查看有无该用户
dim db,strsql,rs
set db=server.createobject("ADODB.connection")
db.open "dbq="&server.mappath("userinfo.mdb")&";driver={microsoft access driver (*.mdb)};"
strSql="Select user_name,password From user"
strSql=strSql & " Where user_name='" & Request.Form("user_name") & "' And password='" & Request.Form("password") & "'"
Set rs=db.Execute(strSql)
If not rs.eof and not rs.bof Then
'如果有记录,表示有该用户,则将用户名和用户类型保存到Session中
Session("user_name")=rs("user_name")
Session("password")=rs("password")
'如果是普通用户,重定向到首页;如果是管理员,重定向到管理员页面
If Session("user_name")="A" Then
Response.Redirect "user.asp"
ELse
Response.Redirect "user.asp"
End If
Else
'如果没有记录,表示没有该用户,请给出提示信息
Response.Write "对不起,用户名或密码有误,请<a href='index.asp'>返回首页</a>重新登录"
End If
%>
超级管理员后台界面(houtai.asp)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/coon.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim rs1
Dim rs1_numRows
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.ActiveConnection = MM_coon_STRING
rs1.Source = "SELECT * FROM dinggou ORDER BY id DESC"
rs1.CursorType = 0
rs1.CursorLocation = 2
rs1.LockType = 1
rs1.Open()
rs1_numRows = 0
%>
<%
Dim rs2__MMColParam
rs2__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
rs2__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim rs2
Dim rs2_numRows
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.ActiveConnection = MM_coon_STRING
rs2.Source = "SELECT * FROM ly WHERE id = " + Replace(rs2__MMColParam, "'", "''") + " ORDER BY id DESC"
rs2.CursorType = 0
rs2.CursorLocation = 2
rs2.LockType = 1
rs2.Open()
rs2_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rs1_total
Dim rs1_first
Dim rs1_last
' set the record count
rs1_total = rs1.RecordCount
' set the number of rows displayed on this page
If (rs1_numRows < 0) Then
rs1_numRows = rs1_total
Elseif (rs1_numRows = 0) Then
rs1_numRows = 1
End If
' set the first and last displayed record
rs1_first = 1
rs1_last = rs1_first + rs1_numRows - 1
' if we have the correct record count, check the other stats
If (rs1_total <> -1) Then
If (rs1_first > rs1_total) Then
rs1_first = rs1_total
End If
If (rs1_last > rs1_total) Then
rs1_last = rs1_total
End If
If (rs1_numRows > rs1_total) Then
rs1_numR