You are on page 1of 101

Santa Clara University

DEPARTMET of COMPUTER EGIEERIG

Date: June 11, 2008

I HEREBY RECOMMEND THAT THE THESIS PREPARED UNDER MY


SUPERVISION BY

Matthew Lanham

ENTITLED

CheckOutMySeat.com

BE ACCEPTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE

DEGREE OF

BACHELOR OF SCIECE I COMPUTER EGIEERIG

______________________
THESIS ADVISOR

______________________
DEPARTMENTCHAIR
CheckOutMySeat.com

by

Matthew Lanham

SEIOR DESIG PROJECT REPORT

Submitted in partial fulfillment of the requirements


for the degree of
Bachelor of Science in Computer Engineering
School of Engineering
Santa Clara University

Santa Clara, California

June 11, 2008

2
Abstract
Online ticket purchasing has evolved quite a bit in the last couple years. Many
sites now allow customers to select their own seats for concerts, sports, or any other type
of event. Generally, this is done by presenting a list of available seats to the customer
along with a seating chart that can be used for referencing. If the customers already know
which seats they’d prefer, they might still have to spend some extra time searching
through the listings until their desired seats are found. From a venue’s perspective,
creating a user-friendly interface can be a challenge. Venues will typically have to hire
additional personnel or an outside company to create and manage their online sites, which
becomes very costly.
CheckOutMySeat.com is an online ticketing site that simplifies the purchasing
process on both sides of the transaction. Anyone setting up an event on behalf of a venue
can create their own interactive seating chart using the tools provided. These seating
charts display individual seat locations along with more specific details such as seat
section, row, and pricing. Customers have the benefits of viewing these charts, knowing
which seats are available, and selecting their seats directly from the charts. What makes
this product especially unique is the fact that anyone can create a seating chart. No
knowledge of programming whatsoever is required. With some future development, this
site could potentially rival more mainstream online ticketing agents.

Keywords: chart, event, purchase, seat, ticket

3
Acknowledgements
First and foremost, I would like to thank my family. I would never have made it to
this point without their constant support, encouragement, and love.
I would like to thank my senior design advisor, Dr. Dan Lewis. His guidance has
been essential to both the completion of this project and the success of my undergraduate
career.
I would like to thank all the faculty and staff of the Santa Clara University
Computer Engineering department. The skills and knowledge you have provided me with
over the last four years will allow me to provide the best possible future for myself and
my family.
Finally, I would like to thank my fellow computer engineering students.
Whenever one of us struggled, the others were always ready to lend a helping hand.
We’ve never backed down, we’ve never given up, and now we’ve finally made it.

4
Table of Contents
Abstract ………………………………………3
Acknowledgements ………………………………………4
Table of Contents ………………………………………5
List of Figures ………………………………………7
1. Introduction and Overview ………………………………………8
1.1. Objective ………………………………………8
1.2. Background ………………………………………8
1.3. Product ………………………………………9
2. Development Timeline ………………………………………10
2.1. Deliverable History ………………………………………10
2.2. Website Development ………………………………………11
3. List of Requirements ………………………………………12
3.1. Primary Requirements ………………………………………12
3.2. Secondary Requirements ………………………………………13
4. Use Cases ………………………………………14
4.1. Add Background Image ………………………………………15
4.2. Add Seat Image ………………………………………16
4.3. Create Seat Combination ………………………………………17
4.4. Create Seating Chart ………………………………………18
4.5. Edit Seating Chart ………………………………………19
4.6. Create an Event ………………………………………20
4.7. Purchase Tickets to an Event…………………………………….. 21
5. Technologies Used ………………………………………23
5.1. Hosting ………………………………………23
5.2. Html & CSS ………………………………………23
5.3. PHP ………………………………………23
5.4. JavaScript ………………………………………24
5.5. Database ………………………………………25
6. Conceptual Models ………………………………………28
6.1. Designer Model ………………………………………29
6.2. Customer Model ………………………………………30
7. Flowcharts ………………………………………31
7.1. Seating Chart Creation ………………………………………32
7.2. Ticket Purchasing ………………………………………33
8. Potential Future Enhancements ………………………………34
8.1. Simplify Chart Creation ………………………………………34
8.2. More Improved Overall Interface…………………………………35

5
8.3. Better Editing Options ………………………………………35
8.4. Customer/Venue Profiles ………………………………………35
9. Appendix
9.1. css/default.css ………………………………………………37
9.2. css/extra.css ………………………………………………41
9.3. index.php ………………………………………………43
9.4. top.php ………………………………………………45
9.5. bot.php ………………………………………………46
9.6. createMap.php ………………………………………………47
9.7. editImgs.php ………………………………………………53
9.8. editMaps.php ………………………………………………59
9.9. events.php ………………………………………………63
9.10. funcs.php ………………………………………………67
9.11. purchase.php ………………………………………………80
9.12. records.php ………………………………………………87
9.13. dom-drag.js ………………………………………………89
9.14. moreFuncs.js ………………………………………………92

6
List of Figures
Figure 2.1 – Project Deliverables ………………………………………9
Figure 2.2 – Project Development Timeline ………………………………10
Figure 4.1 – Manage Images Page ………………………………………14
Figure 4.2 – Manage Images Page (2) ………………………………15
Figure 4.3 – Manage Images Page (3) ………………………………16
Figure 4.4 – Create Seating Chart Page Sample ………………………17
Figure 4.5 – Edit Seating Chart Page Sample ………………………………18
Figure 4.6 – View Events Page Sample ………………………………19
Figure 4.7 – Purchase Tickets Page Sample ………………………………21
Figure 5.1 – CSS Style Sheet Sample ………………………………………22
Figure 5.2 – PHP Database Handling Sample………………………………23
Figure 5.3 – JavaScript Updating Background Sample…….……………… 24
Figure 5.4 – Data Structure Legend ………………………………………26
Figure 5.5 – Main Database Structure………………………………………26
Figure 6.1 – Designer Model ………………………………………28
Figure 6.2 – Customer Model ………………………………………29
Figure 7.1 – Seating Chart Creation Flowchart ………………………31
Figure 7.2 – Ticket Purchasing Flowchart ………………………………32

7
1. Introduction and Overview

1.1. Objective
The goal of this project was to develop a product that would provide a simple and
effective method for creating a professional seating chart online. The final product, when
integrated with a ticket purchasing site, gives the customers more control over seating
location without complicating the overall purchasing process. On the other end, the
designers working on behalf of venues have complete control over the design of their
seating charts.

1.2. Background
As an avid sports fan and music lover, I spend a lot of time on ticketmaster.com.
The one problem I have always had with Ticketmaster is that the customer is unable to
select his or her desired seats. Upon searching for tickets to an event, the site will
typically return with the best available seats as determined by the site. Occasionally,
running the search multiple times will yield different results. The next step, especially if
they’re picky about their seating, is for the actor to pull up a seating chart of the venue
and determine if these tickets fulfill their needs. All of this must be accomplished within
the 2-minute page deadline, or the tickets are released, an error message appears, and the
process begins again.
Along with sites like Ticketmaster, ticket exchanging sites are also slowly
becoming more and more popular. These sites typically allow customers who currently
own tickets to an event to sell them online to others. A major advantage for the buyer
here is that they can browse through a list of specific tickets and find the ones that best
suit their needs. The disadvantage is that these tickets are more expensive since most of
the sellers are trying to make some kind of profit. There is also still the issue of
comparing seats with a seating chart back and forth, which can be very time consuming.

8
1.3. Product
The solution I have proposed is a new online ticketing system that speeds up and
simplifies the process of purchasing tickets. The major component is an interactive
design system that grants a venue complete control over their seating charts. The chart
itself displays detailed information on each seat as well as overall availability. Purchasing
seats with this product consists of selecting the desired seats from the interactive chart,
reducing the time needed for comparison with an image of a seating chart. From the
designer’s perspective, this product is both reliable and easy to manage. Ideally, anyone
who wants to sell tickets for an event is able to integrate and use this product with their
site. Everything is fully customizable, including seating location, names, and pricing. At
the same time, it is simple enough so that anyone without much computer experience has
the ability to design a seating chart.

9
2. Development Timeline

2.1. Deliverable History


The table below shows some of the major deliverables required throughout the
course of the project. It also displays any important dates and notes associated with each
deliverable.

Deliverable Date Due Date Submitted otes


This paper outlined the
Problem Statement 10/12/2007 10/12/2007 basic background and
objectives for the project.
The report detailed the
requirements, timeline, and
Design Report 11/30/07 1/18/08 likely implementation based
on the project’s original
scope.
The project was presented to
a group of faculty. Based on
Design Review
1/28/08 1/28/08 feedback received from the
Presentation
faculty, the general scope of
the project was redefined.
This version of the report
Revised Design
2/1/08 4/27/08 presented the newly revised
Report
scope.
Final Working Both the prototype and the
Prototype/Presentation presentation were presented
5/8/08 5/8/08
at the Senior Design
Conference.
Figure 2.1 – Project Deliverables

10
2.2. Website Development
The table below displays the development process over the quarter and a half
leading up to the Senior Design Conference. The timeline begins with Winter ’08, and
not Fall ’08, because it was around that time that project scope changed (see Section 2.1).
The six processes, shown as columns, represent the major milestones throughout the
project’s development.

Build Construct Develop Develop Develop Increase


Basic Site Database Chart Chart Chart Site
Template Creation Viewing Editing Appeal
Winter ‘08 Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Week 7
Week 8
Week 9
Week 10
Spring
Break
Spring ‘08 Week 1
Week 2
Week 3
Week 4
Week 5
Design Conference
(May 8, 2008)
Figure 2.2 – Project Development Timeline

11
3. List of Requirements
All of the required features and sub-features for the CheckOutMySeat.com project
have been divided into the following two classes:
• Primary Requirements: These features were vital to the overall scope of the
project. They represent everything needed to satisfy the original project goals
and to ensure a successful project.
• Secondary Requirements: These features are considered secondary because they
were not required for the site to be successful. Many of these features were
implemented to enhance the actor’s experience, add to the appeal, and
increase the flexibility of the site.

To further distinguish the individual features, each class has been further
subdivided based on the following categories:
• Non-Functional: These features provide an improvement to the actor’s overall
experience.
• Functional: These features are more specific and typically address a need
associated with a single page on the site.

3.1. Primary Requirements


• Non-Functional
o Simplified seat chart creation – No programming knowledge whatsoever
should be required to develop a seating chart.
o Simplified ticket purchasing – Customers should be able to view a seating
chart and select their seats directly from the chart.
o Object Naming – Designers should be provided with a simple method of
indexing their images, seating charts, etc.
• Functional
o Creating a seating chart – Allowing a designer to create and save a seating
chart is the most important aspect of this project.

12
o Drag-and-drop seats – This provides a simple method for designers to
place seats onto a seating chart.
o Editing a seating chart – This is an important feature for testing and for
enhancing the design aspects of the site.
o Creating events – This provides a vital link between creating a seating
chart and actually purchasing tickets.
o Purchasing tickets – The customer aspect of the site is centered on the
ability to purchase tickets from a seating chart.
o Distinguishing available/unavailable seats – This is an important feature
that enhances the process of purchasing tickets.

3.2. Secondary Requirements


• Non-functional
o Designers can custom images – Images used for seats and backgrounds
can be uploaded by designers.
o Minimize page refreshing – Many features and pages might take some
extra time to load on slower connections. This feature also helps most
page functions run more smoothly.
• Functional
o Pre-set seat combinations – Designers can create a combination of three
seat images to be used on a seating chart.
o Store a customer’s personal information – This simplifies the purchasing
process by allowing the customer to save their information.
o Purchasing history – Allows customers to review past purchases. This is
also helpful for testing.
o Displaying seat info – This feature displays a seat’s information when the
mouse cursor is over the corresponding seat.

13
4. Use Cases
Each use case defines and describes an interaction between an actor and a feature
on the site. Any actor who completes all of the events, in order, of a specific use case will
have accomplished the specified goal. The cases provided are all derived from the project
requirements (see Section 3). The first six cases represent processes that a typical seating
chart designer may experience. The final use case (‘Purchasing Tickets to an Event’)
represents the main experience of the customer who is purchasing tickets to an event. The
overall sequence of use cases is intended to represent the entire ticketing process from
beginning to end.

14
4.1. Add Background Image
Scope: CheckOutMySeat.com
Actor: Any Designer
Goal: Uploading a background image that will be used for a future seating chart
Precondition: Actor must have an image they wish to upload
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Manage Images’ button at the top of the page
3) Under the ‘Backgrounds’ column, select the ‘Add New Background’ link
4) Add the desired name into the ‘Background Name’ field
5) Click on the ‘Browse…’ button and locate the image that will be uploaded
6) Click on the ‘Add Background’ button to upload and save the image
7) Verify that the name now appears in the list (Figure 4.1)
8) Click on the name to view a sample of the image

Figure 4.1 – Manage Images Page (Saved Backgrounds)

15
4.2. Add Seat Image
Scope: CheckOutMySeat.com
Actor: Any Designer
Goal: Uploading a seat image that will be used for a future seat combination
Precondition: Actor must have an image they wish to upload
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Manage Images’ button at the top of the page
3) Under the ‘Seats’ column, select the ‘Add New Seat’ link
4) Add the desired name into the ‘Seat Name’ field
5) Click on the ‘Browse…’ button and locate the image that will be uploaded
6) Click on the ‘Add Seat’ button to upload and save the image
7) Verify that the name now appears in the list (Figure 4.2)
8) Click on the name to view a sample of the image

Figure 4.2 – Manage Images Page (Saved Seat Images)

16
4.3. Create Seat Combination
Scope: CheckOutMySeat.com
Actor: Any Designer
Goal: Creating a combination using three different seat images that will represent seat
availability on future seating charts
Precondition: Actor must have at least three uploaded seat images to choose from
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Manage Images’ button at the top of the page
3) Under the ‘Seats’ column, select the ‘Create New Seat Combination’ link
4) Add the desired name into the ‘Seat Combo Name’ field
5) Select an image from the list to represent default/unoccupied seats
6) Select an image to represent actively selected seats
7) Select an image to occupied/unavailable seats
8) Verify that the correct image for each appears to the right of the name (Figure 4.3)
9) Click on the ‘Create Seat Combo’ button to save the seat combination
10) Verify that the name now appears in the list of seat combinations

Figure 4.3 – Manage Images Page (Create Seat Combo)

17
4.4. Create Seating Chart
Scope: CheckOutMySeat.com
Actor: Any Designer
Goal: Creating a seating chart that displays an interactive seating layout
Precondition: At least one available seating combination must exist
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Create Chart’ button at the top of the page
3) Select the desired seat combination
4) Select the desired background by either:
a. Creating a basic background using the provided tools
b. Selecting a pre-saved background
5) Add a name to the chart
6) Click and drag seats to the desired location on the background
7) Double-click seats to add specific seat information (Figure 4.4)
8) Select the ‘Create Seating Chart’ button
9) Verify that the new chart appears on the ‘Manage Charts’ page

Figure 4.4 – Create Seating Chart Page Sample

18
4.5. Edit Seating Chart
Scope: CheckOutMySeat.com
Actor: Any Designer
Goal: Making changes to or removing a seating chart that has already been created
Precondition: Existing seating chart
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Manage Charts’ button at the top of the page
3) Locate the desired seating chart in the list provided
4) Select the corresponding ‘Edit’ link
5) Change the name in the box to edit the name
6) Double-click any seat to edit each seat’s information (Figure 4.5)
7) When changes have been made, click on the ‘Update Info’ button to save the new
chart
8) Click on the ‘Delete Map’ button to delete the seating chart

Figure 4.5 – Edit Seating Chart Page Sample

19
4.6. Create an Event
Scope: CheckOutMySeat.com
Actor: Any Designer
Goal: Creating an event using any pre-created seating charts for the purpose of selling
tickets
Precondition: Existing seating chart
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Manage Event’ button at the top of the page
3) Click on the ‘Create an Event’ link
4) Add the desired name into the ‘Event Name’ field
5) Add the event’s location into the ‘Location’ field
6) Select a seating chart from the list to be attached to the event
7) Select the appropriate month, day, and year from the lists provided
8) Select the appropriate time from the lists provided
9) Enter a description of the event into the ‘Event Summary’ field
10) Click on the ‘Create Event’ button to create the event
11) Verify that the newly created event and along with all appropriate information
appears in the list (Figure 4.6)

Figure 4.6 – View Events Page Sample

20
4.7. Purchase Tickets to an Event
Scope: CheckOutMySeat.com
Actor: Any Customer
Goal: Reserving seats for a pre-created event using the attached seating chart
Precondition: At least one event, with available seats, must exist
Typical Sequence of Events:
1) Open Home page
2) Select the ‘Purchase Tickets’ button at the top of the page
3) Locate an event with seats still available
4) Select the ‘Purchase’ link for the corresponding event
5) Review the event description to verify that the correct event has been selected
6) Use the legend provided to distinguish available/unavailable seats located on the
seating chart
7) Double-click any desired, available seats to select them
8) Verify that the details of each selected seat appear in the ‘Shopping Cart’ table
upon selection (Figure 4.7)
9) Select the customer’s name from the list provided, or enter the information of a
new customer
10) Verify that the values in the ‘Number of Selected Seats’ and ‘Total Cost’ fields
correspond with the number of selected seats and cumulative price
respectively
11) Click on the ‘Complete Purchase’ button to reserve the seats.
12) Detailed purchasing records can be viewed by clicking the ‘Customer Info’ button
at the top of the page

21
Figure 4.7 – Purchase Tickets Page Sample

22
5. Technologies Used

5.1. Hosting
GoDaddy.com was used to originally purchase the domain name
‘CheckOutMySeat.com’ and to host the site. They provided the database where all of the
collected data was stored. The server they assigned was a Linux server for which they
provided a one year subscription.

5.2. Html & CSS


The html and CSS code provided for the basic format of the site. The html was
implemented along side the PHP as a method of structuring data and presenting it in an
organized fashion to the actor. The CSS style sheets were used to handle specific details
related to the text, such as font, alignment, and style (Figure 5.1). In some cases, they also
assisted with the JavaScript by initializing style values for a dynamic object.

Figure 5.1 – CSS Style Sheet Sample


(from extra.css)

5.3. PHP
The PHP code was responsible for processing and interpreting all of the data that
appeared on the site. It provided the main link between the actors and the information
stored in the database. In fact, everything associated with the database was inserted,
updated, removed, or selected using PHP functions with MySQL commands (Figure 5.2).

23
The code was used in this same way to initialize table values and to handle form data
whenever an actor submitted a deliverable.

Figure 5.2 – PHP Database Handling Sample (from funcs.php)

5.4. JavaScript
The JavaScript code provided the actors with a more flexible and dynamic
interface. The main incentive for using JavaScript was to help minimize page loading
wherever possible by processing minor changes as ‘events’, such as ‘onclick()’ or
‘onmouseover()’. This way, repeatable tasks like selecting a seat from a seating chart or
updating a background image (Figure 5.3) would not require a page load, reducing the
potential risk of clearing any dynamic data. The majority of the scripts were manually
written, with the exception of the scripts pertaining to the drag-and-drop feature (see
dom-drag.js). This open source code was acquired online
(http://www.dynamicdrive.com/dynamicindex11/domdrag/) and was implemented along
with the written scripts.

24
Figure 5.3 – JavaScript Updating Background Sample (from moreFuncs.js)

5.5. Database
The database served as the main method of storage for all data associated with the
site. Each entry into the database was partitioned into one of seven tables and assigned a
unique identification number based of its respective table. Each table was further
partitioned into a collection of attributes, which represented more specific information
such as a customer’s name and phone number (Figure 5.4 & Figure 5.5). All database
manipulation was done using simple MySQL commands. The commands themselves
were sent as they were received from the user-interface using PHP functions. The
following is a description of the tables used for partition database entries:
• Backgrounds – This table stored the basic data and metadata associated with any
background images uploaded by a designer.
• Charts – This table held all the data pertaining to saved seating charts. Upon
completion, all of the information associated with the newly created seating
chart was record here for later editing or purchasing.
• Customers – This was where a customer’s personal information was stored.
Entries in this were used whenever a returning customer wished to purchase
more seats.

25
• Events – The details on each event posted by an actor was stored in this table. The
table was also responsible for keeping track of seat availability.
• IndivSeats – Similar to the Backgrounds table, this was responsible for collecting
data and metadata associated with the uploaded images used to represent
individual seats.
• Purchases – This table stores a complete history of all seat purchases. Entries are
added upon the completion of each purchase and are never removed.
• SeatCombos – This table stored a list of seat images used to make up a seat
combination. These entries were frequently referenced by the seating charts.

26
(Table ame)
(Unique Identifier) A B
(Attribute 1)
(Attribute 2) “the attributes of A are share with B”

Figure 5.4 – Data Structure Legend

Customers Charts SeatCombos


CustId MapId ComboId
FName ChartName Name
LName CreatedDate DefSeat
EMail SeatCount ActSeat
Street BackName Backgrounds TakSeat
City Section BackId CreatedDate
State SectionStatus Name
Zip Row FileName
Phone RowStatus Size
CardType SeatId CreatedDate
CardNum SeatIdStatus IndivSeats
ExpDate Price SeatId
DateJoined PriceStatus Name
X_Coords FileName
Y_Coords Events Size
ComboId EventId CreatedDate
Purchases SeatId Name
MapId
PurId Location
EventId Time
MapId Date
CustId SeatAvail
SeatId MaxCap
Sec CurCap
Row Blurb
Seat
Price
PurDate

Figure 5.5 – Main Database Structure (Tables, Attributes, and Associations)

27
6. Conceptual Models
Each conceptual model represents two forms of interaction: the interaction
between an external actor and the website and the interactions amongst the various
elements that make up the site itself. The actors are directly linked to a set of actions
available to them on the website. The action sets, represented as ovals, have been derived
based on the list of requirements (Section 3) and the use cases (Section 4). Both
conceptual models share three common elements, represented as boxes, all of which were
partially derived from the used technologies (Section 5). The shared elements can be
described as follows:
• Client-Side Interface – This interface allows the actors to navigate through and
select their desired action. No data is processed through this interface. Page
information is received from the server-side, interpreted, and presented to the
actor.
• Server-Side Functions – This collection of functions processes all requests sent by
the actors through the provided interface. It also provides the main link
between the client interface and the database. Once the data has been
interpreted, saved, or collected, it is then forwarded to the client-side interface
where it can be viewed by the actor.
• Database – The database is responsible for actually storing collections of data
received from the server-side functions. It does not perform any specific
actions or operations. All commands to manipulate the database are handled
by the server-side functions.

28
6.1. Designer Model

“Designer”

Create &
Add Background Create Seat Create
Edit Seating
& Seat Images Combinations Events
Charts

Server-Side Client-Side
Database
Functions (PHP) Interface
(JavaScript)

(CheckOutMySeat.com)

Figure 6.1 – Designer Model

29
6.2. Customer Model

Server-Side Client-Side
Database Functions (PHP) Interface
(JavaScript)

Review
View Purchase
Purchasing
Events Tickets
History

(CheckOutMySeat.com)

“Customer”

Figure 6.2 – Customer Model

30
7. Flowcharts
The flowcharts below present the schematic representations of two processes that
are vital aspects of the site. Both were selected from the use cases (see Section 4) and
depict the sequence of decisions made by a typical designer or customer. Individual steps
shown as rectangles. Diamonds represent steps that require a decision, all of which have
either a yes or no answer. The following is a description of each flowchart:
• Seating Chart Creation (Figure 7.1) – This is the most important process for
designers. The flowchart depicts every necessary step to create a seating chart,
from accessing the site to saving the finished product. Many of the steps were
derived from the use case in Section 4.4.
• Ticket Purchasing (Figure 7.2) – This is the main process for customers. It shows
the decision making process a customer must undergo in order to reserve a
desired number of seats for an event. Many of the steps in the chart were
derived from the use case in Section 4.7.

31
7.1. Seating Chart Creation

Open the Home Page

Open ‘Create Chart’ Page

Select Seat Image Set

Select Color YES Use Background


Tools?

Select Height NO

Select an Uploaded Image


Select Width as Background

Click the Create


Background Button Name the Seating Chart
Double-Click to
Deselect Seat
Drag-and-Drop Seats onto
Background Input Desired
Info

Double-Click
Add Seat- YES
Seat
Specific Info?

NO

Select the ‘Create


Seating Chart’ Button

Figure 7.1 – Seating Chart Creation Flowchart

32
7.2. Ticket Purchasing

Open the Home Page

Open ‘Purchase Tickets’ Page

Select an Event

Add Seat to YES Double-Click


Shopping Cart? Desired/Inactive
Seat

NO

Double-Click YES Remove Seat from


Undesired/Active Shopping Cart?
Seat
NO

New YES Enter Name


Customer?

NO Enter Address

Select Name from List


Enter Payment
Info

Select the ‘Complete


Purchase’ Button

Figure 7.2 – Ticket Purchasing Flowchart

33
8. Potential Future Enhancements
Due to the limited timeframe provided for this project, many of the features in the
original plans were never implemented. They were not vital to this aspect of the project,
but each would be a nice addition. Attempting to implement these features and others
might provide a future engineering student with a fairly challenging design project.

8.1. Simplify Chart Creation


The current system of creating a seating chart mostly caters to smaller venues.
Seats need to be placed individually and any associated data must be added one seat at a
time. The following features might simplify the process and make it more applicable to
larger venues:
• Snap-to-Grid: Allows designers the ability to snap seat images to an invisible grid
instead of having to move them pixel by pixel. This would most likely involve
working with the drag-and-drop scripts so that the image’s x and y positions
are dynamically rounded by a specified amount (every 5 pixels, every 10
pixels, etc).
• Place Rows/Sections: Allows designers to drag-and drop entire rows or sections
of seats instead of individual seats. This would, first of all, require the ability
to select multiple seats at once. Once this has been achieved, the only other
step would be to make sure that the JavaScript code, that allows a single seat
to move, could be synchronized with multiple seats. This would probably
require some extra testing along with minor script changes.
• Mass Information: Allows designers to attach data to multiple seats at once. This
could be implemented in a similar manner as with moving multiple seats.
Once a method has been established to select more than one seat, any input
text would need be saved on all selected seats. This should just require a
method of knowing which seats are currently ‘active’, then updating
appropriately.
• Dynamic Seat Creation: Currently the maximum number of seats is fixed and all
images are generated and overlapped during the page load. If these images

34
could appear dynamically, there would be no limit to a venue’s capacity. In
order to minimize page refreshing, a script would need to be created that
allows an image to be loaded (and position) through an event tag, such as
‘onclick().’

8.2. More Improved Overall Interface


Since the primary focus was on functionality, the visual appeal of the site suffered
slightly. This would be fairly simple for someone to fix, and probably would not
constitute an entire design project on its own. This would also be a good time to
implement some basic interface features, such as a search bar that searches event listings.
In this case, a search bar could be implemented using an html form processed by a PHP
function that searches a table in the database. Using MySQL, the ‘like’ tag could be
utilized along with ‘select’ in order to retrieve any matches from the database.

8.3. Better Editing Options


Since creation and functionality were the main focuses, editing was more of a
secondary task to assist with testing. For seating charts, many of the basic editing options
are available. One of the big options this product lacks is the ability to add, remove, or
reposition seats once they have been bound to a seating chart. This would be a difficult
task and special precautions would have to be taken. If the seating chart is attached to an
event and a seat someone has purchased is removed, this could create some major
problems. It would also be a nice option if a designer could change the associated seat
image combination without creating an entirely new chart.

8.4. Customer/Venue Profiles


At the moment, everything has been sort of thrown together. Everyone has access
to everyone else’s seating charts, images, and events. From the customer perspective,
each customer’s personal information is in no way confidential. These problems could be
solved by creating two profile types:
• Customer Profiles: These are typical of what you might see on the more
mainstream ticketing sites. A username and password is used to store a

35
customer’s personal information, record purchasing history, and can be used
for any other features that might make online ticketing a fun experience.
• Venue Profiles: This feature would be a little more unique. Venues could use the
same username and password system (possibly linking multiple logins to one
profile) to protect and store seating charts, events, and other venue-related
information. All editing and removal can be managed using these logins as
well.
From a database perspective, both of these features wouldn’t be too difficult to
implement. Each would require an additional table for storing attributes like a username,
password, and any confidential information. Each entry in these tables could be assigned
a unique identification number, similar how the other tables work (see Section 5.5). The
only thing left to do would be to add this unique id attribute to other tables with
confidential entries, such as seating charts or purchasing history. This would create a
form of ownership and could help to better separate important items.

36
9. Appendix (Source Code)

9.1. css/default.css
body {
margin: 20px;
padding: 0;
background: #FFFFFF;
}

ul.menuOptions li{
font: normal .7em Tahoma, Arial, Helvetica, sans-serif;
color: #666666;
}

h1.mainTitle{
font-size: 26pt;
font-family: Arial;
font-style: normal;
font-weight: bold;

color: #FFFFFF;
}

form {
margin: 0;
padding: 0;
}

h1, h2 {
font-family: Georgia, "Times New Roman", Times, serif;
font-weight: normal;
color: #333333;
font-size: 22pt;
}

p, blockquote, ol, ul {
line-height: 160%;
}

a:hover {
text-decoration: none;
}

/* Boxed */

.boxed {
float: left;
clear: left;
width: 200px;
margin: 0 0 10px 0;
padding: 0;
background: #EFF3F9;
}

37
.boxed .heading {
margin-top: 0;
padding: 8px 15px;
background: #5E80BD url(../images/menu_bg.bmp) repeat-x center
bottom;
text-transform: uppercase;
letter-spacing: 2px;
font: bold 1em Tahoma, Arial, Helvetica, sans-serif;
color: #FFFFFF;
}

.boxed .content {
margin: 0;
padding: 5px 14px 10px 14px;
}

.boxed ul {
margin: 0;
padding: 0;
list-style: none;
line-height: normal;
}

.boxed li {
padding: 3px 0;
border-top: 1px dotted #1F1F21;
}

.boxed li.first {
border: none;
}

.boxed a {
padding-left: 10px;
background: url(../images/img4.gif) no-repeat left center;
text-decoration: none;
}

/* Wrapper */

#wrapper {
width: 800px;
margin: 0 auto;
}

/* Pages */

#pages {
float: left;
width: 800px;
height: 150px;
background-color: RoyalBlue;
}

#pages ul {

38
float: right;
margin: 0;
/*Menu Bar Height*/
padding: 35px 20px 5px 5px;
list-style: none;
line-height: normal;
}

#pages li {
display: inline;
}

#pages a {
background: url(../images/menu_bg.bmp);
padding: 5px 10px 5px 10px;
text-decoration: none;
font: bold 1em Tahoma, Arial, Helvetica, sans-serif;
color: #FFFFFF;
}

#pages a:hover {
text-decoration: underline;
}

/* Content */

#content {
clear: both;
padding-top: 10px;
}

/* Posts */

#posts {
float: right;
width: 560px;
padding-right: 20px;
}

.post {
padding-top: 10px;
}

.post .title {
margin: 0;
font-size: 2em;
}

.post .posted {
margin-top: 0;
font: normal .8em Tahoma, Arial, Helvetica, sans-serif;
color: #999999;
}

.post .meta {
margin: 2em 0 3em 0;
border-top: 1px dotted #939A3C;

39
font: normal .8em Tahoma, Arial, Helvetica, sans-serif;
color: #999999;
}

.post .meta p {
margin: 0;
}

/* Archives */

#archives {
}

/* Search */

#search {
}

#search .content {
padding-bottom: 12px;
}

#textfield1 {
width: 156px;
padding: 5px 5px;
border: 1px solid #000000;
font: bold 1em Tahoma, Arial, Helvetica, sans-serif;
color: #000000;
}

#submit1 {
display: none;
}

/* Footer */

#footer {
clear: both;
border-top: 1px dotted #000000;
font: normal .8em Tahoma, Arial, Helvetica, sans-serif;
color: #999999;
}

#footer a {
color: #999999;
}

40
9.2. css/extra.css

div.extraSeats{
position: relative;
}

div.extraSeats img{
position: absolute;
}

img.backImage{
border: 2px solid Blue;
max-width: 700px;
}

table.chartLayout tr td.chartImg{
width: 520px;
}

table.chartLayout tr td.chartEditList{
width: 200px;
}

h3.seatTableHeader{
color: Black;
text-decoration: underline;
}

div.subTitle{
text-decoration: underline;
font-family: Arial;
color: Navy;
font-size: 18pt;
font-weight: normal;
}

div.createTitle{
text-decoration: underline;
font-family: Arial;
color: Navy;
font-size: 15pt;
font-weight: bold;
}

a.createTitle{
text-decoration: underline;
font-family: Arial;
color: Navy;
font-size: 15pt;
font-weight: bold;
}

div.subPageLinks{
color: Blue;

41
}

div.subPageLinks a{
color: Blue;
}

form.addBack{
padding-top: 10px;
}

table.backMainTable{
padding-left: 20px;
}

img.backImgSample{
vertical-align: middle;
max-width: 500px;
}

table.centerCells tr td{
text-align: center;
}

a.blueLink{
color: Blue;
}

div.eventTitle{
text-decoration: underline;
font-family: Arial;
color: Navy;
font-size: 14pt;
font-weight: bold;
}

table.eventBox{
border: 1px solid black;
width: 600px;
}

table.mainPageTable{
border: 1px solid black;
width: 700px;
}

42
9.3. index.php
<?php
include 'top.php';
include 'funcs.php';

$sString = "";

if (isset($_POST['storedMap']) && ($_POST['storedMap'] != "")) {


$sString = $_POST['storedMap'];

$sString = saveDiv($sString);
mysql_close($db);
}
?>
<div style="padding-left:20px;">
<h2>Welcome to CheckOutMySeat.com!</h2>

<table class='mainPageTable'>
<tr><td>
<div><a href='createMap.php'
class='createTitle'>Create a New Seating Chart</a></div>
<p class='mainPageBlurb'>- Create a customized
seating chart using uploaded background and seat images. The
interactive charts can be attached to events, allowing customers to
select their seats directly from the map.</p>
<br/>
</td></tr>
<tr><td>
<div><a href='events.php' class='createTitle'>Setup
and Manage Events</a></div>
<p class='mainPageBlurb'>- Post events using pre-
created seating charts. Once an event has been posted, customers will
be able to view and purchase available seats.</p>
<br/>
</td></tr>
<tr><td>
<div><a href='purchase.php'
class='createTitle'>Purchase Tickets</a></div>
<p class='mainPageBlurb'>- Customers can purchase
tickets to posted events using the provided seating chart. Each event
provides information on seating availability, including a visual
display showing which seats are currently available or unavailable.
Customers can also record and save their personal information for
future purchases. </p>
<br/>
</td></tr>
<tr><td>
<div><a href='editImgs.php'
class='createTitle'>Upload and Manage Background/Seat Images</a></div>
<p class='mainPageBlurb'>- Customize your seating
chart by uploading your own background and seat images. Multiple seat
images can be arranged into a custom collection representing the images
used for available, active, and unavailable seats.</p>
<br/>
</td></tr>
<tr><td>

43
<div><a href='records.php'
class='createTitle'>Review Customer Data and Purchases</a></div>
<p class='mainPageBlurb'>- After every purchase,
the customer's personal information is stored for use in later
purchases. Each individual transaction is also recorded after a
purchase, allowing customers and venues to review purchasing
history.</p>
<br/>
</td></tr>
</table>

</div>

<?php
include 'bot.php';
?>

44
9.4. top.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CheckOutMySeat.com</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="css/extra.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="dom-drag.js"></script>
<script type="text/javascript" src="moreFuncs.js"></script>
<script language="JavaScript">

</script>
</head>
<body>
<div id="wrapper">
<!--<div id="header">
<h1><a href="#">(symbol)</a></h1>
<h2><a href="#">of some type</a></h2>
</div>-->
<div id="pages">
<h1 class='mainTitle'>CheckOutMySeat.com</h1>
<ul class='menuOptions'>
<li class="active"><a id="page1"
href="index.php">Home</a></li>
<li><a id="page2" href="createMap.php">Create
Chart</a></li>
<li><a id="page3" href="events.php">Manage
Events</a></li>
<li><a id="page4" href="editMaps.php">Manage
Charts</a></li>
<li><a id="page5" href="editImgs.php">Manage
Images</a></li>
<li><a id="page6" href="purchase.php">Purchase
Tickets</a></li>
<li><a id="page7" href="records.php">Customer
Info</a></li>
</ul>
</div>
<div id="content">

45
9.5. bot.php
<br/><br/><br/><br/>
<div id="footer">
<p>Copyright &copy; 2008 CheckOutMySeat.com, Designed by
Matt Lanham</p>
</div>
</div>
</body>
</html>

46
9.6. createMap.php
<?php
include 'top.php';
include 'funcs.php';

$sImages = "";
$sImageIds = "";
$iCount = 530;
$sResultingMap = "";
$sBackName = "images/output.jpg";
$sCurrentBack = "images/Grey/100100Grey.jpg";
$sChartName;
$sCurrentSeat = "images/test_seat.jpg";
$sCurActSeat = "images/active_seat.jpg";
$iDefCombo;

$sSec = "";
$sRow = "";
$sSeat = "";
$sPrice = "";
$sValid = "";
$sSeatFiles = "";
$sSep = "*";

$sSeatComboList = "";
$sBackList = "";

$result = getSeatCombos();
while($row = mysql_fetch_array($result)){
$rRes = getSeats($row['DefSeat']);
$aDef = mysql_fetch_array($rRes);
$rRes = getSeats($row['ActSeat']);
$aAct = mysql_fetch_array($rRes);
$rRes = getSeats($row['TakSeat']);
$aTak = mysql_fetch_array($rRes);
$sSeatComboList .= "<option value='".$row['ComboId']."'
onclick='updateCurrentCombo(".$row['ComboId'].",
\"seats/".$aDef['FileName']."\", \"seats/".$aAct['FileName']."\",
\"seats/".$aTak['FileName']."\")'>".$row['Name']."</option>";
}
$result = getSeatCombos();
$row = mysql_fetch_array($result);
$iDefCombo = $row['ComboId'];
$rRes = getSeats($row['DefSeat']);
$aDef = mysql_fetch_array($rRes);
$rRes = getSeats($row['ActSeat']);
$aAct = mysql_fetch_array($rRes);
$rRes = getSeats($row['TakSeat']);
$aTak = mysql_fetch_array($rRes);
$sCurrentSeat = "seats/".$aDef['FileName'];
$sCurActSeat = "seats/".$aAct['FileName'];
$sCurTakSeat = "seats/".$aTak['FileName'];

$result = getBackgrounds();
while($row = mysql_fetch_array($result)){

47
$sBackList .= "<option value='".$row['BackId']."'
onclick='updateCreateBack(\"backs/".$row['FileName']."\")'>".$row['Name
']."</option>";
}

for($j=0; $j<$iCount; $j++){


$sValid .= "1.";
$sSec .= "blank".$sSep;
$sRow .= "blank".$sSep;
$sSeat .= "blank".$sSep;
$sPrice .= "blank".$sSep;
}

for($i=0; $i<$iCount; $i++){


$sTempId = "seat".(($i-($iCount-1))-(2*($i-($iCount-1))));
$sActId = "seat".$i;
$sSeatFiles .= $sCurrentSeat.chr(143);
$sImages .= "<img id='".$sActId."' onmouseout='clearSeatInfo(0);'
onmouseover='displaySeatInfo(\"".$sActId."\", 0)'
ondblclick='SetActiveSeat(\"".$sActId."\", 0);'
src='".$sCurrentSeat."'>
<script
type='text/javascript'>Drag.init(document.getElementById('".$sActId."')
);</script>";
$sImageIds .= $sActId.".";
}

if(isset($_POST['x_coords'])){
$sCurrentBack = $_POST['imagePath'];
createNewBackground($sCurrentBack, $_POST['x_coords'],
$_POST['y_coords'], $_POST['actualSeatCount'], $sBackName,
$sCurrentBack);

$sChartName = $_POST['mapName'];
if($sChartName == ""){
$sChartName = "null";
}

saveAllData($sChartName, $_POST['actualSeatCount'], $sCurrentBack,


$_POST['secList'], $_POST['secCheckList'], $_POST['rowList'],
$_POST['rowCheckList'], $_POST['seatList'], $_POST['seatCheckList'],
$_POST['priceList'], $_POST['priceCheckList'], $_POST['x_coords'],
$_POST['y_coords'], $_POST['seatCombo'], $_POST['idList']);
}
?>

<div id="dragPosts" style="padding-left:20px;">


<h2>Create Seating Chart</h2>
<div style="display:none;" id='activeSeatId'></div>

<div class='createTitle'>Seat Image Selection</div>


<div>Each entry in the list represents a collection of
seat images. To review or create your own collection, visit the <a
class="blueLink" href="editImgs.php">Manage Images Page</a>.</div>
<div>- Select an Image Set: <select>
<?php echo $sSeatComboList;?>
</select></div>

48
<table>
<tr>
<td>- Available: </td><td><img id='sampleDef'
src='<?php echo $sCurrentSeat;?>' alt='Available'></td>
</tr>
<tr>
<td>- Selected: </td><td><img id='sampleAct' src='<?php
echo $sCurActSeat;?>' alt='Selected'></td>
</tr>
<tr>
<td>- Unavailable: </td><td><img id='sampleTak'
src='<?php echo $sCurTakSeat;?>' alt='Unavailable'></td>
</tr>
</table>

<br/>
<div class='createTitle'>Background Selection</div>
<div>Select a background image for the seating chart.
There are 3 options:</div>
<form name="backgroundForm" method="post">
<div>1) Create a Simple Image - Color:<select
name='backColor'>
<option value="Grey" <?php echo
($_POST['backColor'] == "Grey")?"selected =
selected'":"";?>>Grey</option>
<option value="Black" <?php echo
($_POST['backColor'] == "Black")?"selected =
selected'":"";?>>Black</option>
<option value="White" <?php echo
($_POST['backColor'] == "White")?"selected =
selected'":"";?>>White</option>
<!--<option value="Red" <?php echo
($_POST['backColor'] == "Red")?"selected =
selected'":"";?>>Red</option>
<option value="Blue" <?php echo
($_POST['backColor'] == "Blue")?"selected =
selected'":"";?>>Blue</option>
<option value="Green" <?php echo
($_POST['backColor'] == "Green")?"selected =
selected'":"";?>>Green</option>
<option value="Yellow" <?php echo
($_POST['backColor'] == "Yellow")?"selected =
selected'":"";?>>Yellow</option>-->
</select>
Width (px): <select name='backWidth'>
<option value="100" <?php echo
($_POST['backWidth'] == 100)?"selected = selected'":"";?>>100</option>
<option value="200" <?php echo
($_POST['backWidth'] == 200)?"selected = selected'":"";?>>200</option>
<option value="300" <?php echo
($_POST['backWidth'] == 300)?"selected = selected'":"";?>>300</option>
<option value="400" <?php echo
($_POST['backWidth'] == 400)?"selected = selected'":"";?>>400</option>
<option value="500" <?php echo
($_POST['backWidth'] == 500)?"selected = selected'":"";?>>500</option>
</select>
Height (px): <select name='backHeight'>

49
<option value="100" <?php echo
($_POST['backHeight'] == 100)?"selected = selected'":"";?>>100</option>
<option value="200" <?php echo
($_POST['backHeight'] == 200)?"selected = selected'":"";?>>200</option>
<option value="300" <?php echo
($_POST['backHeight'] == 300)?"selected = selected'":"";?>>300</option>
<option value="400" <?php echo
($_POST['backHeight'] == 400)?"selected = selected'":"";?>>400</option>
<option value="500" <?php echo
($_POST['backHeight'] == 500)?"selected = selected'":"";?>>500</option>
</select>
<input type='button' onclick="switchBack();"
value='Create Backgound'>
</form>
</div>
<div>2) Select a Previously Uploaded Image: <select>
<?php echo $sBackList;?>
</select></div>
<div>3) Upload Your Own Image at the <a class="blueLink"
href="editImgs.php">Manage Images Page</a>.</div>

<br/>
<div class='createTitle'>Set Chart Name</div>
<div>Name: <input id='nameInput' type="text" value=""
maxlength="255" onblur='updateName();'></div>
<br/>

<div class='createTitle'>Place Seats</div>


<div>Click and drag the seat images (located below the
background image) to place them anywhere on the background.<div>
<div>- Double-click on any seat to attach information
such as section and pricing.</div>
<div>- When the mouse cursor is over a seat, any
infomation attached to that seat will appear below the
background.</div>
<div>- Only seats contained within the borders of the
background will be saved.</div>
<table class='chartLayout'>
<tr>
<td class='chartImg'>
<img class='backImage' id='backImage'
src="<?php echo $sCurrentBack;?>">
<br/>
<input id='expressInfo' type='text' size='100'
Readonly value='' style='border-width: 0px; font-size: 8pt;'>
<br/>
<div>Seats:</div>
<div class='extraSeats'>
<?php echo $sImages;?>
</div>
</td>
<td class='chartEditList' align='right'>
<div id='seatEditList' style="display:none;">
<form>
<table>
<tr>

50
<td><input type='checkbox'
id='checkSec' value='showSec' onclick='checkboxActions("checkSec");'
checked></td><td>Section: </td><td><input id='secField' type="text"
onblur='updateSeatLists("secField", 0);' maxlength="255"></td>
</tr><tr>
<td><input type='checkbox'
id='checkRow' value='showRow' onclick='checkboxActions("checkRow");'
checked></td><td>Row: </td><td><input id='rowField' type="text"
onblur='updateSeatLists("rowField", 0);' maxlength="255"></td>
</tr><tr>
<td><input type='checkbox'
id='checkSeatId' value='showSeatId'
onclick='checkboxActions("checkSeatId");' checked></td><td>Seat ID:
</td><td><input id='seatIdField' type="text"
onblur='updateSeatLists("seatIdField", 0);' maxlength="255"></td>
</tr><tr>
<td><input type='checkbox'
id='checkPrice' value='showPrice'
onclick='checkboxActions("checkPrice");' checked></td><td>Price:
$</td><td><input id='priceField' type="text"
onblur='updateSeatLists("priceField", 0);' maxlength="255"></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
<br/><br/><br/>

<form name="genMapForm" action="createMap.php"


method="post">
<input type="hidden" name="actualSeatCount"
value="<?php echo $iCount;?>">
<input type="hidden" name="x_coords" value="">
<input type="hidden" name="y_coords" value="">
<input type="hidden" name="checker" value="">
<input type="hidden" name="idList" value="<?php echo
$sImageIds;?>">
<input type="hidden" name="imagePath"
value="images/Grey/100100Grey.jpg">
<input type="hidden" name="mapName" value="">
<input type="hidden" name="seatCombo" value="<?php
echo $iDefCombo;?>">
<input type="hidden" name="curDfltImg" value="<?php
echo $sCurrentSeat;?>">
<input type="hidden" name="curActvImg" value="<?php
echo $sCurActSeat;?>">

<input type="hidden" name="secList" value="<?php echo


$sSec;?>">
<input type="hidden" name="secCheckList" value="<?php
echo $sValid;?>">
<input type="hidden" name="rowList" value="<?php echo
$sRow;?>">
<input type="hidden" name="rowCheckList" value="<?php
echo $sValid;?>">

51
<input type="hidden" name="seatList" value="<?php
echo $sSeat;?>">
<input type="hidden" name="seatCheckList"
value="<?php echo $sValid;?>">
<input type="hidden" name="priceList" value="<?php
echo $sPrice;?>">
<input type="hidden" name="priceCheckList"
value="<?php echo $sValid;?>">

<input type="submit" onclick="saveMapData();"


value='Create Seating Chart'>
</form>

</div>

<?php
include 'bot.php';
?>

52
9.7. editImgs.php
<?php
include 'top.php';
include 'funcs.php';

$sBlurb = "";
$sLinkB1 = "<a href='editImgs.php?mode=vsb'>- View Saved
Backgrounds</a>";
$sLinkB2 = "<a href='editImgs.php?mode=anb'>- Add New Background</a>";
$sLinkS1 = "<a href='editImgs.php?mode=vssi'>- View Saved Seat
Images</a>";
$sLinkS2 = "<a href='editImgs.php?mode=vssc'>- View Saved Seat
Combinations</a>";
$sLinkS3 = "<a href='editImgs.php?mode=ans'>- Add New Seat</a>";
$sLinkS4 = "<a href='editImgs.php?mode=cnsc'>- Create New Seat
Combination</a>";

$sDispVSB = "style='display:none;'";
$sDispANB = "style='display:none;'";
$sDispVSSI = "style='display:none;'";
$sDispVSSC = "style='display:none;'";
$sDispANS = "style='display:none;'";
$sDispCNSC = "style='display:none;'";

$sBackTableRows = "";
$sSeatTableRows = "";
$sSeatComboTableRows = "";
$sDefSeatList = "";
$sActSeatList = "";
$sTakSeatList = "";

if(isset($_FILES['backImg'])){

$sMapName = trim($_POST['backName']);

if ($_FILES["backImg"]["error"] > 0)
{
echo "Error: File did not load successfully.<br />";
}
else if($sMapName == ""){
echo "Error: Must enter a name for background.<br />";
}
else if(($_FILES["backImg"]["type"] !=
"image/gif")&&($_FILES["backImg"]["type"] !=
"image/jpeg")&&($_FILES["backImg"]["type"] != "image/bmp")){
echo "Error: Uploaded file must be an image file. <br />";
}
else if(checkBackName($_POST["backName"])){
echo "Error: File name '".$_POST["backName"]."' is already in
use. <br />";
}
else{
move_uploaded_file($_FILES['backImg']['tmp_name'],
"backs/".$_POST["backName"].$_FILES['backImg']['name']);
saveNewBackground($sMapName, $_FILES["backImg"]);

53
}
}

if(isset($_FILES['seatImg'])){

$sMapName = trim($_POST['seatName']);

if ($_FILES["seatImg"]["error"] > 0)
{
echo "Error: File did not load successfully.<br />";
}
else if($sMapName == ""){
echo "Error: Must enter a name for the seat.<br />";
}
else if(($_FILES["seatImg"]["type"] !=
"image/gif")&&($_FILES["seatImg"]["type"] !=
"image/jpeg")&&($_FILES["seatImg"]["type"] != "image/bmp")){
echo "Error: Uploaded file must be an image file. <br />";
}
else if(checkSeatName($_POST["seatName"])){
echo "Error: File name '".$_POST["seatName"]."' is already in
use. <br />";
}
else{
move_uploaded_file($_FILES['seatImg']['tmp_name'],
"seats/".$_POST["seatName"].$_FILES['seatImg']['name']);
saveNewSeat($sMapName, $_FILES["seatImg"]);
}
}

if(isset($_POST["seatComboName"])){
saveSeatCombo($_POST["seatComboName"], $_POST["selDefaultSeat"],
$_POST["selActiveSeat"], $_POST["selTakenSeat"]);
}

if((isset($_GET['mode']))&&($_GET['mode']=="vsb")){
$sLinkB1 = "<b>- View Saved Backgrounds</b>";
$sDispVSB = "";
$sBlurb = "";
$result = getBackgrounds();
while($row = mysql_fetch_array($result)){
$sBackTableRows .= "<tr><td
onclick='setSampleImg(\"backs/".$row['FileName']."\",
\"".$row['Name']."\",
\"backImgSample\")'>".$row['Name']."</td><td>".$row['Size']."Kb</td><td
>".$row['CreatedDate']."</td><td><a
href='editImgs.php?mode=vsb&delB=".$row['BackId']."'>Delete</a></td></t
r>";
}
}

else if((isset($_GET['mode']))&&($_GET['mode']=="anb")){
$sLinkB2 = "<b>- Add New Background</b>";
$sDispANB = "";
}

else if((isset($_GET['mode']))&&($_GET['mode']=="vssi")){

54
$sLinkS1 = "<b>- View Saved Seat Images</b>";
$sDispVSSI = "";
$result = getSeats();
while($row = mysql_fetch_array($result)){
$sSeatTableRows .= "<tr><td
onclick='setSampleImg(\"seats/".$row['FileName']."\",
\"".$row['Name']."\",
\"seatImgSample\")'>".$row['Name']."</td><td>".$row['Size']."Kb</td><td
>".$row['CreatedDate']."</td><td><a
href='editImgs.php?mode=vssi&delS=".$row['SeatId']."'>Delete</a></td></
tr>";
}
}

else if((isset($_GET['mode']))&&($_GET['mode']=="vssc")){
$sLinkS2 = "<b>- View Saved Seat Combinations</b>";
$sDispVSSC = "";
$result = getSeatCombos();
while($row = mysql_fetch_array($result)){
$rRes1 = getSeats($row['DefSeat']);
$aDef = mysql_fetch_array($rRes1);
$rRes2 = getSeats($row['ActSeat']);
$aAct = mysql_fetch_array($rRes2);
$rRes3 = getSeats($row['TakSeat']);
$aTak = mysql_fetch_array($rRes3);
$sSeatComboTableRows .=
"<tr><td>".$row['Name']."</td><td>".$row['CreatedDate']."</td><td>".$aD
ef['Name']."</td><td>".$aAct['Name']."</td><td>".$aTak['Name']."</td><t
d><a
href='editImgs.php?mode=vssc&delC=".$row['ComboId']."'>Delete</a></td><
/tr>";
}
}

else if((isset($_GET['mode']))&&($_GET['mode']=="ans")){
$sLinkS3 = "<b>- Add New Seat</b>";
$sDispANS = "";
}

else if((isset($_GET['mode']))&&($_GET['mode']=="cnsc")){
$sLinkS4 = "<b>- Create New Seat Combination</b>";
$sDispCNSC = "";
$result = getSeats();
while($row = mysql_fetch_array($result)){
$sDefSeatList .= "<option value='".$row['SeatId']."'
onclick='setSampleImg(\"seats/".$row['FileName']."\",
\"".$row['Name']."\", \"dfltSeatSample\")'>".$row['Name']."</option>";
$sActSeatList .= "<option value='".$row['SeatId']."'
onclick='setSampleImg(\"seats/".$row['FileName']."\",
\"".$row['Name']."\", \"activeSeatSample\")'>".$row['Name']."</option>";
$sTakSeatList .= "<option value='".$row['SeatId']."'
onclick='setSampleImg(\"seats/".$row['FileName']."\",
\"".$row['Name']."\", \"tknSeatSample\")'>".$row['Name']."</option>";
}
}
?>

55
<div style="padding-left:20px;">
<h2>Edit Images</h2>

<table border="0">
<tr>
<td style="vertical-align: top;">
<div class='createTitle' id="bMenu">Backgrounds</div>
<div class='subPageLinks' style="width:200px;"><?php
echo $sLinkB1;?></div>
<div class='subPageLinks'><?php echo
$sLinkB2;?></div>
</td>
<td style="width:40px;"></td>
<td>
<div class='createTitle' id="sMenu">Seats</div>
<div class='subPageLinks'><?php echo
$sLinkS1;?></div>
<div class='subPageLinks'><?php echo
$sLinkS2;?></div>
<div class='subPageLinks'><?php echo
$sLinkS3;?></div>
<div class='subPageLinks'><?php echo
$sLinkS4;?></div>
</td>
</tr>
</table>
<br/>

<div class='blurb'><?php echo $sBlurb;?></div>

<table border="0" id="backMainTable" <?php echo


$sDispVSB;?>>
<tr>
<td>
<table border='1' id='backTable' class='centerCells'>
<tr>
<th>Name</th><th>Size</th><th>Date Created</th>
</tr>
<?php echo $sBackTableRows;?>
</table>
</td>
<td style="width:50px;"></td>
<td><div align="center"><u>Background
Sample</u></div>
<center><img id="backImgSample"
class='backImgSample' src='images/200200GreyInst.jpg'
alt='Sample'></center></td>
</tr>
</table>

<form id="addBack" action="editImgs.php?mode=vsb"


enctype="multipart/form-data" method="post" <?php echo $sDispANB;?>>
<table border="0">
<tr>
<td>Background Name:</td><td><input name='backName'
type="text" maxlength="255" size="30"></td>
</tr>

56
<tr>
<td>Background Image:</td><td><input name='backImg'
type="file" size="30"></td>
</tr>
<tr>
<td></td><td align="right"><input type="submit"
value='Add Background'></td>
</tr>
</table>
</form>

<table border="0" id="seatMainTable" <?php echo


$sDispVSSI;?>>
<tr>
<td>
<table border="1" id="seatTable" class='centerCells'>
<tr>
<th>Name</th><th>Size</th><th>Date Created</th>
</tr>
<?php echo $sSeatTableRows;?>
</table>
</td>
<td style="width:50px;"></td>
<td><div align="center"><u>Seat Image</u></div>
<center><img id="seatImgSample"
class='backImgSample' src='images/200200GreyInst.jpg'
alt='Sample'></center></td>
</tr>
</table>

<table border="0" id="seatComboTable" <?php echo


$sDispVSSC;?>>
<tr>
<td>
<table border="1" id="seatComboTable"
class='centerCells'>
<tr>
<th>Name</th><th>Date Created</th><th>Default
Seat</th><th>Active Seat</th><th>Occupied Seat</th>
</tr>
<?php echo $sSeatComboTableRows;?>
</table>
</td>
</tr>
</table>

<form id="addSeat" action="editImgs.php?mode=vssi"


enctype="multipart/form-data" method="post" <?php echo $sDispANS;?>>
<table border="0">
<tr>
<td>Seat Name:</td><td><input name='seatName'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>Seat Image:</td><td><input name='seatImg'
type="file" size="30"></td>
</tr>

57
<tr>
<td></td><td align="right"><input type="submit"
value='Add Seat'></td>
</tr>
</table>
</form>

<form id="addSeatCombo" action="editImgs.php?mode=vssc"


enctype="multipart/form-data" method="post" <?php echo $sDispCNSC;?>>
<table border="0">
<tr>
<td>Seat Combo Name:</td>
<td><input name='seatComboName' type="text"
maxlength="255" size="30"></td>
</tr>
<tr>
<td>Default Seat Image:</td>
<td><select id='selDefaultSeat'
name='selDefaultSeat'>
<?php echo $sDefSeatList;?>
</select></td>
<td><img id="dfltSeatSample" class='backImgSample'
src='' alt=''></td>
</tr>
<tr>
<td>Active Seat Image:</td>
<td><select id='selActiveSeat'
name='selActiveSeat'>
<?php echo $sActSeatList;?>
</select></td>
<td><img id="activeSeatSample"
class='backImgSample' src='' alt=''></td>
</tr>
<tr>
<td>Occupied Seat Image:</td>
<td><select id='selTakenSeat' name='selTakenSeat'>
<?php echo $sTakSeatList;?>
</select></td>
<td><img id="tknSeatSample" class='backImgSample'
src='' alt=''></td>
</tr>
<tr>
<td></td><td align="right"><input type="submit"
value='Create Seat Combo'></td>
</tr>
</table>
</form>

</div>
<br/><br/>

<?php
include 'bot.php';
?>

58
9.8. editMaps.php
<?php
include 'top.php';
include 'funcs.php';

$sEditRows = "";
$sTitle = "";
$sBackName = "images/output.jpg";
$sMap = "";
$sMapImg = "";
$sCurrentSeat = "";
$sCurActSeat = "";

$sSec = "";
$sSecValid = "";
$sRow = "";
$sRowValid = "";
$sSeat = "";
$sseatValid = "";
$sPrice = "";
$sPriceValid = "";
$sSeatFiles = "";
$sSeatImgs = "";
$sIdList = "";
$iCount = 0;
$sNewName = "";
$sDis = "style='display:none;'";
$iCurID = 0;

if (isset($_GET['divID'])) {
if(isset($_POST['actualSeatCount'])){
updateInfo($_GET['divID'], $_POST['mapName'], $_POST['secList'],
$_POST['secCheckList'], $_POST['rowList'], $_POST['rowCheckList'],
$_POST['seatList'], $_POST['seatCheckList'], $_POST['priceList'],
$_POST['priceCheckList']);
}

$result = showDiv($_GET['divID']);
$row = mysql_fetch_array($result);

$sTitle = $row["ChartName"];
$sNewName = $row["ChartName"];

if(($sTitle == null)||($sTitle == "")){


$sTitle = "Image #".$row["MapId"];
$sNewName = "";
}

$rTemp = getSeatCombos($row['ComboId']);
$aStuff = mysql_fetch_array($rTemp);
$rRes = getSeats($aStuff['DefSeat']);
$aDef = mysql_fetch_array($rRes);
$rRes = getSeats($aStuff['ActSeat']);
$aAct = mysql_fetch_array($rRes);
$sCurrentSeat = "seats/".$aDef['FileName'];
$sCurActSeat = "seats/".$aAct['FileName'];

59
$aIds = explode(".", $row['SeatIds']);
$aXcor = explode(".", $row['X_Coords']);
$aYcor = explode(".", $row['Y_Coords']);
$iCount = $row['SeatCount'];
$sDis = "";
$iCurID = $_GET['divID'];

for($i=0; $i<$iCount; $i++){

if($aXcor[$i] != 0){
$sSeatImgs .= "<img id='".$aIds[$i]."' class='".$aIds[$i]."'
onmouseout='clearSeatInfo(1);'
onmouseover='displaySeatInfo(\"".$aIds[$i]."\", 1)'
ondblclick='SetActiveSeat(\"".$aIds[$i]."\", 1);'
src='".$sCurrentSeat."'>
<style type='text/css'>
img.".$aIds[$i]."{position:relative; top:".$aYcor[$i]."px;
left:".$aXcor[$i]."px; } </style>";
}
}

$sMapBack = "<img class='backImage' id='backImage'


src='".$row['BackName']."'>
";
$sSec = $row['Section'];
$sSecValid = $row['SectionStatus'];
$sRow = $row['Row'];
$sRowValid = $row['RowStatus'];
$sSeat = $row['SeatId'];
$sseatValid = $row['SeatIdStatus'];
$sPrice = $row['Price'];
$sPriceValid = $row['PriceStatus'];
$sSeatFiles = $row['SeatFiles'];
$sIdList = $row['SeatIds'];
}

$result = showDiv();
while($row = mysql_fetch_array($result)){

$iTally = 0;
$aXcor = explode(".", $row['X_Coords']);
for($i=0; $i<$row['SeatCount']; $i++){
if($aXcor[$i] != 0){
$iTally++;
}
}

$sChartName = $row['ChartName'];
if(($sChartName == null)||($sChartName == "")) $sChartName =
"Image #".$row['MapId'];
$sEditRows .=
"<tr><td>".$sChartName."</td><td>".$iTally."</td><td>".$row['CreatedDat
e']."</td><td><a class='blueLink'
href='editMaps.php?divID=".$row['MapId']."'>Edit</a></td></tr>";
}
?>

60
<div style="padding-left:20px;">
<h2>Edit/Remove Charts</h2><br/>

<table border='1' id='editMaprTable' class='centerCells'>


<tr>
<th>Chart Name</th><th>Total Seats</th><th>Created
Date</th>
</tr>
<?php echo $sEditRows;?>
</table>
<br/>

<?php echo $sLinks;?>

<br/>
<div class='createTitle'><?php echo $sTitle;?></div>
<div style="display:none;" id='activeSeatId'></div>
<table class='chartLayout'>
<tr>
<td class='chartImg'>
<div <?php echo $sDis;?>>Chart Name: <input
id='nameInput' type="text" value="<?php echo $sNewName;?>"
maxlength="255" onblur='updateName();'></div>
<div class='extraSeats'><?php echo
$sSeatImgs;?></div>
<div><?php echo $sMapBack;?></div>
<input id='expressInfo1' type='text' size='100'
Readonly value='' style='border-width: 0px; font-size: 8pt;'>
<br/>
</td>
<td class='chartEditList' align='right'>
<div id='seatEditList' style="display:none;">
<form>
<table>
<tr>
<td><input type='checkbox'
id='checkSec' value='showSec' onclick='checkboxActions("checkSec");'
checked></td><td>Section: </td><td><input id='secField' type="text"
onblur='updateSeatLists("secField", 1);' maxlength="255"></td>
</tr><tr>
<td><input type='checkbox'
id='checkRow' value='showRow' onclick='checkboxActions("checkRow");'
checked></td><td>Row: </td><td><input id='rowField' type="text"
onblur='updateSeatLists("rowField", 1);' maxlength="255"></td>
</tr><tr>
<td><input type='checkbox'
id='checkSeatId' value='showSeatId'
onclick='checkboxActions("checkSeatId");' checked></td><td>Seat ID:
</td><td><input id='seatIdField' type="text"
onblur='updateSeatLists("seatIdField", 1);' maxlength="255"></td>
</tr><tr>
<td><input type='checkbox'
id='checkPrice' value='showPrice'
onclick='checkboxActions("checkPrice");' checked></td><td>Price:
$</td><td><input id='priceField' type="text"
onblur='updateSeatLists("priceField", 1);' maxlength="255"></td>

61
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>

<form name="genMapForm" method="post">


<input type="hidden" name="actualSeatCount"
value="<?php echo $iCount;?>">
<input type="hidden" name="secList" value="<?php echo
$sSec;?>">
<input type="hidden" name="secCheckList" value="<?php
echo $sSecValid;?>">
<input type="hidden" name="rowList" value="<?php echo
$sRow;?>">
<input type="hidden" name="rowCheckList" value="<?php
echo $sRowValid;?>">
<input type="hidden" name="seatList" value="<?php
echo $sSeat;?>">
<input type="hidden" name="seatCheckList"
value="<?php echo $sseatValid;?>">
<input type="hidden" name="priceList" value="<?php
echo $sPrice;?>">
<input type="hidden" name="priceCheckList"
value="<?php echo $sPriceValid;?>">
<input type="hidden" name="curDfltImg" value="<?php
echo $sCurrentSeat;?>">
<input type="hidden" name="curActvImg" value="<?php
echo $sCurActSeat;?>">

<input type="hidden" name="mapName" value="<?php echo


$sNewName;?>">
<input type="hidden" name="idList" value="<?php echo
$sIdList;?>">

<input type="submit" <?php echo $sDis;?>


value='Update Info'>
</form>
<form name="deleteItem" action="editMaps.php"
method="post">
<input type="hidden" name="deleteID" value="<?php echo
$iCurID;?>">
<input type="submit" <?php echo $sDis;?>
value='Delete Map'>
</form>
</div>

<?php
include 'bot.php';
?>

62
9.9. events.php
<?php
include 'top.php';
include 'funcs.php';

$sDispVSE = "style='display:none;'";
$sDispCAE = "style='display:none;'";
$sDispERE = "style='display:none;'";
$sPrintEvents = "";
$sMapList = "";
$sMonthList = "";
$sDayList = "";
$sYearList = "";
$sHourList = "";
$sMinList = "";
$i;

$sLinkE1 = "<a href='events.php'>- View Events</a>";


$sLinkE2 = "<a href='events.php?mode=cae'>- Create an Event</a>";
$sLinkE3 = "<a href='events.php?mode=ere'>- Edit/Remove Events</a>";

for($i=1; $i<32; $i++){


$sDayList .= "<option value='".$i."'>".$i."</option>";
}

for($i=2008; $i<2028; $i++){


$sYearList .= "<option value='".$i."'>".$i."</option>";
}

for($i=1; $i<13; $i++){


$sHourList .= "<option value='".$i."'>".$i."</option>";
}

$sMinList .= "<option value='00'>00</option><option


value='01'>01</option><option value='02'>02</option>";
$sMinList .= "<option value='03'>03</option><option
value='04'>04</option><option value='05'>05</option>";
$sMinList .= "<option value='06'>06</option><option
value='07'>07</option><option value='08'>08</option><option
value='09'>09</option>";

for($i=10; $i<60; $i++){


$sMinList .= "<option value='".$i."'>".$i."</option>";
}

$sMonthList .= "<option value='1'>January</option><option


value='2'>February</option><option value='3'>March</option><option
value='4'>April</option>";
$sMonthList .= "<option value='5'>May</option><option
value='6'>June</option><option value='7'>July</option><option
value='8'>August</option>";
$sMonthList .= "<option value='9'>September</option><option
value='10'>October</option><option value='11'>November</option><option
value='12'>December</option>";

$result = showDiv();

63
while($row = mysql_fetch_array($result)){
$sChartName = $row['ChartName'];
if(($sChartName == null)||($sChartName == "")) $sChartName =
"Image #".$row['MapId'];
$sMapList .= "<option
value='".$row['MapId']."'>".$sChartName."</option>";
}

if(isset($_POST['eventName'])&&(trim($_POST['eventName']) != "")){

$result = showDiv($_POST['selSeatChart']);
$row = mysql_fetch_array($result);

$sSeatAvail = "";
$aXcor = explode(".", $row['X_Coords']);
$iCapacity = 0;
for($i=0; $i<$row['SeatCount']; $i++){
if($aXcor[$i] != 0){
$iCapacity++;
}
$sSeatAvail .= "0.";
}
saveEvent($_POST['eventName'], $_POST['selSeatChart'],
trim($_POST['eventLoc']), ($_POST['selHour'].":".$_POST['selMin']."
".$_POST['selAmPm']), ($_POST['selMonth']."-".$_POST['selDay']."-
".$_POST['selYear']), $sSeatAvail, $iCapacity,
trim($_POST['eventBlurb']));
}

if((isset($_GET['mode']))&&($_GET['mode']=="cae")){
$sLinkE2 = "<b>- Create an Event</b>";
$sDispCAE = "";
}

else if((isset($_GET['mode']))&&($_GET['mode']=="ere")){
$sLinkE3 = "<b>- Edit/Remove Events</b>";
$sDispERE = "";
}

else{
$sLinkE1 = "<b>- View Events</b>";
$sDispVSE = "";

$result = getEvents();
while($row = mysql_fetch_array($result)){
$sPrintEvents .= "<table class='eventBox'><tr><td><div
class='eventTitle'>".$row['Name']."</div>
<table border='0'>
<tr>
<td><u>Location:</u> ".$row['Location']."</td>
<td style='width:30px;'></td>
<td><u>Date:</u> ".$row['Date']."</td>
</tr>
<tr>
<td><u>Available Seats:</u> ".$row['CurCap']."</td>
<td></td>

64
<td><u>Time:</u> ".$row['Time']."</td>
</tr>
</table>
<div><p><u>Description:</u> ".$row['Blurb']."</p></div>
<div><a class='blueLink'
href='purchase.php?evnt=".$row['EventId']."'>Purchase Tickets to this
Event</a></div>
<div><a class='blueLink'
href='events.php?delE=".$row['EventId']."'>Remove this Event</a></div>
<br/></td></tr></table>
";
}
}
?>

<div style="padding-left:20px; padding-right:0px;">


<h2>Event Manager</h2>

<div class='subPageLinks'><?php echo $sLinkE1;?></div>


<div class='subPageLinks'><?php echo $sLinkE2;?></div>
<br/>

<?php echo $sPrintEvents;?>

<form id="addEvent" action="events.php"


enctype="multipart/form-data" method="post" <?php echo $sDispCAE;?>>
<table border="0">
<tr>
<td>Event Name:</td><td><input name='eventName'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>Location:</td><td><input name='eventLoc'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>Select a Seating Chart:</td>
<td><select id='selSeatChart' name='selSeatChart'>
<?php echo $sMapList;?>
</select></td>
</tr>
<tr>
<td>Event Date:</td>
<td>
<select id='selMonth' name='selMonth'>
<?php echo $sMonthList;?>
</select>
<select id='selDay' name='selDay'>
<?php echo $sDayList;?>
</select>
<select id='selYear' name='selYear'>
<?php echo $sYearList;?>
</select>
</td>
</tr>
<tr>
<td>Event Time:</td>

65
<td>
<select id='selHour' name='selHour'>
<?php echo $sHourList;?>
</select>:
<select id='selMin' name='selMin'>
<?php echo $sMinList;?>
</select>
<select id='selAmPm' name='selAmPm'>
<option value='AM'>AM</option><option
value='PM'>PM</option>
</select>
</td>
</tr>
<tr>
<td style='vertical-align:top'>Event Summary
(optional):</td><td><textarea name='eventBlurb' Cols=30
Rows=6></textarea></td>
</tr>
<tr>
<td></td><td align="right"><input type="submit"
value='Create Event'></td>
</tr>
</table>
</form>

</div>
<br/><br/>

<?php
include 'bot.php';
?>

66
9.10. funcs.php
<?php

function saveDiv($sString){
$db = mysql_connect("10.6.166.113", "ThisLanham",
"Broncos7");
if (!$db) {
die('Could not connect(saveMap): ' . mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "INSERT INTO Charts (MapText) VALUES


('".$sString."');";
mysql_query($sQuery, $db);

$sQuery = "SELECT * FROM Charts WHERE MapId = 1;";


$result = mysql_query($sQuery, $db);
$row = mysql_fetch_array($result);

mysql_close($db);

return stripslashes($row[1]);
}

function showDiv($iDivId = 0){


$db = mysql_connect("10.6.166.113", "ThisLanham",
"Broncos7");
if (!$db) {
die('Could not connect(saveMap): ' . mysql_error());
}
mysql_select_db("ThisLanham", $db);

if($iDivId == 0){
$sQuery = "SELECT * FROM Charts ORDER BY MapId ASC;";
$result = mysql_query($sQuery, $db);
mysql_close($db);

return $result;
}

$sQuery = "SELECT * FROM Charts WHERE MapId = ".$iDivId.";";


$result = mysql_query($sQuery, $db);

mysql_close($db);

return $result;
}

function getIndex($aArray, $sValue){

$i;

for($i=0; $i<count($aArray); $i++){


if($aArray[$i] == $sValue) break;
}
return $i;

67
}

function createNewBackground($sOldBack, $sXCoords, $sYCoords,


$iMax, $sOutName = "images/output.jpg", $sBackName =
"images/default.jpg"){

$rBackImg = imagecreatefromjpeg($sOldBack);
$rSeatImg = imagecreatefromjpeg("images/test_seat.jpg");
$iW = imagesx($rSeatImg);
$iH = imagesy($rSeatImg);
$aX = explode(".", $sXCoords);
$aY = explode(".", $sYCoords);

for($i=0; $i<$iMax; $i++){


if($aX[$i] != 0){
imagecopy($rBackImg, $rSeatImg, $aX[$i],
$aY[$i], 0, 0, $iW, $iH);
}
}

imagejpeg($rBackImg, $sOutName);
}

function makeBasicBackground($iWidth = 200, $iHeight = 200,


$sColor){

$rColor;
$rBackImg = imagecreatetruecolor($iWidth, $iHeight);
$sOut = "images/img".$iHeight.$iWidth.$sColor.".jpeg";

switch ($sColor){
case "Black": $rColor = imagecolorallocate($rBackImg,
0, 0, 0); break;
case "White": $rColor = imagecolorallocate($rBackImg,
255, 255, 255); break;
case "Red": $rColor = imagecolorallocate($rBackImg,
255, 0, 0); break;
case "Blue": $rColor = imagecolorallocate($rBackImg,
0, 0, 255); break;
case "Green": $rColor = imagecolorallocate($rBackImg,
0, 255, 0); break;
case "Yellow": $rColor = imagecolorallocate($rBackImg,
255, 255, 0); break;
default: $rColor = imagecolorallocate($rBackImg, 192,
192, 192); //Grey
}

imagerectangle($rBackImg, 0, 0, $iWidth, $iHeight, $rColor);


echo "- ".$sOut;
imagejpeg($rBackImg, $sOut);
}

function saveAllData($sName, $iSeatCnt, $sBack, $sSec, $sSecStat,


$sRow, $sRowStat, $sSeat, $sSeatStat, $sPrice, $sPriceStat, $sXcor,
$sYcor, $iComboId, $sIds){

68
$db = mysql_connect("10.6.166.113", "ThisLanham",
"Broncos7");
if (!$db) {
die('Could not connect(saveAllData): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sPrintName = "'".$sName."'";
if($sName == "null") $sPrintName = "null";

$sQuery = "INSERT INTO Charts VALUES (null, ".$sPrintName.",


'".date("n-j-Y")."', '".$iSeatCnt."', '".$sBack."', '".$sSec."',
'".$sSecStat."', '".$sRow."', '".$sRowStat."', '".$sSeat."',
'".$sSeatStat."', '".$sPrice."', '".$sPriceStat."', '".$sXcor."',
'".$sYcor."', ".$iComboId.", '".$sIds."');";
mysql_query($sQuery, $db);

mysql_close($db);
return;
}

function updateInfo($iID, $sName, $sSec, $sSecStat, $sRow,


$sRowStat, $sSeat, $sSeatStat, $sPrice, $sPriceStat){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(updateInfo): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sPrintName = "'".$sName."'";
if(($sName == "null")||($sName == "")) $sPrintName = "null";

$sQuery = "UPDATE Charts SET ChartName = '".$sName."',


Section = '".$sSec."', SectionStatus = '".$sSecStat."', Row =
'".$sRow."', RowStatus = '".$sRowStat."', SeatId = '".$sSeat."',
SeatIdStatus = '".$sSeatStat."', Price = '".$sPrice."', PriceStatus =
'".$sPriceStat."' WHERE MapId = ".$iID;
mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function deleteMap($iID){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(deleteMap): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "DELETE FROM Charts WHERE MapId = ".$iID;


mysql_query($sQuery, $db);

69
echo mysql_error();

mysql_close($db);
return;
}

function checkBackName($sName){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(checkBackName):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "SELECT * FROM Backgrounds WHERE Name =


'".$sName."';";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

$iValue = mysql_num_rows($result);
if($iValue == 0) return 0;
return 1;
}

function checkSeatName($sName){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(checkSeatName):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "SELECT * FROM IndivSeats WHERE Name =


'".$sName."';";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

$iValue = mysql_num_rows($result);
if($iValue == 0) return 0;
return 1;
}

function saveNewBackground($sName, $fFile){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(saveNewBackground):
'.mysql_error());

70
}
mysql_select_db("ThisLanham", $db);

$sQuery = "INSERT INTO Backgrounds VALUES (null,


'".$sName."', '".$sName.$fFile["name"]."', ".($fFile["size"]/1024).",
'".date("n-j-Y")."');";
mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function saveNewSeat($sName, $fFile){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(saveNewSeat): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "INSERT INTO IndivSeats VALUES (null,


'".$sName."', '".$sName.$fFile["name"]."', ".($fFile["size"]/1024).",
'".date("n-j-Y")."');";
mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function saveSeatCombo($sName, $iDef, $iAct, $iTak){

$db = mysql_connect("10.6.166.113", "ThisLanham", "Broncos7");


if (!$db) {
die('Could not connect(saveSeatCombo):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "INSERT INTO SeatCombos VALUES (null,


'".$sName."', ".$iDef.", ".$iAct.", ".$iTak.", '".date("n-j-Y")."');";
mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function getBackgrounds($iID = 0){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getBackgrounds):
'.mysql_error());

71
}
mysql_select_db("ThisLanham", $db);

if($iID == 0){
$sQuery = "SELECT * FROM Backgrounds ORDER BY BackId
ASC;";
$result = mysql_query($sQuery, $db);
mysql_close($db);
return $result;
}

$sQuery = "SELECT * FROM Backgrounds WHERE BackId =


".$iID.";";
$result = mysql_query($sQuery, $db);

mysql_close($db);

return $result;
}

function getSeats($iID = 0){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getSeats): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

if($iID == 0){
$sQuery = "SELECT * FROM IndivSeats ORDER BY SeatId
ASC;";
$result = mysql_query($sQuery, $db);
echo mysql_error();
mysql_close($db);
return $result;
}

$sQuery = "SELECT * FROM IndivSeats WHERE SeatId =


".$iID.";";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

return $result;
}

function getSeatCombos($iID = 0){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getSeatCombos):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

72
if($iID == 0){
$sQuery = "SELECT * FROM SeatCombos ORDER BY ComboId
ASC;";
$result = mysql_query($sQuery, $db);
echo mysql_error();
mysql_close($db);
return $result;
}

$sQuery = "SELECT * FROM SeatCombos WHERE ComboId =


".$iID.";";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

return $result;
}

function deleteBackground($iID){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(deleteBackground):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "DELETE FROM Backgrounds WHERE BackId = ".$iID;


mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function deleteSeat($iID){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(deleteSeat): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "DELETE FROM IndivSeats WHERE SeatId = ".$iID;


mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function deleteSeatCombo($iID){

73
$db = mysql_connect("10.6.166.113", "ThisLanham",
"Broncos7");
if (!$db) {
die('Could not connect(deleteSeatCombo):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "DELETE FROM SeatCombos WHERE ComboId = ".$iID;


mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function getComboImages($iID){

$rTemp = getSeatCombos($row['ComboId']);
$aStuff = mysql_fetch_array($rTemp);
$rRes = getSeats($aStuff['DefSeat']);
$aDef = mysql_fetch_array($rRes);
$rRes = getSeats($aStuff['ActSeat']);
$aAct = mysql_fetch_array($rRes);
$rRes = getSeats($aStuff['TakSeat']);
$aTak = mysql_fetch_array($rRes);
$sCurrentSeat = "seats/".$aDef['FileName'];
$sCurActSeat = "seats/".$aAct['FileName'];

$aOut = array(
"DefSeat" => "seats/".$aDef['FileName'],
"ActSeat" => "seats/".$aAct['FileName'],
"TakSeat" => "seats/".$aTak['FileName']);

return $aOut;
}

function saveEvent($sName, $iMapId, $sLoc, $sTime, $sDate,


$sSeatAvail, $iCap, $sBlurb){

$db = mysql_connect("10.6.166.113", "ThisLanham", "Broncos7");


if (!$db) {
die('Could not connect(saveEvent): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "INSERT INTO Events VALUES (null, '".$sName."',


".$iMapId.", '".$sLoc."', '".$sTime."', '".$sDate."', '".$sSeatAvail."',
".$iCap.", ".$iCap.", '".$sBlurb."');";
mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function getEvents($iID = 0){

74
$db = mysql_connect("10.6.166.113", "ThisLanham",
"Broncos7");
if (!$db) {
die('Could not connect(getEvents): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

if($iID == 0){
$sQuery = "SELECT * FROM Events ORDER BY EventId
ASC;";
$result = mysql_query($sQuery, $db);
echo mysql_error();
mysql_close($db);
return $result;
}

$sQuery = "SELECT * FROM Events WHERE EventId = ".$iID.";";


$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

return $result;
}

function deleteEvent($iID){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(deleteEvent): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "DELETE FROM Events WHERE EventId = ".$iID;


mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function updateAvailability($iID, $sAvailList, $iNewCap){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(updateAvailability):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "UPDATE Events SET SeatAvail = '".$sAvailList."',


CurCap = '".$iNewCap."' WHERE EventId = ".$iID;
mysql_query($sQuery, $db);

75
echo mysql_error();

mysql_close($db);
return;

function getCustomers($iID = 0){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getCustomers):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

if($iID == 0){
$sQuery = "SELECT * FROM Customers ORDER BY CustId
ASC;";
$result = mysql_query($sQuery, $db);
echo mysql_error();
mysql_close($db);
return $result;
}

$sQuery = "SELECT * FROM Customers WHERE CustId =


".$iID.";";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

return $result;
}

function saveCustomer($sFName, $sLName, $sEmail, $sStreet, $sCity,


$sState, $sZip, $sPhone, $sCType, $sCNum, $sCExp){

$db = mysql_connect("10.6.166.113", "ThisLanham", "Broncos7");


if (!$db) {
die('Could not connect(saveCustomer):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "INSERT INTO Customers VALUES (null,


'".$sFName."', '".$sLName."', '".$sEmail."', '".$sStreet."',
'".$sCity."', '".$sState."', '".$sZip."', '".$sPhone."', '".$sCType."',
'".$sCNum."', '".$sCExp."', '".date("n-j-Y")."');";
mysql_query($sQuery, $db);
echo mysql_error();

$sQuery = "SELECT * FROM Customers ORDER BY CustId DESC;";


$result = mysql_query($sQuery, $db);
echo mysql_error();

76
$row = mysql_fetch_array($result);

mysql_close($db);
return $row['CustId'];
}

function saveRecord($iEvntId, $iMapId, $iCustId, $sSeatId, $sSec,


$sRow, $sSeat, $iPrice){

$db = mysql_connect("10.6.166.113", "ThisLanham", "Broncos7");


if (!$db) {
die('Could not connect(saveRecord): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

if(!is_numeric($iPrice)) $iPrice = 0;

$sQuery = "INSERT INTO Purchases VALUES (null, ".$iEvntId.",


".$iMapId.", ".$iCustId.", '".$sSeatId."', '".$sSec."', '".$sRow."',
'".$sSeat."', ".$iPrice.", '".date("n-j-Y")."');";
mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);
return;
}

function getRecords($iID = 0){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getRecords): '.mysql_error());
}
mysql_select_db("ThisLanham", $db);

if($iID == 0){
$sQuery = "SELECT * FROM Purchases ORDER BY PurId
ASC;";
$result = mysql_query($sQuery, $db);
echo mysql_error();
mysql_close($db);
return $result;
}

$sQuery = "SELECT * FROM Purchases WHERE PurId = ".$iID.";";


$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

return $result;
}

function getUsersEventRecords($iID){

77
$db = mysql_connect("10.6.166.113", "ThisLanham",
"Broncos7");
if (!$db) {
die('Could not connect(getUsersEventRecords):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "SELECT DISTINCT EventId FROM Purchases WHERE


CustId = ".$iID.";";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

return $result;
}

function getTotalEventCost($iCustId, $iEventId){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getTotalEventCost):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "SELECT SUM(Price) FROM Purchases WHERE CustId =


".$iCustId." AND EventId = ".$iEventId.";";
$result = mysql_query($sQuery, $db);

echo mysql_error();

$aCost = mysql_fetch_array($result);

mysql_close($db);

return $aCost[0];
}

function getEventRecords($iCustId, $iEventId){

$db = mysql_connect("10.6.166.113", "ThisLanham",


"Broncos7");
if (!$db) {
die('Could not connect(getEventRecords):
'.mysql_error());
}
mysql_select_db("ThisLanham", $db);

$sQuery = "SELECT * FROM Purchases WHERE CustId =


".$iCustId." AND EventId = ".$iEventId.";";
$result = mysql_query($sQuery, $db);
echo mysql_error();

mysql_close($db);

78
return $result;
}

?>

79
9.11. purchase.php
<?php
include 'top.php';
include 'funcs.php';

$sEventTable = "";
$sPrintEvent = "";
$sBackImg = "";
$sSeatImgs = "";
$sOldCustomers = "";
$sDis = "style='display:none;'";
$sExpMonths = "";
$sExpYears = "";
$sTable = "";
$sPossibleSeats = "";
$sPossibleSecs = "";
$sPossibleRows = "";
$sPossibleSIds = "";
$sPossiblePrices = "";
$sBuyMapId = "";
$sBuyEvntId = "";

if(isset($_GET['evnt'])){

$result = getEvents($_GET['evnt']);
$row = mysql_fetch_array($result);
$sBuyEvntId = $_GET['evnt'];

$sPrintEvent = "<table class='eventBox'><tr><td><div


class='eventTitle'>".$row['Name']."</div>
<table border='0'>
<tr>
<td><u>Location:</u> ".$row['Location']."</td>
<td style='width:30px;'></td>
<td><u>Date:</u> ".$row['Date']."</td>
</tr>
<tr>
<td><u>Available Seats:</u> ".$row['CurCap']."</td>
<td></td>
<td><u>Time:</u> ".$row['Time']."</td>
</tr>
</table>
<div><p><u>Description:</u> ".$row['Blurb']."</p></div>
</td></tr></table>
";

$sDis = "";
$sBuyMapId = $row['MapId'];
$rTemp = showDiv($row['MapId']);
$aMap = mysql_fetch_array($rTemp);
$sBackImg = "<img class='backImage' id='buyBackImage'
src='".$aMap['BackName']."'>";

$sSec = $aMap['Section'];
$sSecValid = $aMap['Sectionstatus'];
$sRow = $aMap['Row'];

80
$sRowValid = $aMap['RowStatus'];
$sSeat = $aMap['SeatId'];
$sseatValid = $aMap['SeatIdStatus'];
$sPrice = $aMap['Price'];
$sPriceValid = $aMap['PriceStatus'];
$sIdList = $aMap['SeatIds'];

$aSecs = explode("*", $sSec);


$aRows = explode("*", $sRow);
$aSeatIDs = explode("*", $sSeat);
$aPrices = explode("*", $sPrice);

$rTemp = getSeatCombos($aMap['ComboId']);
$aCombo = mysql_fetch_array($rTemp);
$rRes = getSeats($aCombo['DefSeat']);
$aDef = mysql_fetch_array($rRes);
$rRes = getSeats($aCombo['ActSeat']);
$aAct = mysql_fetch_array($rRes);
$rRes = getSeats($aCombo['TakSeat']);
$aTak = mysql_fetch_array($rRes);
$sCurrentSeat = "seats/".$aDef['FileName'];
$sCurActSeat = "seats/".$aAct['FileName'];
$sCurTakSeat = "seats/".$aTak['FileName'];

$aStatus = explode(".", $row['SeatAvail']);


$aIds = explode(".", $aMap['SeatIds']);
$aXcor = explode(".", $aMap['X_Coords']);
$aYcor = explode(".", $aMap['Y_Coords']);
$iCount = $aMap['SeatCount'];

for($i=0; $i<$iCount; $i++){


if($aXcor[$i] != 0){
$sThisSeat =
(($aStatus[$i]==1)?($sCurTakSeat):($sCurrentSeat));
$sShowDblClick =
(($aStatus[$i]==1)?(""):("ondblclick='SetActiveSeatList(\"".$aIds[$i]."
\");'"));
$sSeatImgs .= "<img id='".$aIds[$i]."' class='".$aIds[$i]."'
onmouseout='clearSeatInfo(1);'
onmouseover='displaySeatInfo(\"".$aIds[$i]."\", 1)' ".$sShowDblClick."
src='".$sThisSeat."'
alt='".(($aStatus[$i]==1)?("Sold"):("Available"))."'>
<style type='text/css'>
img.".$aIds[$i]."{position:relative; top:".$aYcor[$i]."px;
left:".$aXcor[$i]."px; } </style>";
}
}

$result = getCustomers();
while($aCList = mysql_fetch_array($result)){
$sOldCustomers .= "<option value='".$aCList['CustId']."'
onclick='hideTable(\"infoEntryTable\", 1)'>".$aCList['FName']."
".$aCList['LName']."</option>";
}

81
$sExpMonths .= "<option value='01'>01</option><option
value='02'>02</option><option value='03'>03</option><option
value='04'>04</option>";
$sExpMonths .= "<option value='05'>05</option><option
value='06'>06</option><option value='07'>07</option><option
value='08'>08</option>";
$sExpMonths .= "<option value='09'>09</option><option
value='10'>10</option><option value='11'>11</option><option
value='12'>12</option>";
for($i=2008; $i<2030; $i++){
$sExpYears .= "<option value='".$i."'>".$i."</option>";
}
$sTable = "<h3 id='seatTableHeader'>Shopping Cart:</h3>
<table id='seatTable' class='centerCells' border='1'>
<tr><th>Section</th><th>Row</th><th>Seat
ID</th><th>Price</th></tr>
";

for($i=0; $i<$iCount; $i++){


if($aXcor[$i] != 0){
$j = ($i-($iCount-1))-(2*($i-($iCount-1)));
$sTable .= "<tr id='".$aIds[$i]."tr'
style='display:none;';><td>".(($aSecs[$j]=="blank")?"":$aSecs[$j])."</t
d><td>".(($aRows[$j]=="blank")?"":$aRows[$j])."</td><td>".(($aSeatIDs[$
j]=="blank")?"":$aSeatIDs[$j])."</td><td>".(($aPrices[$j]=="blank")?"":
$aPrices[$j])."</td></tr>
";
$sPossibleSeats .= $aIds[$i]."*";
$sPossibleSecs .= $aSecs[$j]."*";
$sPossibleRows .= $aRows[$j]."*";
$sPossibleSIds .= $aSeatIDs[$j]."*";
$sPossiblePrices .= $aPrices[$j]."*";
}
}

$sTable .= "
</table>";
}

if(isset($_POST['customerStatus'])){
if((trim($_POST['fName']) == "")&&(trim($_POST['lName']) ==
"")&&($_POST['customerStatus'] == "0")){
echo "Could not process order: You mst enter a name.<br/>";
}
else{
$iBuyerId = "0";
if($_POST['customerStatus'] == "0"){
$iBuyerId = saveCustomer(trim($_POST['fName']),
trim($_POST['lName']), trim($_POST['email']), trim($_POST['street']),
trim($_POST['city']), trim($_POST['state']), trim($_POST['zip']),
trim($_POST['phone']), trim($_POST['cardType']),
trim($_POST['cardNum']), ($_POST['expMonth']."/".$_POST['expYear']));
}
else{
$iBuyerId = $_POST['customerStatus'];
}

82
$aTempSeatList = explode("*", $_POST['buySeatIds']);
$aTempSecList = explode("*", $_POST['buySecs']);
$aTempRowList = explode("*", $_POST['buyRows']);
$aTempSIdList = explode("*", $_POST['buySIds']);
$aTempPriceList = explode("*", $_POST['buyPrices']);

$rTemp = showDiv($_POST['buyMapId']);
$aMap = mysql_fetch_array($rTemp);
$aSeatIdsList = explode(".", $aMap['SeatIds']);
$rTemp = getEvents($_POST['buyEnvtId']);
$aEvent = mysql_fetch_array($rTemp);
$aAvailList = explode(".", $aEvent['SeatAvail']);
$sAvailList = "";

for($i=0; $i<(count($aTempSeatList)-1); $i++){


if(strlen($aTempSeatList[$i]) > 3){
$iIndex = getIndex($aSeatIdsList, $aTempSeatList[$i]);
$aAvailList[$iIndex ] = "1";

saveRecord($_POST['buyEnvtId'], $_POST['buyMapId'],
$iBuyerId, $aTempSeatList[$i], $aTempSecList[$i], $aTempRowList[$i],
$aTempSIdList[$i], $aTempPriceList[$i]);
}
}
for($j=0; $j<(count($aAvailList)-1); $j++){
$sAvailList .= $aAvailList[$j].".";
}
$iNewCap = ($aEvent['CurCap'] - (count($aTempSeatList) - 1));

updateAvailability($_POST['buyEnvtId'], $sAvailList, $iNewCap);


}
}
$result = getEvents();
while($row = mysql_fetch_array($result)){
$sEventTable .=
"<tr><td>".$row['Name']."</td><td>".$row['Location']."</td><td>".$row['
Date']."</td><td>".$row['CurCap']."</td><td>".(($row['CurCap'] <=
0)?("Sold Out"):("<a class='blueLink'
href='purchase.php?evnt=".$row['EventId']."'>Purchase</a>"))."</td></tr
>";
}
?>
<div style="padding-left:20px;">
<h2>Purchasing Tickets</h2>

<div class='createTitle'>Select an Event:</div>


<table border='1' id='backTable' class='centerCells'>
<tr>
<th>Event</th><th>Location</th><th>Date</th><th>Seats
Left</th>
</tr>
<?php echo $sEventTable;?>
</table>
<br/>

<div><?php echo $sPrintEvent;?></div><br/>

83
<div <?php echo $sDis;?>>Double-click to select your
seats.</div>
<table <?php echo $sDis;?>>
<tr>
<td>-Available: </td><td><img src='<?php echo
$sCurrentSeat;?>' alt='Available'></td>
</tr>
<tr>
<td>-Selected: </td><td><img src='<?php echo
$sCurActSeat;?>' alt='Selected'></td>
</tr>
<tr>
<td>-Unavailable: </td><td><img src='<?php echo
$sCurTakSeat;?>' alt='Unavailable'></td>
</tr>
</table>
<div class='extraSeats'><?php echo $sSeatImgs;?></div>
<div><?php echo $sBackImg;?></div>
<input id='expressInfo1' type='text' size='100' Readonly
value='' style='border-width: 0px; font-size: 8pt;'>
<br/>
<form action="purchase.php" name="buyerData"
enctype="multipart/form-data" method="post" <?php echo $sDis;?>>
<table class='purTable' border='0'>
<tr>
<td style='vertical-align:top'>
<div>New/Old Customer: <select
id='customerStatus' name='customerStatus'>
<option value='0'
onclick='hideTable("infoEntryTable", 0)' selected='selected'>New
Customer</option>
<?php echo $sOldCustomers;?>
</select></div><br/>
<table id='infoEntryTable' border="0">
<tr>
<td>First Name:</td><td><input name='fName'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>Last Name:</td><td><input name='lName'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>E-Mail:</td><td><input name='email'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>Street Address:</td><td><input
name='street' type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>City:</td><td><input name='city'
type="text" maxlength="255" size="30"></td>
</tr>
<tr>
<td>State:</td><td><input name='state'
type="text" maxlength="30" size="10"></td>

84
</tr>
<tr>
<td>Zip:</td><td><input name='zip'
type="text" maxlength="15" size="15"></td>
</tr>
<tr>
<td>Phone Number:</td><td><input name='phone'
type="text" maxlength="50" size="30"></td>
</tr>
<tr><td><br/></td></tr>
<tr>
<td>Card Type:</td><td><select
name='cardType'>
<option value='VISA'>VISA</option>
<option
value='Mastercard'>Mastercard</option>
<option value='American
Express'>American Express</option>
<option
value='Discover'>Discover</option>
</select></td>
</tr>
<tr>
<td>Card Number:</td><td><input
name='cardNum' type="text" maxlength="50" size="30"></td>
</tr>
<tr>
<td>Expiration Date:</td><td><select
name='expMonth'>
<?php echo $sExpMonths;?>
</select>/
<select name='expYear'>
<?php echo $sExpYears;?>
</select></td>
</tr>
</table>
<div>Number of Selected Seats: <input
id='selectedCount' type='text' size='6' Readonly value='0'
style='border-width: 0px; font-size: 10pt; padding-left:2px;'></div>
<div>Total Cost: $<input id='currentCost'
type='text' size='6' Readonly value='0' style='border-width: 0px; font-
size: 10pt; padding-left:2px;'></div>
<br/>
<input type="hidden" name="buySeatIds"
value="">
<input type="hidden" name="buySecs" value="">
<input type="hidden" name="buyRows" value="">
<input type="hidden" name="buySIds" value="">
<input type="hidden" name="buyPrices" value="">
<input type="hidden" name="buyEnvtId"
value="<?php echo $sBuyEvntId;?>">
<input type="hidden" name="buyMapId"
value="<?php echo $sBuyMapId;?>">
<div align="right"><input type="submit"
onClick='setPurchaseLists()' value='Complete Purchase'></div>
</td>
<td style='width:100px;'></td>

85
<td style='vertical-align:top'>
<br/>
<?php echo $sTable;?>
</td>
</tr>
</table>
</form>
<form name="genMapForm" method="post">
<input type="hidden" name="actualSeatCount"
value="<?php echo $iCount;?>">
<input type="hidden" name="secList" value="<?php echo
$sSec;?>">
<input type="hidden" name="secCheckList" value="<?php
echo $sSecValid;?>">
<input type="hidden" name="rowList" value="<?php echo
$sRow;?>">
<input type="hidden" name="rowCheckList" value="<?php
echo $sRowValid;?>">
<input type="hidden" name="seatList" value="<?php
echo $sSeat;?>">
<input type="hidden" name="seatCheckList"
value="<?php echo $sSeatValid;?>">
<input type="hidden" name="priceList" value="<?php
echo $sPrice;?>">
<input type="hidden" name="priceCheckList"
value="<?php echo $sPriceValid;?>">
<input type="hidden" name="seatFiles" value="<?php
echo $sSeatFiles;?>">
<input type="hidden" name="idList" value="<?php echo
$sIdList;?>">
<input type="hidden" name="curDfltImg" value="<?php
echo $sCurrentSeat;?>">
<input type="hidden" name="curActvImg" value="<?php
echo $sCurActSeat;?>">
<input type="hidden" name="curTakImg" value="<?php
echo $sCurTakSeat;?>">

<input type="hidden" name="posSeat" value="<?php echo


$sPossibleSeats;?>">
<input type="hidden" name="posSec" value="<?php echo
$sPossibleSecs;?>">
<input type="hidden" name="posRow" value="<?php echo
$sPossibleRows;?>">
<input type="hidden" name="posSId" value="<?php echo
$sPossibleSIds;?>">
<input type="hidden" name="posPrice" value="<?php
echo $sPossiblePrices;?>">
</form>

</div>

<?php
include 'bot.php';
?>

86
9.12. records.php
<?php
include 'top.php';
include 'funcs.php';

$sDispPHist = "style='display:none;'";
$sDispPDet = "style='display:none;'";
$sCustTable = "";
$sHistTable = "";
$sDetTable = "";
$sCustomerName = "";
$sEventName = "";

$sLinkR1 = "<a href='events.php'>- View Customers</a>";

$result = getCustomers();
while($row = mysql_fetch_array($result)){
$sCustTable .=
"<tr><td>".$row['FName']."</td><td>".$row['LName']."</td><td>".$row['EM
ail']."</td><td>".$row['Phone']."</td><td>".$row['Street']."</td><td>".
$row['City']."</td><td>".$row['State']."</td><td>".$row['Zip']."</td><t
d>".$row['DateJoined']."</td><td><a class='blueLink'
href='records.php?cid=".$row['CustId']."'>View</a></td></tr>";
}

if(isset($_GET['cid'])){
$sDispPHist = "";
$result = getCustomers($_GET['cid']);
$aCInfo = mysql_fetch_array($result);
$sCustomerName = $aCInfo['FName']." ".$aCInfo['LName'];
$rEvt = getUsersEventRecords($_GET['cid']);
while($aEventList = mysql_fetch_array($rEvt)){
$iCost = getTotalEventCost($_GET['cid'],
$aEventList['EventId']);
$rRecs = getEventRecords($_GET['cid'], $aEventList['EventId']);
$rTemp = getEvents($aEventList['EventId']);
$aEvntInfo = mysql_fetch_array($rTemp);

$iTally = 0;
while($aRecs = mysql_fetch_array($rRecs)){
$iTally++;
}

$sHistTable .=
"<tr><td>".$aEvntInfo['Name']."</td><td>".$aEvntInfo['Date']."</td><td>
".$iTally."</td><td>".$iCost."</td><td><a class='blueLink'
href='records.php?cid=".$_GET['cid']."&evnt=".$aEvntInfo['EventId']."'>
Details</a></td></tr>";
}
if(isset($_GET['evnt'])){
$rRecs = getEventRecords($_GET['cid'], $_GET['evnt']);
$rTemp = getEvents($_GET['evnt']);
$aEvntInfo = mysql_fetch_array($rTemp);
$sEventName = $aEvntInfo['Name'];
while($aRecs = mysql_fetch_array($rRecs)){

87
$sDetTable .=
"<tr><td>".$sEventName."</td><td>".(($aRecs['Sec']=="blank")?"":$aRecs[
'Sec'])."</td><td>".(($aRecs['Row']=="blank")?"":$aRecs['Row'])."</td><
td>".(($aRecs['Seat']=="blank")?"":$aRecs['Seat'])."</td><td>".(!is_num
eric($aRecs['Price'])?"0":$aRecs['Price'])."</td><td>".$aRecs['PurDate'
]."</td></tr>";
}
$sDispPDet = "";
}
}
?>
<div style="padding-left:20px;">
<h2>Customer Info</h2>

<div class='createTitle'>Customers:</div>
<table border='1' id='customerTable' class='centerCells'>
<tr>
<th>First Name</th><th>Last
Name</th><th>Email</th><th>Phone</th><th>Street</th><th>City</th><th>St
ate</th><th>Zip</th><th>Customer Since</th><th>History</th>
</tr>
<?php echo $sCustTable;?>
</table>
<br/>

<div <?php echo $sDispPHist;?>>


<div class='createTitle'>Purchasing History for <?php
echo $sCustomerName;?>:</div>
<table border='1' id='customerHistoryTable'
class='centerCells'>
<tr>
<th>Event</th><th>Date</th><th># of
Tickets</th><th>Total Cost</th>
</tr>
<?php echo $sHistTable;?>
</table>
</div><br/>

<div <?php echo $sDispPDet;?>>


<div class='createTitle'>Seats Purchased for <?php echo
$sEventName;?>:</div>
<table border='1' id='customerDetailTable'
class='centerCells'>
<tr>

<th>Event</th><th>Section</th><th>Row</th><th>Seat</th><th>Cost</th><th
>Date of Purchase</th>
</tr>
<?php echo $sDetTable;?>
</table>
</div><br/>
</div></div>
<?php
include 'bot.php';
?>

88
9.13. dom-drag.js
/**************************************************
* dom-drag.js
* 09.25.2001
* www.youngpup.net
* Script featured on Dynamic Drive (http://www.dynamicdrive.com)
12.08.2005
**************************************************
* 10.28.2001 - fixed minor bug where events
* sometimes fired off the handle, not the root.
**************************************************/

var Drag = {

obj : null,

init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef,


bSwapVertRef, fXMapper, fYMapper)
{
o.onmousedown = Drag.start;

o.hmode = bSwapHorzRef ? false : true ;


o.vmode = bSwapVertRef ? false : true ;

o.root = oRoot && oRoot != null ? oRoot : o ;

if (o.hmode && isNaN(parseInt(o.root.style.left )))


o.root.style.left = "0px";
if (o.vmode && isNaN(parseInt(o.root.style.top )))
o.root.style.top = "0px";
if (!o.hmode && isNaN(parseInt(o.root.style.right )))
o.root.style.right = "0px";
if (!o.vmode && isNaN(parseInt(o.root.style.bottom)))
o.root.style.bottom = "0px";

o.minX = typeof minX != 'undefined' ? minX : null;


o.minY = typeof minY != 'undefined' ? minY : null;
o.maxX = typeof maxX != 'undefined' ? maxX : null;
o.maxY = typeof maxY != 'undefined' ? maxY : null;

o.xMapper = fXMapper ? fXMapper : null;


o.yMapper = fYMapper ? fYMapper : null;

o.root.onDragStart = new Function();


o.root.onDragEnd = new Function();
o.root.onDrag = new Function();
},

start : function(e)
{
var o = Drag.obj = this;
e = Drag.fixE(e);
var y = parseInt(o.vmode ? o.root.style.top :
o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left :
o.root.style.right );

89
o.root.onDragStart(x, y);

o.lastMouseX = e.clientX;
o.lastMouseY = e.clientY;

if (o.hmode) {
if (o.minX != null) o.minMouseX = e.clientX - x +
o.minX;
if (o.maxX != null) o.maxMouseX = o.minMouseX +
o.maxX - o.minX;
} else {
if (o.minX != null) o.maxMouseX = -o.minX + e.clientX
+ x;
if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX
+ x;
}

if (o.vmode) {
if (o.minY != null) o.minMouseY = e.clientY - y +
o.minY;
if (o.maxY != null) o.maxMouseY = o.minMouseY +
o.maxY - o.minY;
} else {
if (o.minY != null) o.maxMouseY = -o.minY + e.clientY
+ y;
if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY
+ y;
}

document.onmousemove = Drag.drag;
document.onmouseup = Drag.end;

return false;
},

drag : function(e)
{
e = Drag.fixE(e);
var o = Drag.obj;

var ey = e.clientY;
var ex = e.clientX;
var y = parseInt(o.vmode ? o.root.style.top :
o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left :
o.root.style.right );
var nx, ny;

if (o.minX != null) ex = o.hmode ? Math.max(ex,


o.minMouseX) : Math.min(ex, o.maxMouseX);
if (o.maxX != null) ex = o.hmode ? Math.min(ex,
o.maxMouseX) : Math.max(ex, o.minMouseX);
if (o.minY != null) ey = o.vmode ? Math.max(ey,
o.minMouseY) : Math.min(ey, o.maxMouseY);
if (o.maxY != null) ey = o.vmode ? Math.min(ey,
o.maxMouseY) : Math.max(ey, o.minMouseY);

90
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

if (o.xMapper) nx = o.xMapper(y)
else if (o.yMapper) ny = o.yMapper(x)

Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";


Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
Drag.obj.lastMouseX = ex;
Drag.obj.lastMouseY = ey;

Drag.obj.root.onDrag(nx, ny);
return false;
},

end : function()
{
document.onmousemove = null;
document.onmouseup = null;
Drag.obj.root.onDragEnd(
parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),

parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));


Drag.obj = null;
},

fixE : function(e)
{
if (typeof e == 'undefined') e = window.event;
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
return e;
}
};

91
9.13. moreFuncs.js
//Extra js functions I wrote
var globalSep = "*";

function saveMap(){
document.mainForm.storedMap.value =
document.getElementById('theMap').innerHTML;
document.mainForm.submit();
}

function saveMapData(){
var xpos;
var ypos;
var xposString = "";
var yposString = "";
var check = "";
var maxSeat = document.genMapForm.actualSeatCount.value;
var i;
var idArray = document.genMapForm.idList.value.split(".");

//document.write("width =
"+document.getElementById(idArray[2]).width+", height =
"+document.getElementById(idArray[2]).height);
var imgW = document.getElementById(idArray[2]).width-2; //
original needed to be 11
var imgH = document.getElementById(idArray[2]).height-2; //
original needed to be 11
//document.write("width = "+imgW+", height = "+imgH);

for(i = (maxSeat-1); i >= 0; i--){


xpos = measureLeft(document.getElementById(idArray[i])) -
measureLeft(document.getElementById("backImage"));
ypos = measureTop(document.getElementById(idArray[i])) -
measureTop(document.getElementById("backImage"));
if((xpos < (document.getElementById("backImage").width -
imgW))&&(xpos > 1)&&(ypos <
(document.getElementById("backImage").height - imgH))&&(ypos > 1)){
xposString += xpos+".";
yposString += ypos+".";
}
else{
xposString += "0.";
yposString += "0.";
}
}

document.genMapForm.x_coords.value = xposString;
document.genMapForm.y_coords.value = yposString;
}

function measureLeft(oElement){
var left = oElement.offsetLeft;
var oParent = oElement.offsetParent;
while(oParent.nodeName != 'BODY'){
left += oParent.offsetLeft;

92
oParent = oParent.offsetParent;
}
return left;
}

function measureTop(oElement){
var top = oElement.offsetTop;
var oParent = oElement.offsetParent;
while(oParent.nodeName != 'BODY'){
top += oParent.offsetTop;
oParent = oParent.offsetParent;
}
return top;
}

function switchBack(){
var iHeight = document.backgroundForm.backHeight.value;
var iWidth = document.backgroundForm.backWidth.value;
var sColor = document.backgroundForm.backColor.value;
var sLocation = "images/"+sColor+"/"+iWidth+iHeight+sColor+".jpg";

document.genMapForm.imagePath.value = sLocation;
document.getElementById("backImage").src = sLocation;
document.getElementById("backImage").width = iWidth;

return;
}
function updateCreateBack(sFile){
document.genMapForm.imagePath.value = sFile;
document.getElementById("backImage").src = sFile;
if(document.getElementById("backImage").width > 700){
document.getElementById("backImage").width = 700;
}

function SetActiveSeat(sId, key){

var sNewImg = document.genMapForm.curActvImg.value;


var oldImg = document.genMapForm.curDfltImg.value;
var sCurActive =
document.getElementById("activeSeatId").innerHtml;
var aSec = document.genMapForm.secList.value.split(globalSep);
var aSecCh = document.genMapForm.secCheckList.value.split(".");
var aRow = document.genMapForm.rowList.value.split(globalSep);
var aRowCh = document.genMapForm.rowCheckList.value.split(".");
var aSeat = document.genMapForm.seatList.value.split(globalSep);
var aSeatCh = document.genMapForm.seatCheckList.value.split(".");
var aPrice = document.genMapForm.priceList.value.split(globalSep);
var aPriceCh =
document.genMapForm.priceCheckList.value.split(".");
var aImgNames = document.genMapForm.idList.value.split(".");
var i = getIndex(aImgNames, sId);
var j = document.genMapForm.actualSeatCount.value-1;

//Seat is unselected
if(sId == sCurActive){

93
document.getElementById("activeSeatId").innerHtml = "";
document.getElementById(sId).src = oldImg;
document.getElementById("seatEditList").style.display =
"none";
}

//New active seat


else if((sCurActive == "") || (!sCurActive)){
document.getElementById(sId).src = sNewImg;
document.getElementById("activeSeatId").innerHtml = sId;
document.getElementById("seatEditList").style.display = "";
}

//Set different active seat


else{
document.getElementById(sCurActive).src = oldImg;
document.getElementById(sId).src = sNewImg;
document.getElementById("activeSeatId").innerHtml = sId;
document.getElementById("seatEditList").style.display = "";
}

//load up new values


if(key) i = (i-j)-(2*(i-j));

if(aSecCh[i] == "1") document.getElementById("checkSec").checked


= true;
else document.getElementById("checkSec").checked = false;

if(aRowCh[i] == "1") document.getElementById("checkRow").checked


= true;
else document.getElementById("checkRow").checked = false;

if(aSeatCh[i] == "1")
document.getElementById("checkSeatId").checked = true;
else document.getElementById("checkSeatId").checked = false;

if(aPriceCh[i] == "1")
document.getElementById("checkPrice").checked = true;
else document.getElementById("checkPrice").checked = false;

checkboxActions("checkSec");
checkboxActions("checkRow");
checkboxActions("checkSeatId");
checkboxActions("checkPrice");

if((aSec[i] == "blank")||(!aSec[i]))
document.getElementById("secField").value = "";
else document.getElementById("secField").value = aSec[i];

if((aRow[i] == "blank")||(!aRow[i]))
document.getElementById("rowField").value = "";
else document.getElementById("rowField").value = aRow[i];

if((aSeat[i] == "blank")||(!aSeat[i]))
document.getElementById("seatIdField").value = "";
else document.getElementById("seatIdField").value = aSeat[i];

94
if((aPrice[i] == "blank")||(!aPrice[i]))
document.getElementById("priceField").value = "";
else document.getElementById("priceField").value = aPrice[i];

return;
}

function SetActiveSeatList(sId){

var sNewImg = document.genMapForm.curActvImg.value;


var oldImg = document.genMapForm.curDfltImg.value;
var aSec = document.genMapForm.secList.value.split(globalSep);
var aRow = document.genMapForm.rowList.value.split(globalSep);
var aSeat = document.genMapForm.seatList.value.split(globalSep);
var aPrice = document.genMapForm.priceList.value.split(globalSep);
var aImgNames = document.genMapForm.idList.value.split(".");
var i = getIndex(aImgNames, sId);
var count = document.getElementById("selectedCount").value;
var path = document.getElementById(sId).alt;
var j = document.genMapForm.actualSeatCount.value-1;
var curCost = document.getElementById("currentCost").value;
var calPrice = 0;

i = (i-j)-(2*(i-j));
if(!isNaN(aPrice[i])) calPrice = aPrice[i];

//Seat is unselected
if(path == "Selected"){
document.getElementById(sId).src = oldImg;
document.getElementById("selectedCount").value = (count*1)
- 1;
document.getElementById(sId+"tr").style.display = "none";
document.getElementById(sId).alt = "Unselected";
document.getElementById("currentCost").value = (curCost*1)-
calPrice;
}

//Select new seat


else{
document.getElementById(sId).src = sNewImg;
document.getElementById("selectedCount").value = (count*1)
+ 1;
document.getElementById(sId+"tr").style.display = "";
document.getElementById(sId).alt = "Selected";
document.getElementById("currentCost").value =
(curCost*1)+(calPrice*1);
}

return;
}

function setPurchaseLists(){

var aSec = document.genMapForm.posSec.value.split(globalSep);


var aRow = document.genMapForm.posRow.value.split(globalSep);
var aSeat = document.genMapForm.posSId.value.split(globalSep);
var aPrice = document.genMapForm.posPrice.value.split(globalSep);

95
var aImgNames = document.genMapForm.posSeat.value.split("*");
var i;
//var j = document.genMapForm.actualSeatCount.value-1;

for(i=0; i<aImgNames.length; i++){


if(aImgNames[i].length > 3){

if(document.getElementById(aImgNames[i]+"tr").style.display ==
""){
document.buyerData.buySeatIds.value =
document.buyerData.buySeatIds.value+aImgNames[i]+globalSep;
document.buyerData.buySecs.value =
document.buyerData.buySecs.value+aSec[i]+globalSep;
document.buyerData.buyRows.value =
document.buyerData.buyRows.value+aRow[i]+globalSep;
document.buyerData.buySIds.value =
document.buyerData.buySIds.value+aSeat[i]+globalSep;
document.buyerData.buyPrices.value =
document.buyerData.buyPrices.value+aPrice[i]+globalSep;
}
}
}
}

function checkboxActions(sBoxId){

var bActive = document.getElementById(sBoxId).checked;


var aList;
var aCheck;
var aImgNames = document.genMapForm.idList.value.split(".");
var sActive = document.getElementById("activeSeatId").innerHtml;
var i = getIndex(aImgNames, sActive);

if(sBoxId == "checkSec"){
aCheck = document.genMapForm.secCheckList.value.split(".");
if(bActive){
document.getElementById("secField").style.display =
"";
aCheck[i] = "1";
}
else{
document.getElementById("secField").style.display =
"none";
aList =
document.genMapForm.secList.value.split(globalSep);
aList[i] = "blank";
aCheck[i] = "0";
document.genMapForm.secList.value =
aList.join(globalSep);
}
document.genMapForm.secCheckList.value = aCheck.join(".");
}
else if(sBoxId == "checkRow"){
aCheck = document.genMapForm.rowCheckList.value.split(".");
if(bActive){

96
document.getElementById("rowField").style.display =
"";
aCheck[i] = "1";
}
else{
document.getElementById("rowField").style.display =
"none";
aList =
document.genMapForm.rowList.value.split(globalSep);
aList[i] = "blank";
aCheck[i] = "0";
document.genMapForm.rowList.value =
aList.join(globalSep);
}
document.genMapForm.rowCheckList.value = aCheck.join(".");
}
else if(sBoxId == "checkSeatId"){
aCheck = document.genMapForm.seatCheckList.value.split(".");
if(bActive){
document.getElementById("seatIdField").style.display
= "";
aCheck[i] = "1";
}
else{
document.getElementById("seatIdField").style.display
= "none";
aList =
document.genMapForm.seatList.value.split(globalSep);
aList[i] = "blank";
aCheck[i] = "0";
document.genMapForm.seatList.value =
aList.join(globalSep);
}
document.genMapForm.seatCheckList.value = aCheck.join(".");
}
else if(sBoxId == "checkPrice"){
aCheck =
document.genMapForm.priceCheckList.value.split(".");
if(bActive){
document.getElementById("priceField").style.display =
"";
aCheck[i] = "1";
}
else{
document.getElementById("priceField").style.display =
"none";
aList =
document.genMapForm.priceList.value.split(globalSep);
aList[i] = "blank";
aCheck[i] = "0";
document.genMapForm.priceList.value =
aList.join(globalSep);
}
document.genMapForm.priceCheckList.value = aCheck.join(".");
}

return;

97
}

function setLists(iMaxSeat){

var sSec = "";


var sRow = "";
var sSeat = "";
var sPrice = "";
var sValid = "";
var i;

for(i=0; i<iMaxSeat; i++){


sValid += "0.";
sSec += "blank*";
sRow += "blank*";
sSeat += "blank*";
sPrice += "blank*";
}

document.genMapForm.secList.value = sSec;
document.genMapForm.secCheckList.value = sValid;
document.genMapForm.rowList.value = sRow;
document.genMapForm.rowCheckList.value = sValid;
document.genMapForm.seatList.value = sSeat;
document.genMapForm.seatCheckList.value = sValid;
document.genMapForm.priceList.value = sPrice;
document.genMapForm.priceCheckList.value = sValid;

return;
}

function updateSeatLists(sBoxId, key){


var sImgNames = document.genMapForm.idList.value;
var aImgNames = sImgNames.split(".");
var sActiveId = document.getElementById("activeSeatId").innerHtml;
var i = getIndex(aImgNames, sActiveId);
var aList;
var sFieldValue = document.getElementById(sBoxId).value;
var j = document.genMapForm.actualSeatCount.value-1;

if(key) i = (i-j)-(2*(i-j));
sFieldValue = trimString(sFieldValue);
if(sFieldValue.length == 0) sFieldValue = "blank";

switch(sBoxId){
case "secField":
aList =
document.genMapForm.secList.value.split(globalSep);
aList[i] = sFieldValue;
document.genMapForm.secList.value =
aList.join(globalSep);
break;

case "rowField":
aList =
document.genMapForm.rowList.value.split(globalSep);
aList[i] = sFieldValue;

98
document.genMapForm.rowList.value =
aList.join(globalSep);
break;

case "seatIdField":
aList =
document.genMapForm.seatList.value.split(globalSep);
aList[i] = sFieldValue;
document.genMapForm.seatList.value =
aList.join(globalSep);
break;

case "priceField":
aList =
document.genMapForm.priceList.value.split(globalSep);
aList[i] = sFieldValue;
document.genMapForm.priceList.value =
aList.join(globalSep);
break;
}

return;
}

function trimString(str){

while(str.charAt(0) == (" ") ){


str = str.substring(1);
}

while(str.charAt(str.length-1) == " " ){


str = str.substring(0,str.length-1);
}

return str;
}

function displaySeatInfo(sSeatId, key){

var sOut = "";


var aImgNames = document.genMapForm.idList.value.split(".");
var i = getIndex(aImgNames, sSeatId);
var aSec = document.genMapForm.secList.value.split(globalSep);
var aRow = document.genMapForm.rowList.value.split(globalSep);
var aSeat = document.genMapForm.seatList.value.split(globalSep);
var aPrice = document.genMapForm.priceList.value.split(globalSep);
var j = document.genMapForm.actualSeatCount.value-1;

if(key) i = (i-j)-(2*(i-j));

if((aSec[i] != "blank")){
sOut += "Section: "+aSec[i]+" ";
}
if((aRow[i] != "blank")){
sOut += "Row: "+aRow[i]+" ";
}
if((aSeat[i] != "blank")){

99
sOut += "Seat: "+aSeat[i]+" ";
}
if((aPrice[i] != "blank")){
sOut += "Price: $"+aPrice[i];
}

if(key == 1) document.getElementById("expressInfo1").value = sOut;


else document.getElementById("expressInfo").value = sOut;

return;
}

function clearSeatInfo(key){

if(key == 1) document.getElementById("expressInfo1").value = "";


else document.getElementById("expressInfo").value = "";

return;
}

function getIndex(aArray, sValue){

var i;

for(i=0; i<aArray.length; i++){


if(aArray[i] == sValue) break;
}

return i;
}

function updateName(){

var sName = document.getElementById("nameInput").value;

sName = trimString(sName);
document.genMapForm.mapName.value = sName;
}

function setSampleImg(sFile, sName, sID){

document.getElementById(sID).src = sFile;
document.getElementById(sID).alt = sName;
if(document.getElementById(sID).width > 500)
document.getElementById(sID).width = 500;
}

function updateCurrentCombo(iComID, sFile, sAFile, sTFile){

var maxSeat = document.genMapForm.actualSeatCount.value;


var i;

document.genMapForm.seatCombo.value = iComID;
document.genMapForm.curDfltImg.value = sFile;
document.genMapForm.curActvImg.value = sAFile;
document.getElementById("sampleDef").src = sFile;

100
document.getElementById("sampleAct").src = sAFile;
document.getElementById("sampleTak").src = sTFile;

for(i = 0; i < maxSeat; i++){


document.getElementById("seat"+i).src = sFile;
}
}

function hideTable(sID, iHide){

if(iHide == 1) document.getElementById(sID).style.display =
"none";
else document.getElementById(sID).style.display = "";
}

101

You might also like