Asp General function code modification and Addition

Source: Internet
Author: User

Next, I will use a little free time to send a function that contains and adds and deletes the function. The experiment architecture can use the IIS.5WEB server to ACCESS the database. I don't need to mention this in detail, because everyone should know it. I directly paste the function. You only need to modify it a little. Copy codeThe Code is as follows: <%
Sub AdminEdit ()
Dim Action, rsCheckAdd, rs, SQL
Action = request. QueryString ("Action ")
If Action = "SaveEdit" then' save and edit administrator Information
Set rs = server. createobject ("adodb. recordset ")
If Result = "Add" then' create a website administrator
Set rsCheckAdd = conn.exe cute ("select AdminName from Ameav_Admin where AdminName = '" & trim (Request. Form ("AdminName "))&"'")
If not (rsCheckAdd. bof and rsCheckAdd. eof) then' determines whether the Administrator name exists
Response. write "<script language = javascript> <! --
Alert ('"& trim (Request. Form (" AdminName ") &" The Administrator already exists. Please try another login name! '); 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 ('the administrator login name is required and the number of characters is 3-10! '); 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 ('the administrator password is required and the number of characters is 6-16! '); History. back (-1 );
// --> </Script>"
Response. end
End if
If Request. Form ("Password") <> Request. Form ("vPassword") then
Response. write "<script language = javascript> <! --
Alert ('two passwords are different! '); 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 ("purview.pdf") & 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 the website administrator
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 ('the administrator password is required, and the number of characters is 6-20 characters! '); History. back (-1 );
// --> </Script>"
Response. end
End if
If Request. Form ("Password") <> Request. Form ("vPassword") then
Response. write "<script language = javascript> <! --
Alert ('two passwords are different! '); 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 ("purview.pdf") & 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 ('website administrator edited! '); 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

%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.