Journal of Computer and Communications, 2014, 2, 182-187
Published Online March 2014 in SciRes. http://www.scirp.org/journal/jcc
How to cite this paper: Wang, Z.J. and Barner, R.L. (2014) A Web System for Choose Your Own Adventure. Journal of
Computer and Communications, 2, 182-187. h ttp://dx. doi.org/10. 4236/j cc.2014.2 4024
A Web System for Choose Your Own
Zizhong J. Wang1,2, Regina L. Barner2
1College of Information Engineering, Taiyuan University of Technology, Taiyua n, China
2Department of Mathematics and Computer Science, Virginia Wesleyan College, Norfolk, USA
Received December 2013
The Web system for Choose Your Own Adventure (CYOA) project utilizes the PHP and MySQL pro-
gramming languages for an entertainment purpose. This project creates a fully-functional and se-
cure online user system, in which the accounts of the user system are stored in a MySQL database.
Over the duration of this project, it is found that the PHP and MySQL programming languages are
able to be employed for entertainment purposes, and they are both very effective in the field of
entertainment. This project is meant to broaden the horizons of aspiring programmers in order to
give them a glimpse into a possibility of using these programming languages in a scope that is
commonly broached by game developers, but not programmers in the usual case.
Web System; PHP/MySQL; Entertainment; Game Developer
The online information systems or Web systems have been developed so fast in the past decades [1,2]. The im-
portance of this project is to give programmers, both beginner and experienced, an insight into the possibilities
of using the PHP and MySQL programming languages for entertainment purposes. It also allows users to broa-
den their horizons by delving into an interactive online text adventure that they may not have experienced be-
The goal of this project is to give a convincing example of how the PHP and MySQL programming languages
could be used for entertainment purposes , instead of strictly analytical applications. The most effective pre-
sentation of this goal is to create an online tool that allowed users to create their own accounts and experience a
text adventure of their choosing. The display properties of this project are accomplished by building web pages
using extensive PHP, and to store user account information into a MySQL database which the website is able to
access in order to add information , change information, or remove information. In the next section, the sys-
tem design is presented. The implementation of the system is introduced in the Section 3. The conclusion is
given in the last section.
Z. J. Wang, R. L. Barner
2. System Design
URL:zeus.vwc.edu/~rlbarner/cyoaabstract.html presents the system home page. The information stored in the
following table, CYOAUsers , is comprised of user accounts and information pertaining to the user, such as
username, password, and more. Figure 1 shows the descriptive summary of the table CYOAUsers, and Figure 2
shows the flowchart of the system.
When viewing the Website, everyone starts at the front page, which prompts the user to either register for a
user account, enter the security question and answer combination if the user forgets the username and/or pass-
word, or log into the system with a preexisting user account. The front page is as Figure 3.
If the user chooses to register for a user account, he/she would be prompted to enter the name, gender, desired
username, password (which is case sensitive), the chosen security question and security answer. The name and
disclosed gender is general information. The username and password is used to log into the online tool. The se-
curity question and answer are used in case the user forgets either the username or password. The registration
page is as Figure 4.
If the user chooses to log into the account in order to access the online tool, he/she is prompted to enter the
username and password, along with a gentle reminder that both are case sensitive. The login page is as Figure 5.
After successful login, the user would arrive at the user hub, which allows the user to either choose a text ad-
venture to pursue, or to change something in their user options, which consisted of changing the password, see -
ing the statistics, resetting the statistics, or removing the account. The user hub page is as Figure 6.
The “Change Your Password” form features three input boxes, which prompts the users to enter their current
Figure 1. The description of CYOAUsers table.
Figure 2. System flowchart.
Z. J. Wang, R. L. Barner
Figure 3. The snapshot of the front page of the system.
Figure 4. The snapshot of the user registration page.
Figure 5. The snapshot of the user login page.
Figure 6. The snapshot of the user selection page.
Z. J. Wang, R. L. Barner
password, the new password that they wish to use, and re-input the new password. If the new password is the
same as the current password used, an error message would occur and redirect the user back to the input form. If
the new password and re-entered password did not match, an error message would occur and redirect the user
back to the input form. The “Change Your Password” form is as Figure 7.
The “See Your Statistics” form uses session variables that stored the user’s username and password in order
to access the MySQL table and to display a chart that shows the user’s CYOAs Started (incremented every time
the user accessed a starting text adventure page), CYOAs Finished (incremented every time the user accessed a
finishing text adventure page), and CYOA Deaths (incremented every time the user accessed a text adventure
death page). The “See Your Statistics” form is as Figure 8.
The “Reset Your Statistics” form also uses session variables that store the user’s username and password in
order to access the MySQL table and to change all of the statistics, as mentioned above, back to zero if the user
wishes. It would then display a chart that showed the new zero statistics, to show the user that the statistics are
reset. The “Reset Your Statistics” form is as Figure 9.
The “Remove Your Account” page would use session variables that store the user’s username and password
in order to delete the information from the MySQL table. It would delete the account upon clicking on the link,
so it is advised not to click that link unless users are sure that they wanted to delete their account. The “Remove
Your Account” page is as Figure 10.
3. System Implementation
The Web system is implemented with over 20 HTML/PHP files. Some of the selecting pages are as follows.
Figure 7. The snapshot of the password change page.
Figure 8. The snapshot of the statistics form page.
Figure 9. The snapshot of the statistics reset form page.
Z. J. Wang, R. L. Barner
Figure 10. The snapshot of the account removal page.
• cyoafrontpage.php—The front page of the Web system that allows the user to either register for a user ac-
count, login with the user account, or to poll the MySQL table for the username and/or password if they for-
• cyoaregistration.htm l—The new user registration page, which asks for the user’s name, gender, desired user-
name , password , security question (chosen from a drop-down list), and security answer.
• registrationaction .php—The registration results page, which displays the information that the user just in-
putted for their new user account . If an error occurred, the user has to repeat the registration process, and
no new user account would have been added to the MySQL table, CYOAUsers.
• forgotuserpass.html—If a user forgets his/her username and/or password, he/she could poll the MySQL table
for their information by picking their security answer from a selection box and typing in their security an-
swer, which is case sensitive.
• forgotuserpassactionnotin.php—The forgot username/password results page, if the user has not logged into
the online tool. This page displays the user’s username and password combination in a small table if their
security question and answer inputs are both correct. If an error occurred, the user would have had to start
the process of obtaining their information over again.
• cyoalogin.html—The main login page, which prompts the user to input their username and password. There
are hidden variables embedded in the login form on this page that pertained to the “randomized” text adven-
ture; specifically, those variables are “fire”, “water”, and “eart h”.
• cyoaloginaction.php—The user would never see this page. It consists of a java script that directed the user to
cyoaloginactionb.php, after polling the MySQL table to check that their username and password combina-
tion are correct. The login session began on this page.
• cyoaloginactionb.php—The user hub, which allows the user to either choose a text adventure to pursue,
change their options, or logout.
• classicprimer.php—The beginning prompt of the first text adventure, which is labeled as “Classic CYOA:
Dungeon Crawler” on the website. Every page, linked to this page by a series of redirections via form but-
tons, involves the text adventure. Each page features a short prompt and two choices, preceded by buttons,
which allowed the user to choose what they would like to pursue during the text adventure. These pages are
used for the entertainment side of the project only, used as a vessel to fuel the story contained within the text
• randomstartdirect.php—Began the second of the two text adventures available on the website, titled “Classic
CYOA: Dungeon Crawler REVAMP: Randomized”. Because this particular text adventure consists of four
“roo ms ” that the user cycles through at one point or another, this page randomly chooses one of the rooms to
start the user off inside, which allows for more varied text adventure experiences . It is unlikely for the
user to begin in the same room, even if the user began this same text adventure one play through after anoth-
er. The following pages correspond to the pages linked together to form this particular randomized text ad-
• waterlanding.php, firelanding.php, earthlanding .php, finallanding.php—“Landing” pages that increment the
session variable dependent upon the element of the room. Session variables “water”, “fire”, and “ear th ” are
used to track which rooms the user had previously visited. If all session variables held a “1”, the user would
be directed to the “finallanding.php”, which led to the end of the text adventure.
• “Fire” rooms, which features a prompt and two choices preceded by a form button for redirection to other
pages, includingfirebackaway.php, firefeelaround.php, firegrabjewel.php, fireputout.php, firereachinto.php,
firesearch. php, firewithdraw.php. These pages are used for the entertainment side of the project only, used as
a vessel to fuel the story contained within the text adventure.
Z. J. Wang, R. L. Barner
• “Water” ro o ms, which features a prompt and two choices preceded by a form button for redirection to other
pages, includingwaterdive.php, watergetjewel.php, waterhallwaynojewel.php, waterhop1.php, waterhop2.p hp,
waterhop3.php, waterquestion 2.php, waterquestion3.php , waterwrong. php. These pages are used for the en-
tertainment side of the project only, used as a vessel to fuel the story contained within the text adventure .
• “Earth” rooms, which features a prompt and two choices proceeded by a form button for redirection to other
pages, included earthheart.php, earthkeyhole.php, ea rthturnback .php, earthusekey.php, earthxbone.php.
These pages are used for the entertainment side of the project only, used as a vessel to fuel the story con-
tained within the text adventure.
• The “final” room, which features a prompt and three radio buttons (labeled “rock”, “paper”, and “scissors”,
respectively) in order to simulate a rock-paper-scissors game against the “boss” of the text adventure, includ-
ing finaldie.php, finaltie.php, finalaction.php , finalwin.php. These pages are used for the entertainment side
of the project only, used as a vessel to fuel the story contained within the text adventure.
• fireredirect.php, waterredire ct.php, earth redirect.php —After the user completes one of the elemental rooms,
he/she would reach this page, which checks the elemental session variables to see which held “1”s. It ran-
domly picks a room for the user to explore next, dependent upon which elemental variables held “1”s or “0”s.
If all session variables contain “1”s, the user would be redirected to the finallanding.php page to complete
the text adventure .
The Web system For Choose Your Own Adventure project explores the possibilities of using programming lan-
guages such as PHP and MySQL for entertainment purposes, instead of analytical or mathematical purposes.
This project is conducted online, and utilized a MySQL database to store user account information entered and
modified from the website. The importance of this project is that it could broaden the horizons and perspectives
of both aspiring and experienced programmers: instead of using these languages for just an analytical or mathe-
matical purpose, they could also be used for entertainment purposes. It is concluded that using analytical and
mathematical programming languages such as PHP and MySQL for an entertainment purpose is entirely possi-
ble, and these languages are very effective being used for this purpose.
 Wang, Z., et al. (2013) The Dynamic Business Web Template Design and Implementation. Proceedings of the 12th
International Conference on E-Learning, E-Business, Enterprise Information Systems, & E-Govern ment (EEE’13),
CSREA Press, 225-228.
 Johnson, G. and Wang, Z. (2013) An Online Database System for Card Stores. Proceedings of the 12th International
Conference on E-Learning, E-Business, Enterprise Information Systems, & E-Government (EEE’13), CSREA Press,
 W3Schools (2013) SQL UPDATE Statement. http://www.w3schools.com/sql/sql_update.asp
 W3Schools (2013) SQL ALTER Statement. http://www.w3schools.com/sql/sql_alter.asp
 (2013) Rand. PHP Manual. http://us2.php.net/manual/en/function.rand.php
 User-Defined Functions. PHP Manual. http://php.net/manual/en/functions.user-defined.php
 22.214.171.124. SHOW COLUMNS Syntax. MyS QL. http://dev.mysql.com/doc/refman/5.0/en/show-columns.html