home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 September
/
CHIPCD_9_99.iso
/
software
/
uaktualnienia
/
OptionPackPL
/
iis4_07.cab
/
profile.asp
< prev
next >
Wrap
Text File
|
1998-04-27
|
20KB
|
574 lines
<%@ LANGUAGE="VBSCRIPT" TRANSACTION=REQUIRED %>
<% Option Explicit %>
<%
'
' This page needs to be authenticated differently from other pages because it
' can be called by a new user who does not yet have an account number. Thus,
' libAuthenticate.asp isn't called. The following code is used instead
'
' check if user tried to get to this page directly, without using appropriate URLs
If Request("UpdateUser") = "" Then
Response.Redirect("login.asp")
Response.End
' Or maybe a sneaky user typed in UpdateUser=1 in the URL but hasn't really logged on:
ElseIf CInt(Request.QueryString("UpdateUser")) = 1 And Session("AccountID") = "" Then
Response.Redirect("login.asp")
Response.End
End If
'
' User information variables. Values for these are retrieved from the database for
' existing users and submitted to the database for new users and user updates
'
Dim m_strFirstName, m_strLastName, m_strMiddleName, m_strKnownAs, m_strGender, m_strAddress1, _
m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, m_strHomePhone, _
m_strBusinessPhone, m_strFax, m_strEmail, m_strWebSite, _
m_strMeal, m_strSeating, m_strSmoking, m_strExitRow, m_lngAccountID
'
' Status variables.
'
Dim m_intUpdate ' Value of 1 if this is an existing user, 0 if a new user
Dim m_intRequestToSave ' Value of 0 means to display the page, 0 to process the form
Dim m_strMainPrompt, m_strDSN
'
' Initialize some page level variables
'
m_intUpdate = Cint(Request("UpdateUser"))
m_intRequestToSave = Cint(Request.Form("RequestToSave"))
m_lngAccountID = Session("AccountID")
m_strDSN = Application("DSN")
'
' This block determines whether to display the page, or attempt to update the
' database and then redirect.
'
If m_intRequestToSave = 1 Then
GetValuesFromForm
If UpdateDatabase = 0 Then ' database update occurred successfully
If m_intUpdate = 0 Then ' Send to a new user page to get AccountID and Password
Response.Redirect("Welcome.asp")
Response.End
Else ' Existing user, send back to Frequent flyer Home Page
Response.Redirect("default.asp")
Response.End
End If
Else ' database update did not occur successfully so let the user know
End If
Else
If m_intUpdate = 1 Then
m_strMainPrompt = "Please make any changes you desire to the information listed below.<BR>" & _
"The items listed in <STRONG>bold</STRONG> and marked by a blue bullet are required.<BR>" & _
"Select Save when you are done."
GetValuesFromDatabase
Else
m_strMainPrompt = "Welcome to the Exploration Air Frequent Flyer Club!<BR>" & _
"Please fill out the member information listed below. " & _
"The items listed in <STRONG>bold</STRONG> are required. " & _
"Select Save when you are done to receive your frequent flyer number."
End If
End If
%>
<!--BEGIN HTML-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="DESCRIPTION" Content="Exploration Air's profile information">
<META NAME="KEYWORDS" CONTENT="profile, join, log on, sign up, club, update">
<META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
<TITLE>Manage Your Profile</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E>
<BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
<!--Change link color on mouseover
Only if running Internet Explorer 4.0 or later -->
<!--#include file=../libHighlight.inc-->
<!--#include file=../libGlobalFuncs.inc-->
<!--COLOR BANNER_START-->
<CENTER>
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
</TD>
</TR>
</TABLE>
<!--COLOR BANNER_END-->
<!--BEGIN TOP TABLE CONTAINING LOGO AND NAVIGATIONAL LINK-->
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD VALIGN=TOP WIDTH=325>
<A HREF="<%=HomePage("..")%>"><IMG SRC="../images/logo_sm.gif" WIDTH=200 HEIGHT=100 ALT="Return to Exploration Air Home Page" BORDER=0></A>
<BR>
<A HREF="Default.asp"><IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5 ALT="Return to Frequent Flyer Home Page" BORDER=0></A> <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2" ><STRONG><A HREF="Default.asp">FREQUENT FLYER HOME PAGE</A></STRONG></FONT>
</TD>
<TD WIDTH=200>
<FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>
Manage Your Profile</FONT>
</TD>
<TD VALIGN=TOP ALIGN=RIGHT>
<A HREF="../HowItWorks/HIWProfile.asp"><IMG SRC="../images/btssmall.gif" WIDTH="115" HEIGHT="52" ALT="Click here to learn how this page works" BORDER=0></A>
</TD>
</TR>
</TABLE>
<!--END TABLE CONTAINING LOGO AND NAVIGATIONAL LINK -->
<BR>
<%= m_strMainPrompt %>
<BR>
<!--BEGIN FORM-->
<FORM NAME="ProfileForm" METHOD=POST ACTION="Profile.asp" LANGUAGE="JavaScript"
onSubmit="if (!validateForm(document.ProfileForm))
{
alert ('Please provide all of the required information (listed in bold), then select Save.');
return false;
}">
<INPUT TYPE=HIDDEN NAME="RequestToSave" Value=1>
<INPUT TYPE=HIDDEN NAME="UpdateUser" Value = <%= m_intUpdate %>>
<TABLE BACKGROUND="images/btsbgflip.gif" COLS=2 TOPMARGIN=0 cellspacing=0 WIDTH=600 BORDERCOLOR=#0000000 BORDER=1 CELLPADDING=1>
<TR>
<TD VALIGN=TOP>
<TABLE COLS=4 WIDTH=300 CELLPADDING=1 CELLSPACING=0 BORDER=0>
<TR>
<TD BGCOLOR="#C71585" COLSPAN=4><STRONG><FONT COLOR="#FFFFFF"> Personal Information</FONT></STRONG>
</TD>
</TR>
<TR>
<TD WIDTH=110>
<IMG SRC="images/bulletb.gif"><STRONG>First Name:</STRONG>
</TD>
<TD COLSPAN=3 WIDTH=190>
<INPUT SIZE=25 MAXLENGTH=20 NAME="FirstName" VALUE="<%= m_strFirstName %>">
</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/bulletb.gif"><STRONG>Last Name:</STRONG>
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="LastName" VALUE="<%= m_strLastName %>">
</TD>
</TR>
<TR>
<TD>
Middle Name:
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="MiddleName" VALUE="<%= m_strMiddleName %>">
</TD>
</TR>
<TR>
<TD>
Known As:
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="KnownAs" VALUE="<%= m_strKnownAs %>">
</TD>
</TR>
<TR>
<TD>
Gender:
</TD>
<TD COLSPAN=3>
<SELECT NAME="Gender">
<OPTION VALUE=" ">
<OPTION VALUE="F"<% If m_strGender = "F" Then %> SELECTED<% End If %>>Female
<OPTION VALUE="M"<% If m_strGender = "M" Then %> SELECTED<% End If %>>Male
</SELECT>
</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/bulletb.gif"><STRONG>Address 1</STRONG>
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="Address1" VALUE="<%= m_strAddress1 %>">
</TD>
</TR>
<TR>
<TD>
Address 2
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="Address2" VALUE="<%= m_strAddress2 %>">
</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/bulletb.gif"><STRONG>City</STRONG>
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="City" VALUE="<%= m_strCity %>">
</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/bulletb.gif"><STRONG>State/Province</STRONG>
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="State" VALUE="<%= m_strState %>">
</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/bulletb.gif"><STRONG>Postal Code:</STRONG>
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="PostCode" VALUE="<%= m_strPostCode %>">
</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/bulletb.gif"><STRONG>Country:</STRONG>
</TD>
<TD COLSPAN=3>
<INPUT SIZE=25 MAXLENGTH=20 NAME="Country" VALUE="<%= m_strCountry %>">
</TD>
</TR>
</TABLE>
</TD>
<TD VALIGN=TOP>
<TABLE COLS=4 WIDTH=300 CELLPADDING=1 CELLSPACING=0 BORDER=0>
<TR>
<TD BGCOLOR="#C71585" COLSPAN=2>
<STRONG><FONT COLOR="#FFFFFF"> Contact Information</FONT></STRONG>
</TD>
</TR>
<TR>
<TD WIDTH=225>
Home<BR> Phone
</TD>
<TD WIDTH=75>
<INPUT SIZE=25 MAXLENGTH=20 NAME="HomePhone" VALUE="<%= m_strHomePhone %>">
</TD>
</TR>
<TR>
<TD WIDTH=225>
Business<BR> Phone
</TD>
<TD WIDTH=75>
<INPUT SIZE=25 MAXLENGTH=20 NAME="BusinessPhone" VALUE="<%= m_strBusinessPhone %> ">
</TD>
</TR>
<TR>
<TD WIDTH=225>
Fax:
</TD>
<TD WIDTH=75>
<INPUT SIZE=25 MAXLENGTH=20 NAME="Fax" VALUE="<%= m_strFax %>">
</TD>
</TR>
<TR>
<TD WIDTH=225>
E-mail<BR>
Address:
</TD>
<TD WIDTH=75>
<INPUT SIZE=25 MAXLENGTH=30 NAME="Email" VALUE="<%= m_strEmail %>">
</TD>
</TR>
<TR>
<TD WIDTH=225>
Web Site:
</TD>
<TD WIDTH=75>
<INPUT SIZE=25 MAXLENGTH=30 NAME="WebSite" VALUE="<%= m_strWebSite %>">
</TD>
</TR>
<TR>
<TD BGCOLOR="#C71585" COLSPAN=2>
<STRONG><FONT COLOR="#FFFFFF"> In-flight Preferences</FONT></STRONG>
</TD>
</TR>
<TR>
<TD WIDTH=225>
Meal<BR> Preference:
</TD>
<TD WIDTH=75>
<SELECT NAME="Meal">
<OPTION VALUE="N"<% If m_strMeal = "N" Then %> SELECTED<% End If %>>None
<OPTION VALUE="V"<% If m_strMeal = "V" Then %> SELECTED<% End If %>>Vegetarian
<OPTION VALUE="L"<% If m_strMeal = "L" Then %> SELECTED<% End If %>>Low-sodium
<OPTION VALUE="O"<% If m_strMeal = "O" Then %> SELECTED<% End If %>>Organically-grown
</SELECT>
</TD>
</TR>
<TR>
<TD WIDTH=225>
Seat<BR> Preference:
</TD>
<TD WIDTH=75>
<SELECT NAME="Seating">
<OPTION VALUE="N"<% If m_strSeating = "N" Then %> SELECTED<% End If %>>None
<OPTION VALUE="A"<% If m_strSeating = "A" Then %> SELECTED<% End If %>>Aisle
<OPTION VALUE="W"<% If m_strSeating = "W" Then %> SELECTED<% End If %>>Window
</SELECT>
</TD>
</TR>
<TR>
<TD WIDTH=225>
Special<BR> Seating:
</TD>
<TD WIDTH=75>
<SELECT NAME="ExitRow">
<OPTION VALUE="N"<% If m_strExitRow = "N" Then %> SELECTED<% End If %>>None
<OPTION VALUE="E"<% If m_strExitRow = "E" Then %> SELECTED<% End If %>>Exit Row
<OPTION VALUE="B"<% If m_strExitRow = "B" Then %> SELECTED<% End If %>>Bulkhead
</SELECT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<P>
<CENTER>
<%
'
' ListInterests is a function on this page which will
' dynamically generate a form based on the interests currently being tracked
' in the database and check off the ones previously selected by the user.
'
ListInterests
%>
<P>
<CENTER><INPUT TYPE="Submit" VALUE="Save"></FORM></CENTER>
<!--END FORM-->
<P>
<HR=400>
<P>
<!--BEGIN LEGAL INFORMATION-->
<CENTER>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1"><A HREF="../legal.htm">©1997 Microsoft Corporation. All rights reserved. Terms of Use.</A></FONT></CENTER>
<!--END LEGAL INFORMATION-->
<P>
<!--COLOR BANNER_START-->
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
</TD>
</TR>
</TABLE>
<!--COLOR BANNER_END-->
</BODY>
</HTML>
<!--END HTML-->
<SCRIPT LANGUAGE="JavaScript">
// Begin client side helper functions
function validateForm(form)
{
if (isEmpty(form.FirstName)) return false;
if (isEmpty(form.LastName)) return false;
if (isEmpty(form.Address1)) return false;
if (isEmpty(form.City)) return false;
if (isEmpty(form.State)) return false;
if (isEmpty(form.PostCode)) return false;
if (isEmpty(form.Country)) return false;
return true;
}
function isEmpty(textcontrol)
{
str = textcontrol.value
for (i = 0; i < str.length; i++)
{
chr = str.substring(i, i + 1);
if (chr != ' ')
{
return false;
}
}
return true;
}
</SCRIPT>
<%
'
' Begin server side helper functions
'
'
' Set page level variables to values retrieved from database
'
Sub GetValuesFromDatabase()
Dim Member, rstMember
Set Member = Server.CreateObject("ExAir.Member")
rstMember = Member.GetForID(m_strDSN, m_lngAccountID)
m_strFirstName = rstMember("FirstName")
m_strLastName = rstMember("LastName")
m_strMiddleName = rstMember("MiddleName")
m_strKnownAs = rstMember("KnownAs")
m_strGender = rstMember("Gender")
m_strAddress1 = rstMember("Address1")
m_strAddress2 = rstMember("Address2")
m_strCity = rstMember("City")
m_strState = rstMember("State")
m_strPostCode = rstMember("PostCode")
m_strCountry = rstMember("Country")
m_strHomePhone = rstMember("HomePhone")
m_strBusinessPhone = rstMember("BusinessPhone")
m_strFax = rstMember("Fax")
m_strEmail = rstMember("Email")
m_strWebSite = rstMember("WebSite")
m_strMeal = rstMember("Meal")
m_strSeating = rstMember("Seating")
m_strExitRow = rstMember("ExitRow")
End Sub
'
' This subroutine is called in the middle of the User Profile form to generate
' a table of checkboxes for the interests currently being stored in the database
' and check off the ones indicated by the user
'
Sub ListInterests
Dim Member, Interest, rstInterests, strCheckBox, _
strInterestName, intInterestNumber, strCategoryName, _
strNewCategoryName, intInterestCounter, strTH, strTD, strSpacer
strTH = "<TH BGCOLOR=#C71585 COLSPAN=3 ALIGN=CENTER><FONT FACE=VERDANA, ARIAL, HELVETICA COLOR=#FFFFFF SIZE=3>"
strTD = "<TD><FONT FACE=VERDANA, ARIAL, HELVETICA COLOR=#000000 SIZE=2>"
strSpacer = "<TR><TD HEIGHT=20> </TD></TR>" & Chr(13)
If m_intUpdate = 0 Then
Set Interest = Server.CreateObject("ExAir.Interest")
set rstInterests = Interest.ListAll(m_strDSN)
Else
Set Member = Server.CreateObject("ExAir.Member")
Set rstInterests = Member.ListInterests(m_strDSN, m_lngAccountID)
End If
Response.Write "<TABLE WIDTH=600 CELLPADDING=0 CELLSPACING=2 BORDER=0>" & Chr(13)
strCategoryName = rstInterests("Description")
Response.Write strTH & strCategoryName & "</FONT></TH>" & Chr(13)
Response.Write strSpacer
intInterestCounter = 0
Do Until rstInterests.EOF
intInterestCounter = intInterestCounter + 1
strNewCategoryName = rstInterests("Description")
If strNewCategoryName <> strCategoryName Then
intInterestCounter = 1
strCategoryName = strNewCategoryName
Response.Write strSpacer
Response.Write strTH & strCategoryName & "</FONT></TH>" & Chr(13)
Response.Write strSpacer
End If
strInterestName = rstInterests("InterestDescription")
intInterestNumber = rstInterests("InterestID")
strCheckBox = strTD & "<INPUT TYPE=Checkbox NAME=Interest VALUE=" & intInterestNumber
If (intInterestCounter Mod 3) = 1 Then
strCheckBox = "<TR>" & Chr(13) & strCheckBox
End If
If m_intUpdate <> 0 Then
If rstInterests("AccountID") = m_lngAccountID Then
strCheckBox = strCheckBox & " CHECKED"
End If
End If
strCheckBox = strCheckBox & ">" & strInterestName & "</FONT></TD>" & Chr(13)
Response.Write strCheckBox
rstInterests.MoveNext
If (intInterestCounter Mod 3) = 0 Then
Response.Write "</TR>" & Chr(13)
End If
Loop
Response.Write "</TABLE>"
End Sub
'
' Take values from the submitted form and assign to page level variables.
' These variables will in turn be passed to the database. If the database
' update fails, the form will be displayed again with these values filled
' into the correct fields.
'
Sub GetValuesFromForm
m_strFirstName = Trim(Request.Form("FirstName"))
m_strLastName = Trim(Request.Form("LastName"))
m_strMiddleName = Trim(Request.Form("MiddleName"))
m_strKnownAs = Trim(Request.Form("KnownAs"))
m_strGender = Request.Form("Gender")
m_strAddress1 = Trim(Request.Form("Address1"))
m_strAddress2 = Trim(Request.Form("Address2"))
m_strCity = Trim(Request.Form("City"))
m_strState = Trim(Request.Form("State"))
m_strPostCode = Trim(Request.Form("PostCode"))
m_strCountry = Trim(Request.Form("Country"))
m_strHomePhone = Trim(Request.Form("HomePhone"))
m_strBusinessPhone = Trim(Request.Form("BusinessPhone"))
m_strFax = Trim(Request.Form("Fax"))
m_strEmail = Trim(Request.Form("Email"))
m_strWebSite = Trim(Request.Form("WebSite"))
m_strMeal = Trim(Request.Form("Meal"))
m_strSeating = Trim(Request.Form("Seating"))
m_strExitRow = Trim(Request.Form("ExitRow"))
End Sub
'
' Call the correct method for updating the database based on whether this is
' an existing member updating information or a new member creating a database
' entry. Return 0 if successful or 1 if an error is encountered.
'
Function UpdateDatabase
On Error Resume Next
Dim Member, lngNewAccountID
Set Member = Server.CreateObject("ExAir.Member")
If m_intUpdate = 1 Then
Member.Update m_strDSN, m_lngAccountID, m_strFirstName, m_strLastName, m_strMiddleName, _
m_strKnownAs, m_strGender, m_strAddress1, m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, _
m_strHomePhone, m_strBusinessPhone, m_strFax, m_strEmail, m_strWebSite, _
m_strMeal, m_strSeating, m_strExitRow
Else
m_lngAccountID = Member.AddNew(m_strDSN, m_strFirstName, m_strLastName, m_strMiddleName, _
m_strKnownAs, m_strGender, m_strAddress1, m_strAddress2, m_strCity, m_strState, m_strPostCode, m_strCountry, _
m_strHomePhone, m_strBusinessPhone, m_strFax, m_strEmail, m_strWebSite, _
m_strMeal, m_strSeating, m_strExitRow, 50000)
Session("AccountID") = m_lngAccountID
End If
If Err.Number = 0 Then
Member.UpdateInterests m_strDSN, m_lngAccountID, Request.Form("Interest")
Else
ContextObject.SetAbort
End If
If Err.Number = 0 Then
UpdateDatabase = 0
Else
ContextObject.SetAbort
UpdateDatabase = 1
End If
End Function
Sub OnTransactionCommit
End Sub
Sub OnTransactionAbort
m_strMainPrompt = "We're sorry, a problem occurred while trying to update the database. Please try again later. "
End Sub
%>