CoverYourASP --> Adding member services

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
246 active users
1366 visitors today
1165 pages today
(only part of today)
Tools I use

CoverYourASP
Copyright © 1999-2016 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Implementing a membership system for CoverYourASP was simple in concept, but ended up touching a lot of pages, and created 10 new ones!

Here's what I wanted, and got, from my system - I'll go through each one in the following pages:

• Members can register themselves via a form.
• Validation of membership changes via email.
• Sign in/out using users email address and password.
• Option to sign in automatically using a cookie (low security).
• Ability to send password to members who forget.
• Multiple levels of membership with more functionality.
• Free Bronze membership has database storage of site personalization.
• Easy upgrade to higher membership level using PayPal.
• Members-only area available only to Silver members.

Registering new members
Registering a new user requires a straightforward form that adds a new record to the database.

You can view the real source code here, but before you do, I should tell you that the same form is also used to edit existing member information too.

A simple call to IsLoggedIn ( ) - a function defined in the utils/Login.asp file - allows me to tell which task I'm undertaking with the form. It also controls what action I'm taking in the database, as the excerpt below shows:

// connect to the database
DBInitConnection ( );

if ( IsLoggedIn ( ) )
{
   // update the member information
   oConnection.Execute ( 'UPDATE Members SET Name=\'' + sName + '\',Email=\'' + sEmail + '\',MemberPassword=\'' + sPassword1 + '\' WHERE MemberID=' + nMemberID );
}
else
{
   // create the new member record
   oConnection.Execute ( 'INSERT INTO Members (Name,Email,MemberPassword) VALUES ("' + sName + '","' + sEmail + '","' + sPassword1 + '");' );
}

// release the database
DBReleaseConnection ( );

Having added the new member to the database, there is one more step the user must take before he can sign in...

Part 2: Email validation of membership changes...

Featured sponsor
My favorite resources

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...