PStocks
Copyright (C) 1999 Dan Steinman (dan@dansteinman.com)
PStocks is free software under the terms of the GNU General Public License

http://www.dansteinman.com/php/pstocks/

INSTRUCTIONS

PStocks is a combination of two PHP3 scripts for creating and displaying stock share price quotes made available from the Yahoo! Finance website.  In order to run this script on your server it must have PHP3 installed, and you must have access to a MySQL database.

PHP - http://www.php.net
MySQL - http://www.mysql.com/

The pstocks-class.php3 script is where most of the work is done - it's a class that handles all the dirty work.  The pstocks.php3 script is an example of how to use the PStocks class to create your own front-end.  The default front-end is a simple table and is intended as a starting point.

PStocks uses a small PHP library that wrote for my different PHP apps called DPLib - if you did not download DPLib you must do so now at http://www.dansteinman.com/php/dplib/.  Put the 2 dplib scripts in the same directory as the pstocks scripts.

The set up work you'll have to do involves setting the MySQL hostname, username, password, and database name in BOTH the pstocks.php3 script, AND dplib-login.php3:

$mysql = new MySQLDatabase;
$mysql->setHost('localhost');  // sql server host name
$mysql->setUsername('myuser');  // sql server username
$mysql->setPassword('mypass');  // sql server password
$mysql->select_db('mydatabase'); // select database to store info

Once that's done you must create a user account for DPLib, visit the dplib-login.php3 and create a new account.  By default this will create a "users" database in your MySQL server (this could be changed within the dplib.php3 source if necessary).

After you create an account you should be brought to a simple page that says
"<username> was successfully logged in"

This puts 2 cookies in the browser named "cusername" and "cpassword" - PStocks uses those cookies to grab the username/password, thus there is no login page for PStocks.

As long as the cookies are present, when you visit pstocks.php3 you will be automatically logged in, and can then add new stocks to your list by clicking "customize" or enter stock symobls into the text field to get a quick quote. 

If you are interested in using PStocks on a simple website that does not need a user-based system please read the source code to pstocks-nouser.php3 for a way to bypass the inital dplib-login sequence.

Have fun!

CHANGES

Version 0.1 (May 10, 2000)
	- first public release 

Dan Steinman
dan@dansteinman.com
www.dansteinman.com
