Make My Life EZ, DB
April 17, 2000
The script is EZDB, one of the most useful scripts on the planet.
If you learn to use it, you will use it. It does everything
from store and display applecrisp recipies to bulk update of
hundred (or thousands, I imagine) of static HTML files.
I did write a
script from scratch, (a breach of the
International Web Designer's Treaty of 1997, I know) for those
who just want the thing to work and let the next guy worry about
extensibility.
#!/usr/bin/perl
require "cgi-lib.pl";
&ReadParse(*bubbaform);
$title = $bubbaform{'title'};
$star = $bubbaform{'star'};
$rate = $bubbaform{'rate'};
$time = $bubbaform{'time'};
$url = $bubbaform{'url'};
open (TEMP_FILE, ">data.txt")
..... || &CgiDie ("Cannot open temp.txt");
print TEMP_FILE "title=$title\n";
print TEMP_FILE "&star=$star\n";
print TEMP_FILE "&rate=$rate\n";
print TEMP_FILE "&time=$time\n";
print TEMP_FILE "&url=$url\n";
close (TEMP_FILE);
print "Content-type: text/html\n\n";
print qq!
<HTML>
<HEAD><TITLE>Confirm Post</TITLE></HEAD>
<BODY><H1>Good Job, Bubba - You done good</H1></BODY>
!;
This little scrap just takes Bubba's form input and writes it to
a text file in the syntax that Flash requires. That's it. That's
all it does. You probably won't use this script on a lot of other,
different sites. If you actually use this method, you should
probably put bubbaform.html and plex_01.swf in a directory
away from your cgi-bin and call them with full url/path. Cgi-lib,
bad_code.cgi, and data.txt can all be in the executable directory.
Note: the most important difference between loading a static file
and what we will do with EZDB and the other solution (loading
variables from a .txt file) is that if you use the .txt file
solution, users will not see the updated listing until plex_01.swf
is emptied from their browser cache. The EZDB method does
not have this problem.
Footnote to note: If you are interested in doing this type of
thing - frequently updated text in small Flash movies, but
without all the DB baggage - Swift Generator is the perfect
solution. At this point it would take about 2 minutes to change
bad_code.cgi so that it wrote a Swift Script (.sws) instead of
the text file, after which you could serve dynamically generated
Flash movies. Email me if you would like to see more on this type
of solution on WDVL.
Download EZDB
and install it. Ordinarily, this would be a chore
in itself, (installing, configuring, trouble-shooting, and
learning a new script), but EZDB is as easy as the name sounds.
Seriously, it installs itself. If you can upload and chmod
a file (you don't even have to chmod if you untar it on the server),
and possibly change the path to PERL on your machine, then setup
will take you less than 5 minutes.
Don't forget to vote for
EZDB and send the author an email of gratitude for writing such a
cool script.
Installation Notes:
- If you have your own server or a shell account, it is easiest to
unpack the tar file because the permissions are already set - just
put ezdb21b.tar in the directory you choose and type:
tar xvfp ezdb21b.tar
- If you can't untar the package on the server, the call
http://www.yourdomain.com/cgi-bin/ezdb.cgi?setup
will tell you which permissions need to be changed.
- The easiest way to change the password is directly in the file
user_data in the system_db directory.
- The ReadMe is good - use it!
Go ahead and take the time to read through the thorough
documentation and get familiar with the app. When we start
customizing the database make for Bubba, we will assume that you
have the script installed and that you can perform the elementary
functions. See you in 45 minutes!
Perl, Little-known Sixth Shao Lin Animal
Tricks & Data, Flash Yin & Yang
Setting up Bubba's DB
|