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 / retrieve_Links.cgi < prev    next >
Text File  |  1999-02-09  |  3KB  |  89 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. $temp = "";
  10.  
  11. # call initial functions
  12. &Get_request_types;
  13. &Analyse_file;
  14.  
  15. #########################################################################
  16.  
  17. sub Get_request_types {
  18.         
  19. &ReadParse(*input);
  20. $name_in = ($input{'name'});
  21.  
  22. }
  23.  
  24. #########################################################################
  25.  
  26. sub Analyse_file {
  27.  
  28. print &Header;
  29. print &Top("test");
  30. $output = "STDOUT";
  31.  
  32. ## open links file for reading and determine whether current entries match 
  33. ## the given one - if yes then it is not printed to the temp links file.
  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) {
  39.             ## print output form with fields filled in
  40.             print $output "<form action=\"/cgi-bin/modify_Links.cgi\" method=\"GET\">\n";
  41.             print $output "<input type=\"hidden\" name=\"category\" value=\"$category\">\n";
  42.             print $output "<input type=\"hidden\" name=\"name\" value=\"$name_in\">\n";
  43.             print $output "Name<br><input type=\"text\" name=\"newname\" value=\"$name\">\n";
  44.             print $output "<p>URL<br><input type=text name=url value=\"$url\">\n";
  45.             print $output "<p>Description<br><input type=\"text\" name=\"desc\" value=\"$desc\"><P>\n";
  46.             print $output "<input type=\"submit\" name=\"submit\" value=\"submit\">\n";
  47.             print $output "</form>";
  48.    
  49.          }   
  50.     }
  51. close (LOGFILE);
  52.  
  53. print &Bottom;
  54.  
  55. }
  56.  
  57. #########################################################################
  58.  
  59. #_____Module Returns the Output Document Type______#
  60. sub Header
  61. {
  62.         return "Content-type: text/html\n\n";
  63. }   
  64.  
  65. #_____Module Returns the Output Document Head_______#
  66. sub Top
  67. {
  68.         my ($title) = @_;
  69.         return <<"ENDPRINT";
  70. <HTML>
  71. <HEAD>
  72. <TITLE>acheron.org // admin / banner statistics</TITLE>
  73. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  74. </HEAD>
  75.  
  76. <BODY link="#FFCC00" vlink="#FF9900" alink="#FFFFFF" text="#cccccc" BGCOLOR="#000000">
  77. <div align="center">
  78.               <table border="0" width="640" align="center" cellspacing="0" cellpadding="0">
  79.                 <tr> 
  80.                   <td width="640"> 
  81.                     <p><font size="2" face="Arial, Helvetica, sans-serif">
  82. ENDPRINT
  83. }
  84.  
  85. #_____Module Returns the Output Document Bottom______#
  86. sub Bottom
  87. {
  88.         return "</td></tr></table></div></BODY></HTML>\n";
  89. }