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
/
remove_Channels.cgi
< prev
next >
Wrap
Text File
|
1999-02-12
|
3KB
|
105 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";
$temp = "";
# call initial functions
&Get_request_types;
&Analyse_file;
#########################################################################
sub Get_request_types {
&ReadParse(*input);
$name_in = ($input{'name'});
}
#########################################################################
sub Analyse_file {
print &Header;
print &Top("test");
$output = "STDOUT";
## wipe temp links file for new order of entries
open (LNKFILE, ">channels2.txt") || die "Could not open or find $filename\n";
print LNKFILE "";
close (LNKFILE);
## open links file for reading and determine whether current entries match
## the given one - if yes then it is not printed to the temp links file.
open (LOGFILE, "<channels.txt") || die "Could not open or find $filename\n";
open (LNKFILE, ">>channels2.txt") || die "Could not open or find $filename\n";
foreach $line (<LOGFILE>) {
($category, $name, $desc) = split(' : ', $line);
if ($name_in ne $name) {print LNKFILE "$category : $name : $desc";}
}
close (LNKFILE);
close (LOGFILE);
## write a blank char to the links file.
open (LOGFILE, ">channels.txt") || die "Could not open or find $filename\n";
print LOGFILE "";
close (LOGFILE);
## open temp links file and transfer to the existing (blank) links file.
open (LNKFILE, "<channels2.txt") || die "Could not open or find $filename\n";
open (LOGFILE, ">>channels.txt") || die "Could not open or find $filename\n";
foreach $line (<LNKFILE>) {
($category, $name, $desc) = split(' : ', $line);
print LOGFILE "$category : $name : $desc";
}
close(LOGFILE);
close(LNKFILE);
print $output "Channel $name_in has been removed..";
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 / removing a channel</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";
}