Index of /ecards/iriguchi/
| Name | Last Modified | Size |
|---|---|---|
| 2006-05-20 11:11 | - | |
| 2006-05-20 11:11 | - | |
| 2019-11-23 23:07 | - | |
| 2006-05-20 11:11 | - | |
| 2004-01-30 21:53 | 7k | |
| 2004-01-30 21:53 | 18k | |
| 2004-01-30 21:53 | 1k |
Flat File DataBase (FFDB) PHP Library
John Papandriopoulos <jpap@users.sourceforge.net>
http://ffdb-php.sourceforge.net/
--------------------------------------------------------------------------
CONTENTS
--------
1.0 Overview
2.0 SHOW YOUR SUPPORT!
3.0 Requirements
4.0 Documentation
5.0 Using FFDB
5.1 How to install
5.2 Code Samples
5.3 How to protect your databases
6.0 Bugs
1.0 Overview
------------
This package provides an advanced database package for PHP for those without
access to mySQL. It is not a complete drop-in replacement for mySQL. In
fact, it doesn't support SQL at all.
However, most commonly used database functionality is provided in addition
to some advanced features. It is possible to write another PHP class to
wrap around FFDB to provide SQL functionality. I am happy with using the
methods on the current FFDB class, so I will probably not write such a
wrapper class myself.
Originally, I had wanted a small database for some PHP scripting, but did
not have access to mySQL. A package called TextDB was found, however I kept
finding bugs - in the end I decided it would be better to create my own
database library that worked the way I wanted, and that I could customise to
my own use with great ease.
Although the performance of FFDB is nowhere near that of mySQL, it should be
OK for light use. It uses a binary search and a sorted index to find items
in the database, and tries to minimise the disk space taken up by each file
and the amount of disk IO that is required to do a read or write. If you
really want the result of your queries sorted, you can do this too. You
can also specify a user defined function or a regular expression to select
the records you want before sorting.
Note that although the package is called "Flat File" DataBase (FFDB), it
really isn't a flat file due to the index and optimisations written in
the code.
If you write a good guestbook, forum, news manager, or anything with FFDB,
let me know! If it's OK with you, I'd like to include more samples along
with the package, to help people get started quicker, and to make the
package more useful. Full credit will always be given... it is open-source
after all!
FFDB is distributed under the GNU General Public License (GPL). See the
file 'COPYING' for a copy of the GPL.
2.0 SHOW YOUR SUPPORT!
----------------------
If you use and like FFDB, please show your support and place a small logo
and link to the main FFDB website. An email letting me know of your project
or website would be greatly appreciated also, so I can check it out!
Please copy and paste the following HTML to your website:
<A target="_top" href="http://ffdb-php.sourceforge.net/"><IMG src="http://ffdb-p
hp.sourceforge.net/ffdb-logo.png" width="88" height="31" border="0" alt="FFDB Lo
go"></A>
Thank you!
3.0 Requirements
----------------
The FFDB package requires:
o PHP4.0.0 or better
o Ability to read/write (binary) files [1]
** WARNING **
The flock(...) function may not work correctly under MS-Windows. Without
the correct operation of flock(...), your databases may become corrupted.
See http://www.php.net/manual/en/function.flock.php for more information.
PHP3 compatibility might be possible, but a lot of re-work of the code is
needed. Most people are using PHP4 these days, so hopefully this won't
be a problem for you. If you port FFDB to PHP3, please send me an email!
[1] Make sure your permissions are correct on your web host so that the
webserver/PHP can read/write your database files.
4.0 Documentation
-----------------
HTML documentation (generated from the source code) can be found in the 'docs'
directory. The most useful documentation is that of the FFDB class. You can
find a link to that under 'Classes' in the left-hand side header pane once
you open the documentation with your browser. Note that some methods are
documented as private; don't use them unless you know exactly what you are
doing.
The documentation was generated with 'HeaderDoc', written by Matt Morse
(matt@apple.com) from Apple Computer. You can find it at the following URL:
http://www.opensource.apple.com/projects/headerdoc/
5.0 Using FFDB
--------------
5.1 How to Install
~~~~~~~~~~~~~~~~~~
Just copy the file 'src/ffdb.inc.php' to your webspace, and in your PHP
script insert the line:
include("ffdb.inc.php");
before you start using FFDB. Note that this assumes the 'ffdb.inc.php' file
is in the same directory as your own PHP code.
5.2 Code Samples
~~~~~~~~~~~~~~~~
Samples showing the use of FFDB can be found in the 'samples' directory.
What follows is an overview of each sample included in the package, along
with the directory of its location and the author who contributed it.
admin/
Author: John Papandriopoulos <jpap@users.sourceforge.net>
This is quite a complex example, and provides a web interface for:
o Creating new databases
o Viewing databases
o Adding/Editing/Deleting database records
o Adding/Removing database fields
o Back up all databases to a PErl ARchive (PEAR)
It also uses cookies with a username/password to protect full access
to the databases.
You can customise the script by changing the defines at the top of
the source file.
convert/
Author: John Papandriopoulos <jpap@users.sourceforge.net>
Converts FFDB version 1.xx databases to the new version 2.xx format.
(Note: databases from FFDB version 1.0 and 1.1 are not supported)
test/
Author: John Papandriopoulos <jpap@users.sourceforge.net>
This is a very simple phone directory. It was originally written to
test most of the FFDB class methods.
5.3 How to protect your databases
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All of the databases created with FFDB are just files in your publically
accessible webspace. This means that if someone knows the filename of your
database, they can just download it. If you are storing sensitive information
in these database files, then you need to protect them.
To do this, place all of your databases into a single directory, having it
separate to all of your public content. e.g. if your content is in
the directory /home/public_html/php/ then place all of your databases in the
directory /home/public_html/php/db/
Now set up an access control file: .htaccess in your database directory
(/home/public_html/php/db/ in the case above).
To do this, create a file called .htaccess in your database directory, and
place in it the following 5 lines:
<Limit GET POST>
order deny,allow
deny from all
satisfy all
</Limit>
This tells the webserver that no HTTP client (web browser) can get access
to any of the files in the directory. PHP is free to read/write those
files however, meaning your databases will still work with the FFDB package.
Note that some webservers have not enabled user .htaccess files. In this
case, your only choice is to try and hide your databases with filenames
that you think no-one would guess -- or you could just place all of your
databases in a directory that you think no-one will guess.
Alternatively, you could use the mcrypt PHP functions to encrypt your data
before storing it in the database. Note that before trying to store raw
binary data in a FFDB database, try encoding them with the base64_encode
and base64_decode functions.
6.0 Bugs
--------
If you find a bug, please contact me, and I'll try to fix it.
Proudly Served by LiteSpeed Web Server at www.celtic-art.roadtonet.com Port 443