Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
This Tutorial Will Demonstrate How to Create a Registration Page for New Users to Your Site

This Tutorial Will Demonstrate How to Create a Registration Page for New Users to Your Site

Ratings: (0)|Views: 558|Likes:
Published by m_ali21

More info:

Published by: m_ali21 on Sep 02, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

09/07/2011

pdf

text

original

 
This tutorial will demonstrate how to create a registration page for new users to your site. This registration page will utilizethe same principles used in the Login Page Tutorial, so this should be no more difficult to do than the login page. I amusing the SQL Server 2000, and programmed this part of the application in Visual Studio .NET 2003. I choose VB becauseit is more natural language to me, but there is no reason you can't use the same concepts I use here to code this in anyother language in the .NET framework.1. Create the basic HTML layout for the registration page. REGISTER.ASPX- This page will require all entries to be filled in for a successful registration- UserName, Password, FirstName and LastName(Toggle Plain Text)
 
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Register.aspx.vb"Inherits="NorthLogin3.Register"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Register</title><meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"><meta name="vs_defaultClientScript" content="JavaScript"><
 
meta name="vs_targetSchema"content="http://schemas.microsoft.com/intellisense/ie5"></head><body ms_positioning="GridLayout"><
 
h1>Welcome to the Norwthwind DB Registration Page</h1><form id="frmRegister" method="post" runat="server"><table id="tblRegister" border="1" cellpadding="2"cellspacing="1"><tr><td style="WIDTH: 108px">User Name:</td><td><asp:textbox id="txtUserName"runat="server"></asp:textbox><font color="#ff3300"size="4"><strong>*</strong></font></td><td><asp:requiredfieldvalidator id="rvUserName"runat="server" errormessage="<-- Required"controltovalidate="txtUserName"></asp:requiredfieldvalidator></td></tr><tr><td style="WIDTH: 108px; HEIGHT:23px">Password:</td><td style="HEIGHT: 23px"><asp:textboxid="txtPassword" runat="server" textmode="Password"></asp:textbox><fontcolor="#ff3300" size="4"><strong>*</strong></font></td><td><asp:requiredfieldvalidator id="rvPassword"runat="server" errormessage="<-- Required"controltovalidate="txtPassword"></asp:requiredfieldvalidator></td>
 
</tr><tr><td style="WIDTH: 108px">First Name:</td><td><asp:textbox id="txtFirst"runat="server"></asp:textbox><font color="#ff3300"size="4"><strong>*</strong></font></td><td><asp:requiredfieldvalidator id="rvFirstName"runat="server" errormessage="<-- Required"controltovalidate="txtFirst"></asp:requiredfieldvalidator></td></tr><tr><td style="WIDTH: 108px">Last Name:</td><td><asp:textbox id="txtLast"runat="server"></asp:textbox><font color="#ff3300"size="4"><strong>*</strong></font></td><td><asp:requiredfieldvalidator id="rvLastName"runat="server" errormessage="<-- Required"controltovalidate="txtLast"></asp:requiredfieldvalidator></td></tr><tr><td colspan="2" align="center"><asp:buttonid="cmdSubmit" text="Submit" runat="server"></asp:button></td></tr></table></form><p><font color="#ff3300" size="4">*</font>Required Field <asp:label id="lblError" style="Z-INDEX: 101; LEFT: 656px;POSITION: absolute; TOP: 264px"runat="server" width="216px"></asp:label></p><p>&nbsp;</p><p>&nbsp;</p><asp:label id="lblResult" runat="server" width="424px"></asp:label></body></html>
2. Create the Store Procedures you will need to add a new user - You will need to handle duplicates- You will need to handle the adding of a new user.a. Check for Duplicates. SP_CHECKFORDUPLICATES(Toggle Plain Text)
 
CREATE PROCEDUREsp_CheckForDuplicates(
 
@UserNameVARCHAR(50) =NULL, @FirstNameVARCHAR(50) =NULL, @LastNameVARCHAR(50) =NULL, @DuplicatesINT= 0)ASSET@Duplicates =(SELECT COUNT(*)FROMNorthWindUsers WHEREUserName = @UserNameORFirstName = @FirstNameANDLastName = @LastName) RETURN@Duplicates
b. Add New User. SP_REGISTERNEWUSER(Toggle Plain Text)
 
CREATE PROCEDUREsp_RegisterNewUser(@UserNameVARCHAR(50) =NULL, @PasswordVARCHAR(50) =NULL, @FirstNameVARCHAR(50) =NULL, @LastNameVARCHAR(50) =NULL )ASIF@UserNameIS NULL OR@PasswordIS NULL OR@FirstNameIS NULL OR@LastNameIS NULLRAISERROR('Please fill in all fields', 16, 1)ELSEBEGININSERT INTONorthWindUsers(UserName, Password, FirstName, LastName)VALUES(@UserName, @Password, @FirstName, @LastName)IF@@error <> 0RAISERROR('User was not added', 16, 1)ELSEBEGINDECLARE@IDintSELECT@ID = @@IDENTITYSELECT Count(*)FROMNorthWindUsersWHEREUserID = @IDENDENDRETURN

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->