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 >
Text File  |  1999-02-05  |  2KB  |  91 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. $url_in = ($input{'url'});
  22. $desc_in = ($input{'desc'});
  23.  
  24. }
  25.  
  26. #########################################################################
  27.  
  28. sub Analyse_file {
  29.  
  30. print &Header;
  31. print &Top("test");
  32. $output = "STDOUT";
  33.  
  34. open (LOGFILE, ">>links.txt") || die "Could not open or find $filename\n";
  35.  
  36.     foreach $line (<LOGFILE>) {
  37.     ($category, $name, $url, $desc) = split(' : ', $line);
  38.          if ($name_in eq $name) {$does_exist = "true";}
  39.  
  40.     }
  41.  
  42. if ($does_exist eq "true") {
  43.  
  44. print $output "Link has not been added";
  45.  
  46. } else {
  47.  
  48. print LOGFILE "$link_cat_in : $name_in : $url_in : $desc_in\n";
  49. print $output "Link has been added";
  50.  
  51. }
  52.  
  53. close(LOGFILE);
  54.  
  55. print &Bottom;
  56.  
  57. }
  58.  
  59. #########################################################################
  60.  
  61. #_____Module Returns the Output Document Type______#
  62. sub Header
  63. {
  64.         return "Content-type: text/html\n\n";
  65. }   
  66.  
  67. #_____Module Returns the Output Document Head_______#
  68. sub Top
  69. {
  70.         my ($title) = @_;
  71.         return <<"ENDPRINT";
  72. <HTML>
  73. <HEAD>
  74. <TITLE>acheron.org // admin / banner statistics</TITLE>
  75. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  76. </HEAD>
  77.  
  78. <BODY link="#FFCC00" vlink="#FF9900" alink="#FFFFFF" text="#cccccc" BGCOLOR="#000000">
  79. <div align="center">
  80.               <table border="0" width="640" align="center" cellspacing="0" cellpadding="0">
  81.                 <tr> 
  82.                   <td width="640"> 
  83.                     <p><font size="2" face="Arial, Helvetica, sans-serif">
  84. ENDPRINT
  85. }
  86.  
  87. #_____Module Returns the Output Document Bottom______#
  88. sub Bottom
  89. {
  90.         return "</td></tr></table></div></BODY></HTML>\n";
  91. }