Google Answers Logo
View Question
 
Q: Internet Games - Shopping Reward System ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Internet Games - Shopping Reward System
Category: Computers > Programming
Asked by: merries-ga
List Price: $10.00
Posted: 01 Dec 2002 08:17 PST
Expires: 31 Dec 2002 08:17 PST
Question ID: 117202
I want to develop small online games, perhaps with Java that keep
track of your score. I would like the ability to have the players
score emailed to me or some other method to collect the high scores.
The reason is awarding shopping points for playing games toward
promotional gifts and prizes. How would this be done, and an easy
method?

Clarification of Question by merries-ga on 01 Dec 2002 08:30 PST
When I said Java I meant Javascript I know there is a big difference
between the two. Thanks! Merrie

Request for Question Clarification by xargon-ga on 05 Dec 2002 07:51 PST
My suggestion would be for you to use a server-side language such as
ASP or PHP in conjunction with some sort of database to store these
scores.  This would prevent an overwhelming influx of emails that you
would have to manually parse through, and would also allow you to
easily pull scores and names from the database for use on a public
website, so players can see how they compare with others.  You would
also be able to easily write scripts that analyze the scores kept in
the database.

In my own experience, if you know Javascript it would not be very
difficult to pick up PHP.  If this solution interests you, I can
provide a thorough answer and point you toward some excellent
tutorials.  Let me know if this interests you.

Clarification of Question by merries-ga on 05 Dec 2002 08:08 PST
Im learning Javascript I am by no means really good at it yet. Could
you provide an answer to the PHP and the add on to Javascript to
enable the scores to be emailed? This email method may be good for
other things as well.

Im certainly willing to learn. Thank you.

Request for Question Clarification by xargon-ga on 05 Dec 2002 13:06 PST
With PHP (or ASP) you can have the scores emailed to you, or to the
player, or to whomever you want.  Using a database, you could store a
player's email address in order to update them with the latest news.

To be honest, Javascript is useful for specific features on a
site--perhaps you use it with some of your games.  But I cannot think
of an efficient way to accomplish what you ask with the exclusive use
of Javascript.  If you wish, though, I could probably find some
Javascript to accomplish the emailing--but as I mentioned, you could
do this more efficiently with PHP.

I'm happy to oblige you however you wish to be answered.  Just let me
know; I should have some time this evening.

Clarification of Question by merries-ga on 05 Dec 2002 14:03 PST
Thanks, alright then how about giving me info on the PHP method. Thanks!
Merrie
Answer  
Subject: Re: Internet Games - Shopping Reward System
Answered By: xargon-ga on 05 Dec 2002 22:41 PST
Rated:5 out of 5 stars
 
Hello again!

Here is my suggestion for your project: use PHP in conjunction with a
mySQL database to store scores, email addresses, and any other
information you require.  You can use PHP to create dynamic forms
(such as email) and to interface with the database.


PHP is a server-side scripting language.  “Server-side” means that the
document is interpreted by the web-server before it is sent to a web
browser.  A user trying to “view source” of a PHP document will see
only HTML, because all the PHP code will have been replaced with
meaningful text by the server.  An example of “client-side”
interpretation would be JavaScript, since the user’s browser must do
the grunt work.  PHP is in the C/C++ family of languages, so if you
are familiar with any such languages (Java, JavaScript, etc.) you
should be fine.  The other primary alternative for a server-side
scripting language is ASP--which is based on the Visual Basic language
family.  Essentially, both ASP and PHP can accomplish the same thing;
it’s simply a matter of availability and personal preference. I myself
choose PHP because I am more comfortable with the C language family. 
The other interesting thing about PHP is that the syntax is nearly
identical to that of PERL--a language often used in CGI scripting
(such as in shopping carts, although those can also be done in PHP). 
The only real difference between PHP and PERL is that the former is
server-side while the latter is client-side.  (Client side has the
advantage of versatility among user platforms and ease of use with
databases).  The downside is that PHP must be supported by your
web-server (it is widely supported, though).

A database is essentially a large table (several tables if you need
them) in which you can store integers, strings, or large text bodies. 
The easiest database to interface using PHP is the mySQL database--a
popular open source project.  PHP has built-in functions for making
calls to a mySQL database, so it is a logical choice.  Database
commands are made using SQL (Structured Query Language), although
really this is not a language.  SQL commands are intuitive methods of
creating, inserting, deleting, and reading from a database table.  The
inherent PHP commands allow you to send SQL commands to the mySQL
database (these names can be confusing at first: SQL is the language,
mySQL is the database).  The advantage of using the database in your
instance would be that you could store a user’s alias, email address,
and high score (for example) as a row in a table containing all
players.  You could then publish a web page with the top ten players,
send an email to all players, or compute statistics on the scores--all
from the same database!


Now you need to learn how to use some of these wonderful tools.  There
are several good tutorials on the web:

#1 - PHP
 
PHP Builder has a good introduction to the basic features of the
language, as well as some of the more advanced techniques.  You should
not need to read much more than the first two roman numerals to get
then hang of things.
http://www.phpbuilder.com/manual/

PHP.net also provides a good tutorial for newcomers to the language.
http://www.php.net/manual/en/tutorial.php

All you really need at first is a basic feel for the syntax and form
of the language.


#2 - SQL

SQL is extremely easy to learn.  This W3 schools’ tutorial has
everything you’ll need to know about SQL (well, almost).  For your
immediate purposes, you should be fine with just reading the “SQL
Basics” section; the advanced features are nice, but not required for
a successful database-driven site.
http://www.w3schools.com/sql/default.asp


#3 - Build Your Site with PHP and a mySQL database

This is a very excellent tutorial.  It walks you through some basic
PHP and SQL commands, but it gives very good examples on how to use
the two together in a web-site.
http://www.mysql.com/articles/ddws/index.html



With even just knowledge of PHP and SQL basics, you will be able to
perform powerful tasks with a greater ease that would be possible with
HTML and a client-side language.  The tutorials provide plenty of
examples that you should not have any trouble getting started.  Once
you have the syntax down, you can also find all kinds of code snippets
from other PHP developers that you can use.


Here are some snippets to perform the task of sending an email using
PHP:

Sends an email with an attachment
http://codewalkers.com/seecode/98.html

A good walkthrough of setting up a form with a PHP script to process
and send an email
http://www.webreference.com/programming/php/phpemail/

If you are still interested in using JavaScript to send email, there
are 16 scripts available from this page
http://www.hotscripts.com/JavaScript/Scripts_and_Programs/Email_Scripts/



I hope this helps you with your endeavors.  Below I have provided some
additional links for your reference or to help you find code snippets.
 Good luck!

xargon-ga



Additional Links:

Two good references for commands:
http://www.phpbuilder.com
http://www.php.net

Good places to find scripts:
http://www.hotscripts.com/PHP/Scripts_and_Programs/
http://php.resourceindex.com/
http://www.php-scripts.com/
http://www.free-scripts.net/
merries-ga rated this answer:5 out of 5 stars and gave an additional tip of: $5.00
Thank you very much this was an excellent answer to a challanging problem for me.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy