home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.sunet.sepub/pictures
/
2014.11.ftp.sunet.se-pictures.tar
/
ftp.sunet.se
/
pub
/
pictures
/
ACiD-artpacks
/
www
/
mirrors
/
acheron
/
cgi-bin
/
add_Links.cgi
< prev
next >
Wrap
Text File
|
1999-02-05
|
2KB
|
91 lines
#!/usr/bin/perl
require ("cgi-lib.pl") or die "Could not open or find cgi-lib.pl\n";
# declare variables
$current_ip = "nothing";
$filename = "links.txt";
# call initial functions
&Get_request_types;
&Analyse_file;
#########################################################################
sub Get_request_types {
&ReadParse(*input);
$link_cat_in = ($input{'category'});
$name_in = ($input{'name'});
$url_in = ($input{'url'});
$desc_in = ($input{'desc'});
}
#########################################################################
sub Analyse_file {
print &Header;
print &Top("test");
$output = "STDOUT";
open (LOGFILE, ">>links.txt") || die "Could not open or find $filename\n";
foreach $line (<LOGFILE>) {
($category, $name, $url, $desc) = split(' : ', $line);
if ($name_in eq $name) {$does_exist = "true";}
}
if ($does_exist eq "true") {
print $output "Link has not been added";
} else {
print LOGFILE "$link_cat_in : $name_in : $url_in : $desc_in\n";
print $output "Link has been added";
}
close(LOGFILE);
print &Bottom;
}
#########################################################################
#_____Module Returns the Output Document Type______#
sub Header
{
return "Content-type: text/html\n\n";
}
#_____Module Returns the Output Document Head_______#
sub Top
{
my ($title) = @_;
return <<"ENDPRINT";
<HTML>
<HEAD>
<TITLE>acheron.org // admin / banner statistics</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY link="#FFCC00" vlink="#FF9900" alink="#FFFFFF" text="#cccccc" BGCOLOR="#000000">
<div align="center">
<table border="0" width="640" align="center" cellspacing="0" cellpadding="0">
<tr>
<td width="640">
<p><font size="2" face="Arial, Helvetica, sans-serif">
ENDPRINT
}
#_____Module Returns the Output Document Bottom______#
sub Bottom
{
return "</td></tr></table></div></BODY></HTML>\n";
}