Security for the Store Manager
Introduction. While
we want just about everyone to be able to access our store web, we do
not want anyone to be able to start working on our overall store web and
get inside the store manager. This is best done through some
additional ASP pages.
The following table gives a brief description of the four ASPs we will develop in this page. |
Security ASP | Description |
Login.asp | This provides a form for the potential user to enter a username and password. |
ManagerMenu.asp | This is the processing script for the Login.asp and it also provides the links to the functionality within the store manager if the user enters the correct username and password. |
ValidateCheck.asp | This ASP checks
whether the user has correctly entered the username and password by
determining whether a particular Session("Validated") variable
is set to True. If they fail the check then they are redirected to
the Login.asp.
This ASP is included in all of the other store manager pages at the very beginning |
NavInclude.asp | The top navigation include for all of the pages in the store manager. |
The ASPs follow. First we have the Login.asp.
The Login.asp. This first ASP is a relatively simple HTML form that submits its inputs to the ManagerMenu.asp. You should name this file Login.asp. You should probably upload this file to a StoreManager subfolder of your WildWillies directory in order to keep your store management developments in a more isolated location. The purpose of thois ASP is to
The code follows. |
<%@ Language=VBScript %> <HTML> <!-- Login.asp - Login in page for the site administrator. --> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </HEAD> <BODY> <B>Please login:</b><BR><BR> <!-- Start the form for the user to enter in their username and password. --> <form method="post" action="ManagerMenu.asp"> <table> <tr> <td align="right">Username:</td> <td> <!-- The input text box for the username. --> <input type="text" value="" name="username"> </td> </tr> <tr> <td align="right">Password:</td> <td> <!-- The input text box for the password. --> <input type="password" value="" name="password"> </td> <tr> <tr> <td colspan="2"> <!-- The submit button for the form. --> <input type="Submit" value="Submit" name="Submit"> </td> </tr> </table> </form> </BODY> </HTML> |
After you upload this ASP and access it in your web you should see something like the following. |
For future reference you should know that the
You should not change these so that I can check your work with fewer hoops to jump through. The ManagerMenu.asp. Now we need to present and explain the code for the menu that guides the overall store manager interface. This next file should be called ManagerMenu.asp. The basic content of the ASP is
|
<%@ Language=VBScript %> <% ' **************************************************** ' ManagerMenu.asp - Provides a menu listing of options ' for the store. ' **************************************************** ' Check the login in to ensure it meets the administrative requirements. if request("username") <> "Admin" OR _ request("password") <> "Password" then
else
end if |
Upon successfully uploading this ASP to your StoreManager subfolder and correctly entering the username and password you should see the following screen. |
At this point, none of these links is active. Now
we can move on to our two include ASPs.
The ValidateCheck.asp. Now we can present a little ASP code snippet that will be included in each page of the store manager to determine whether the user has correctly entered the username and password during this session. The following code should be saved in a file called ValidateCheck.asp and uploaded to the StoreManager/Include subfolder of the WildWillies web. The code very simply
|
<% ' **************************************************** ' ValidateCheck.asp - Ensures that the manager has ' been validated. ' **************************************************** ' Check our session variable to see if the user has ' been validated. This will help to ensure that ' none of the admin pages are accessed with out ' authorization. if Session("Validated") <> true then
end if |
The NavInclude.asp.
Now we can present a little ASP code snippet that will be included in
each page of the store manager to give a common top bar navigation on
every page.
The following code should be saved in a file called NavInclude.asp and uploaded to the StoreManager/Include subfolder of the WildWillies web. The code very simply
|
<!-- NavInclude.asp - Top navigation include for the site manager.--> <hr> <center> <!-- Link to the listing of products --> <a href="ListProducts.asp">Manage Products<a> | <!-- Link to the listing of departments --> <a href="ListDepts.asp">Manage Departments</a> | <!-- Link to the management of the tax settings --> <a href="ManageTax.asp">Manage Tax</a> | <!-- Link to the management of the shipping settings. --> <a href="ManageShipping.asp">Manage Shipping</a> | <!-- Link to the management of the orders. --> <a href="ManageOrders.asp">Manage Orders</a> | </center> <hr> |
Make sure you put both of these include ASPs in the Include subfolder of the StoreManager subfolder of the WildWillies web. If you don't, then future ASP pages we develop will not be able to find them. |