--------------------------------------------------------------------------
Maintenance	A web-based program to aid vehicles maintenance.
		Keeps trak of maintenance operations and warns
		when maintenance is required.

Version:	0.2	7-Nov-2001

Author:		Niccolo Rigacci <niccolo@rigacci.org>

Copyright (C) 2001 Niccolo Rigacci

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
--------------------------------------------------------------------------

In order to run this program on your server you will need:

 - The Apache web server
   I have developed the program on a Debian GNU/Linux box
   running Apache 1.3.9, but I think that any web server
   able to run PHP scripts can do the same.
   
 - The PostgreSQL database
   Maintenance data are keept into the database. A database
   called "maintenance" need to be created and the web server
   process need to be able to access it.
   The database may also run on a different host from the one
   running the web server. I used PostgreSQL 6.5.3.

 - The PHP scripting language
   On the web server you must install the PHP interpreter.
   I used PHP 4.0.3, may be PHP3 can work too. The module
   for conncet to PostgreSQL must be installed too.

--------------------------------------------------------------------------
Installation
--------------------------------------------------------------------------
Unpack the sources into a directory published by the web server.
Supposed that your DocumentRoot is /var/www/, you can make the
directory /var/www/maintenance/.

Create the database to host data. The simplest way is to run the
SQL script MakeDB.sql (located in the SQL subdirectory) as the
database owner. Supposed that the database owner is called postgres,
you can do:

  # su postgres
  $ psql < MakeDB.sql

WARNING: The sql script creates a new database called
"maintenance" and grants all the privileges on its tables to the
"www-data" user. This is because on my box the user running the
apache web server is called www-data. If your web server is
running under another UID, you have to change the MakeDB.sql
script accordingly.

If you wish to run the database on a different host or you need
some special security to access the database, you can change
the connect_db() function in the common.php file.

Now you can start a web browser and point it to the address
http://your.server.name/maintenance/.

The procedure which created the database, also created an user
called "test" with password "test" so you can start playing around.

--------------------------------------------------------------------------
Adding new users
--------------------------------------------------------------------------
At the moment there is no way to add users from the web
interface. You must log into the database and perform the
appropriate SQL statements. An example follows:

  # su postgres
  $ psql
  template1=> \connect maintenance;
  maintenance=> INSERT INTO owners (owner, passwd) VALUES ('nik', 'secret');
  maintenance=> \q
  $ exit

--------------------------------------------------------------------------
Database backup
--------------------------------------------------------------------------
As the postgres user you can:

 - save the entire database (for backup purpose):
   pg_dump maintenance > maintenance.dmp

 - restore the database (which must already be created):
   psql -e maintenance < maintenance.dmp
   
--------------------------------------------------------------------------
History
--------------------------------------------------------------------------
0.2  (2001-11-07)
   Added "must-revalidate" header to start_html() function (common.php),
   otherwise some browsers - like Opera - show outdated pages after
   user logged out.

0.1  (2001-17-29)
   First public release.
