Ok, it depends on what you want your admin script to do.
If the script is supposed to create an html file using some data from a database (like Links does), then here we go:
Code:
#!/usr/bin/perl
#-------------------------------+
# Simple Database Engine 1.0 |
# by Pasha Golovko |
# webmaster@find.virtualave.net |
# http://find.virtualave.net |
#-------------------------------+
#
# Chmod:
# database.cgi 755 (rwxr-xr-x)
# database.txt 777 (rwxrwxrwx)
# index.htm 777 (rwxrwxrwx)
#
# Display some header
$html1 = qq~
<html>
<head>
<title>My simple database</title>
</head>
<body>
~;
# Display some footer
$html2 = qq~
</body>
</html>
~;
# Open my silly database
open(LOGFILE, "<database.txt");
@entries = <LOGFILE>;
close LOGFILE;
# Open the output file
open (HTML,">index.htm");
# Print header
print HTML"$html1";
# Now, lets split what ever we got in the database ...
foreach $line (@entries) {
@fields = split(/\|/,$line);
# ... and print what ever fields we got from database
print HTML "$fields[0] - $fields[1] - $fields[2] - $fields[3] <br>";
};
# Print footer
print HTML"$html2";
# Close the output file
close (HTML);
# Print some visual output, when your script finished working with database
print "Content-type: text/plain\n\n";
print "Done!";
This script will get the data from a 'database.txt' file, and create an 'index.html' file with the data that it got from the database.
If your admin script is supposed to do some e-mailing from database, then:
1. open the database
2. open sendmail
3. print the database to the sendmail
If the script is supposed to sort the data, then:
1. open the database, get some data
2. sort the data
3. print sorted data back to the database
If you need any help, just ask.
Regards,
Pasha
------------------
webmaster@find.virtualave.net http://find.virtualave.net