Our page 'login.asp' will only allow the news administrator access to the following pages ('add_news.asp', 'insert_news.asp', 'del_all.asp', 'delete_record.asp', 'edit_all.asp', 'edit_record.asp, 'update_record.asp') to administer the news.
'Login.asp'
If request.form("submit")="Login" then the value Login has been passed and we know that the visitor has clicked and submitted the form. In this scenario the subroutine CheckLoginForm is called and its code executed.
CheckLoginForm will check to see if the username and password equal the values the visitor has entered. If they are correct then a Session variable 'BlnLoggedIn' will be created and set to True and the visitor will then be redirected to the 'add_news.asp'. If the visitor has not clicked the submit button then no value will be passed i.e. request.form("submit") will not equal Login and in that case the subroutine ShowLoginFrom will be called.
In this tutorial the username is 'mic' and the password is 'pass' though you can easily change the username and password for your login.
The subroutine 'ShowLoginForm' simply creates a form. The image below shows how the form will look on your screen. I have entered the login details in the screenshot below.

Now that we have created our login page we will need to password protect our other pages in our 'admin' folder. To password protect these pages you can simply add the following code at the top of the pages. If someone tries to access any these pages they will be redirected back to the login page.
Having created the database and now the login page save the 'login.asp' page in your 'admin' folder. Next we will build our admin navigation system.
| <<Previous |
Get the best asp hosting provider from web-hosting-top.com and save up to 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.
