home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / FAQ / cgi-bin / discus4_00 / source / board-search.cgi < prev    next >
Text File  |  2009-11-06  |  1KB  |  50 lines

  1. #
  2. #-------------------------------------------------------------------------------
  3. # DISCUS COPYRIGHT NOTICE
  4. #
  5. # Discus is copyright (c) 2002 by DiscusWare, LLC, all rights reserved.
  6. # The use of Discus is governed by the Discus License Agreement which is
  7. # available from the Discus WWW site at:
  8. #    http://www.discusware.com/discus/license
  9. #
  10. # Pursuant to the Discus License Agreement, this copyright notice may not be
  11. # removed or altered in any way.
  12. #-------------------------------------------------------------------------------
  13.  
  14. use strict;
  15. use vars qw($GLOBAL_OPTIONS $PARAMS $DCONF);
  16.  
  17. $DCONF->{script_dir} = ".";
  18. my $e = get_cgi_extension($0);
  19.  
  20. if (-e "$DCONF->{script_dir}/config.$e") {
  21.     require "$DCONF->{script_dir}/config.$e";
  22. } elsif (-e "./config.$e") {
  23.     require "./config.$e";
  24. } else {
  25.     print "Content-type: text/html\n\n";
  26.     print "Script Execution Error: <b>config.*** location error [1]</b>.\n";
  27.     exit(0);
  28. }
  29. discus("board-search");
  30.  
  31. sub get_cgi_extension {
  32.     my ($zero) = @_;
  33.     if ($zero =~ m|\.(\w+)$|) {
  34.         return $1;
  35.     }
  36.     foreach my $try ('cgi', 'pl') {
  37.         return $try if -e "./config.$try";
  38.     }
  39.     opendir(DIR, ".");
  40.     while (my $i = readdir(DIR)) {
  41.         return $1 if $i =~ m|^config\.(\w+)$|;
  42.     }
  43.     closedir(DIR);
  44.     print "Content-type: text/html\n\n";
  45.     print "Script Execution Error: <b>config.*** location error [2]</b>.\n";
  46.     exit(0);
  47. }
  48.  
  49. 1;
  50.