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_Channels.cgi next >
Text File  |  1999-02-12  |  2KB  |  90 lines

  1. #!/usr/bin/perl
  2.  
  3. require ("cgi-lib.pl") or die "Could not open or find cgi-lib.pl\n";
  4.  
  5. # declare variables
  6. $current_ip = "nothing";
  7.  
  8. $filename = "links.txt";
  9.  
  10. # call initial functions
  11. &Get_request_types;
  12. &Analyse_file;
  13.  
  14. #########################################################################
  15.  
  16. sub Get_request_types {
  17.         
  18. &ReadParse(*input);
  19. $link_cat_in = ($input{'category'});
  20. $name_in = ($input{'name'});
  21. $desc_in = ($input{'desc'});
  22.  
  23. }
  24.  
  25. #########################################################################
  26.  
  27. sub Analyse_file {
  28.  
  29. print &Header;
  30. print &Top("test");
  31. $output = "STDOUT";
  32.  
  33. open (LOGFILE, ">>channels.txt") || die "Could not open or find $filename\n";
  34.  
  35.     foreach $line (<LOGFILE>) {
  36.     ($category, $name, $desc) = split(' : ', $line);
  37.          if ($name_in eq $name) {$does_exist = "true";}
  38.  
  39.     }
  40.  
  41. if ($does_exist eq "true") {
  42.  
  43. print $output "Link has not been added";
  44.  
  45. } else {
  46.  
  47. print LOGFILE "$link_cat_in : $name_in : $desc_in\n";
  48. print $output "Channel $name_in has been added";
  49.  
  50. }
  51.  
  52. close(LOGFILE);
  53.  
  54. print &Bottom;
  55.  
  56. }
  57.  
  58. #########################################################################
  59.  
  60. #_____Module Returns the Output Document Type______#
  61. sub Header
  62. {
  63.         return "Content-type: text/html\n\n";
  64. }   
  65.  
  66. #_____Module Returns the Output Document Head_______#
  67. sub Top
  68. {
  69.         my ($title) = @_;
  70.         return <<"ENDPRINT";
  71. <HTML>
  72. <HEAD>
  73. <TITLE>acheron.org // admin / adding a channel</TITLE>
  74. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  75. </HEAD>
  76.  
  77. <BODY link="#FFCC00" vlink="#FF9900" alink="#FFFFFF" text="#cccccc" BGCOLOR="#000000">
  78. <div align="center">
  79.               <table border="0" width="640" align="center" cellspacing="0" cellpadding="0">
  80.                 <tr> 
  81.                   <td width="640"> 
  82.                     <p><font size="2" face="Arial, Helvetica, sans-serif">
  83. ENDPRINT
  84. }
  85.  
  86. #_____Module Returns the Output Document Bottom______#
  87. sub Bottom
  88. {
  89.         return "</td></tr></table></div></BODY></HTML>\n";
  90. }