#!/usr/bin/perl


=pod

   AUTHOR

        -Tommy Butler, consultant
         Atrixnet, for Internet Business Software
            http://atrixnet.com
            2200 North Lamar
            Suite 307
            Dallas, TX
                 75202

   COPYRIGHT

         Copyright Atrixnet. All rights reserved

   LISCENCE

         This software is free, and you may use
         and distribute it under the GNU GPL.

=cut

use CGI;

my($user)       = ;# On this line,  between the the equal sign and the
                   # semicolon, type in your MySQL account username.

my($password)   = ;# On this line, between the equal sign and the
                   # semicolon, type in your MySQL account password.

my($datasource) = ;# On this line, between the equal sign and the semicolon,
                   # type in the name of the database after the equal sign.

my($table)      = ;# On this line, between the equal sign and the
                   # semicolon, type in the name of the DB table
                   # containing the data you wish to export.  This
                   # argument may be safely eliminated if you want the
                   # entire contents of the database dumped into the
                   # output file you specify.

my($datasource) = ;# On this line, between the equal sign and the semicolon,
                   # type in the path and filename of the file which you want
                   # to be filled with the contents of the database table.

my($cmd)        = qq[mysqldump -u $user -p $datasource $table > $outfile\n$password\n];

my($filesize)   = (-e $outfile);

`$cmd`;

print($cgi->header());

(-e $outfile) # if the output file exists...

   ? print(qq[\nThe resuls of the mysqldump: ]. # then print this msg.
           qq[[1]the output file was created ].
           qq[[2]the filesize is $filesize\n\n]);

   # but if the output file does not exist...
   : print(qq[\nIt appears that the mysqldump was not ]. # ...print this msg

           qq[successful. The output file was never created.\n\n]);

   exit; # all done.