Journal of Computer and Communications, 2014, 2, 182-187
Published Online March 2014 in SciRes. http://www.scirp.org/journal/jcc
http://dx.doi.org/10.4236/jcc.2014.24024
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
Adventure
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
Email: zwang@vwc.edu
Received December 2013
Abstract
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.
Keywords
Web System; PHP/MySQL; Entertainment; Game Developer
1. Introduction
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-
fore.
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 [3], 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 [4], 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
183
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 Passwordform features three input boxes, which prompts the users to enter their current
Figure 1. The description of CYOAUsers table.
Front Page
Registration
Login
User Hub
Adventure
User
Options
Forgot
User-name/PW
Figure 2. System flowchart.
Z. J. Wang, R. L. Barner
184
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
185
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 Passwordform is as Figure 7.
The See Your Statisticsform uses session variables that stored the users username and password in order
to access the MySQL table and to display a chart that shows the users 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 Statisticsform is as Figure 8.
The Reset Your Statisticsform also uses session variables that store the users 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 Statisticsform is as Figure 9.
The Remove Your Accountpage would use session variables that store the users 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 Accountpage 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
186
Figure 10. The snapshot of the account removal page.
cyoafrontpage.phpThe 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-
got it.
cyoaregistration.htm lThe new user registration page, which asks for the users name, gender, desired user-
name , password , security question (chosen from a drop-down list), and security answer.
registrationaction .phpThe registration results page, which displays the information that the user just in-
putted for their new user account [8]. 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.htmlIf 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.phpThe 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.htmlThe 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 “randomizedtext adven-
ture; specifically, those variables are fire”, “water”, and “eart h”.
cyoaloginaction.phpThe 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.phpThe user hub, which allows the user to either choose a text adventure to pursue,
change their options, or logout.
classicprimer.phpThe beginning prompt of the first text adventure, which is labeled as Classic CYOA:
Dungeon Crawleron 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
adventure.
randomstartdirect.phpBegan 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 [6]. 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-
venture.
waterlanding.php, firelanding.php, earthlanding .php, finallanding.php—“Landingpages 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.
“Firerooms, 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
187
“Waterro 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 [7].
“Earthrooms, 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 “finalroom, 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 “bossof 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 [8].
4. Conclusion
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.
References
[1] 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.
[2] 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,
229-233.
[3] W3Schools (2013) SQL UPDATE Statement. http://www.w3schools.com/sql/sql_update.asp
[4] W3Schools (2013) SQL ALTER Statement. http://www.w3schools.com/sql/sql_alter.asp
[5] Javascript Message Box with “Yes” and “No” Button.
http://www.webdeveloper.com/forum/showthread.php?96282-RESOLVED-Javascript-messa ge-box -with-quot-Yes-qu
ot-and-quot-No-quot-button
[6] (2013) Rand. PHP Manual. http://us2.php.net/manual/en/function.rand.php
[7] User-Defined Functions. PHP Manual. http://php.net/manual/en/functions.user-defined.php
[8] 13.7.5.5. SHOW COLUMNS Syntax. MyS QL. http://dev.mysql.com/doc/refman/5.0/en/show-columns.html