There are 12 ASP files in the Management Section, and the main functions of these scripts are as follows:
Banneradminlogin.asp: Login page for admin function. The default user name is "ADMIN user" and the password is "PASSWORD".
checkbanneradministrationpassword.asp: Check the password of the user who is using the administrative function.
Notloggedin.asp: The "no login" Prompt page, which is displayed if you access the Administration page before you log on.
Banneradministration.asp: This is the main interface of the admin function, listing all the ads and providing two buttons. These two buttons are used for new ads and new advertisers, respectively. Click on the Advertiser name to edit the Advertiser and click on the ad text to edit the ad.
Advertisement.asp: Enter the information for the new ad, or edit the current ad message, or call deleteadvertisement.asp to delete the current AD.
Advertiser.asp: Enter information for new advertisers, or edit current advertiser information, or call
Deleteadvertiser.asp deletes the current advertiser.
Addadvertisement.asp: Add ad Records, get information from advertisement.asp forms, and store them in a database.
Addadvertiser.asp: New advertiser record, get information from advertiser.asp form, store to database.
Updateadvertisement.asp: Gets information from the advertisement.asp form and updates records in the database that have the same advertisementid as the current AD.
Updateadvertiser.asp: Gets advertiser.asp form information to update records in the database that have the same advertiserid as the current advertiser.
Deleteadvertisement.asp: Deletes the corresponding record in the database according to the AdvertisementID of the currently selected advertisement. Note: It is sometimes necessary to refresh after removing and returning to the admin main interface.
Deleteadvertiser.asp: Deletes the corresponding database record according to the Advertiserid of the currently selected advertiser.
"Figure 1"
Complete code is downloaded from the end of this article. Assuming all files are in the inetpubscripts directory, the URL for the login management feature is: http://localhost/scripts/BannerAdminLogin.asp. All other features are accessible from this point in the beginning.
Next we'll introduce some of the key issues in the management functionality script.
㈠ Security
Most pages that perform administrative functions are password protected, and these pages check a session variable to confirm that the user has successfully logged in before performing its task. The check code looks like this:
' Check if the user is logged in
If session ("LoggedIn") <> true Then
Response.Redirect ("notloggedin.asp")
End If
The security mechanism used here is simpler, and more on the authentication of user identities in ASP applications.
㈡ List all the ads
When the Banneradministration.asp page starts, all the ad records in the database are listed. This part of the functionality is done through a simple query and a Recordset object, as follows:
' List all ads in the database
Set cn = Server.CreateObject ("ADODB.") Connection ")
cn. Open "Bannerbuddy"
Set rs = Server.CreateObject ("ADODB.") RECORDSET ")
Set rs2 = Server.CreateObject ("ADODB. RECORDSET ")
strSQL = "SELECT * from Advertisement"
Rs. Open strSQL, CN
Strcrlf = CHR (+) + CHR (10)
While not Rs. EOF and not Rs. BOF
' Find the customer name based on the Advertiser number (Advertiserid)
strSQL = "Select Name from advertiser where Advertiserid =" + _
CStr (Rs. Fields ("Advertiserid"))
Rs2. Open strSQL, CN
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.