Next I use a little free time to send a function containing and adding and removing functions. The experimental schema can use the Iis.5web server Access database. This I actually needless to say is very detailed, because everybody should know. I just post the function directly. You can use it only if you modify it slightly.
Copy Code code as follows:
<%
Sub Adminedit ()
Dim action,rscheckadd,rs,sql
Action=request. QueryString ("Action")
If action= "Saveedit" then save edit Administrator Information
Set rs = Server.CreateObject ("Adodb.recordset")
If result= "Add" Then ' Create Webmaster
Set rscheckadd = Conn.execute ("Select AdminName from Ameav_admin where Adminname= '" & Trim (Request.Form ("AdminName") ) & "'")
If not (RSCHECKADD.BOF and rscheckadd.eof) Then ' determines if this administrator name exists
Response.Write "<script language=javascript><!--
Alert (' "& Trim (Request.Form (" AdminName ")) &" Administrator already exists, please change to a login name and try again! " '); History.back (-1);
--></script> "
Response.End
End If
Sql= "SELECT * from Ameav_admin"
Rs.Open sql,conn,1,3
Rs.addnew
If Len (Trim (Request.Form ("AdminName")) <3 or Len (Trim (Request.Form ("Password")) >10 Then
Response.Write "<script language=javascript><!--
Alert (' admin login must be filled and the number of characters is 3-10 bits! '); History.back (-1);
--></script> "
Response.End
End If
If Len (Trim (Request.Form ("Password")) <6 or Len (Trim (Request.Form ("Password")) >16 Then
Response.Write "<script language=javascript><!--
Alert (' admin password must be filled and the number of characters is 6-16 bits! '); History.back (-1);
--></script> "
Response.End
End If
If Request.Form ("Password") <>request.form ("Vpassword") Then
Response.Write "<script language=javascript><!--
Alert (' Two passwords entered differently! '); History.back (-1);
--></script> "
Response.End
End If
RS ("AdminName") =trim (Request.Form ("AdminName"))
If Request.Form ("Working") =1 Then
RS ("Working") =request.form ("Working")
Else
RS ("Working") =0
End If
RS ("Password") =md5 (Request.Form ("Password"))
RS ("UserName") =trim (Request.Form ("UserName"))
RS ("Adminpurview") =request.form ("Purview111") & Request.Form ("Purview112") & Request.Form ("Purview113") &_
Request.Form ("Purview114") & Request.Form ("Purview115") & Request.Form ("Purview116") &_
Request.Form ("Purview117") & Request.Form ("Purview118") & Request.Form ("Purview119") &_
Request.Form ("Purview120") & Request.Form ("Purview121") & Request.Form ("Purview122") &_
Request.Form ("Purview123") & Request.Form ("Purview124") & Request.Form ("Purview125") &_
Request.Form ("Purview126") & Request.Form ("Purview127") & Request.Form ("Purview128") &_
Request.Form ("Purview129") & Request.Form ("Purview130") & Request.Form ("Purview131") &_
Request.Form ("Purview132") & Request.Form ("Purview133") & Request.Form ("Purview134") &_
Request.Form ("Purview135") & Request.Form ("Purview136") & Request.Form ("Purview137") &_
Request.Form ("Purview138") & Request.Form ("Purview139") & Request.Form ("Purview140") &_
Request.Form ("Purview141") & Request.Form ("Purview142") & Request.Form ("Purview143") &_
Request.Form ("Purview144") & Request.Form ("Purview145") & Request.Form ("Purview146") &_
Request.Form ("Purview147") & Request.Form ("Purview148") & Request.Form ("Purview149") &_
Request.Form ("Purview150") & Request.Form ("Purview151") & Request.Form ("Purview152") &_
Request.Form ("Purview153")
RS ("Explain") =trim (Request.Form ("Explain"))
RS ("Addtime") =now ()
End If
If result= "Modify" Then ' modify Webmaster
Sql= "SELECT * from Ameav_admin where id=" &id
Rs.Open sql,conn,1,3
RS ("AdminName") =trim (Request.Form ("AdminName"))
If Request.Form ("Working") =1 Then
RS ("Working") =request.form ("Working")
Else
RS ("Working") =0
End If
If Trim (Request.Form ("Password")) <> "" Then
If Len (Trim (Request.Form ("Password")) <6 or Len (Trim (Request.Form ("Password")) >20 Then
Response.Write "<script language=javascript><!--
Alert (' admin password must be filled and the number of characters is 6-20 bits! '); History.back (-1);
--></script> "
Response.End
End If
If Request.Form ("Password") <>request.form ("Vpassword") Then
Response.Write "<script language=javascript><!--
Alert (' Two passwords entered differently! '); History.back (-1);
--></script> "
Response.End
End If
RS ("Password") =md5 (Request.Form ("Password"))
End If
RS ("UserName") =trim (Request.Form ("UserName"))
RS ("Adminpurview") =request.form ("Purview111") & Request.Form ("Purview112") & Request.Form ("Purview113") &_
Request.Form ("Purview114") & Request.Form ("Purview115") & Request.Form ("Purview116") &_
Request.Form ("Purview117") & Request.Form ("Purview118") & Request.Form ("Purview119") &_
Request.Form ("Purview120") & Request.Form ("Purview121") & Request.Form ("Purview122") &_
Request.Form ("Purview123") & Request.Form ("Purview124") & Request.Form ("Purview125") &_
Request.Form ("Purview126") & Request.Form ("Purview127") & Request.Form ("Purview128") &_
Request.Form ("Purview129") & Request.Form ("Purview130") & Request.Form ("Purview131") &_
Request.Form ("Purview132") & Request.Form ("Purview133") & Request.Form ("Purview134") &_
Request.Form ("Purview135") & Request.Form ("Purview136") & Request.Form ("Purview137") &_
Request.Form ("Purview138") & Request.Form ("Purview139") & Request.Form ("Purview140") &_
Request.Form ("Purview141") & Request.Form ("Purview142") & Request.Form ("Purview143") &_
Request.Form ("Purview144") & Request.Form ("Purview145") & Request.Form ("Purview146") &_
Request.Form ("Purview147") & Request.Form ("Purview148") & Request.Form ("Purview149") &_
Request.Form ("Purview150") & Request.Form ("Purview151") & Request.Form ("Purview152") &_
Request.Form ("Purview153")
RS ("Explain") =trim (Request.Form ("Explain"))
End If
Rs.update
Rs.close
Set rs=nothing
Response.Write "<script language=javascript><!--
Alert (' Edit Site Admin successfully! '); Changeadminflag (' webmaster '); Location.replace (' adminlist.asp ');
--></script> "
Else ' Extract Administrator information
If result= "Modify" Then
Set rs = Server.CreateObject ("Adodb.recordset")
Sql= "SELECT * from Ameav_admin where id=" & ID
Rs.Open sql,conn,1,1
Adminname=rs ("AdminName")
Working=rs ("Working")
Username=rs ("UserName")
Purview=rs ("Adminpurview")
Explain=rs ("Explain")
Rs.close
Set rs=nothing
End If
End If
End Sub
%>