Diff for /db/prgsrc/db.cgi between versions 1.8 and 1.11

version 1.8, 2000/10/21 04:25:22 version 1.11, 2000/10/24 17:59:25
Line 10  my ($PWD) = `pwd`; Line 10  my ($PWD) = `pwd`;
 chomp $PWD;  chomp $PWD;
 my ($SRCPATH) = "$PWD/../dimrub/src";  my ($SRCPATH) = "$PWD/../dimrub/src";
 my ($ZIP) = "/home/piataev/bin/zip";  my ($ZIP) = "/home/piataev/bin/zip";
   my $DUMPFILE = "/tmp/chgkdump";
 my ($SENDMAIL) = "/usr/sbin/sendmail";  my ($SENDMAIL) = "/usr/sbin/sendmail";
 my ($TMSECS) = 30*24*60*60;  my ($TMSECS) = 30*24*60*60;
 my (%RevMonths) =   my (%RevMonths) = 
Line 473  sub Get12Random { Line 474  sub Get12Random {
         my (%chosen);          my (%chosen);
         srand;          srand;
                   
         for ($i = 0; $i < $num; $i++) {     for ($i = 0; $i < $num; $i++) {
                 do {         do {
                         $q = int(rand($qnum));             $q = int(rand($qnum));
                         $sth = $dbh->prepare("SELECT Type FROM Questions             $sth = $dbh->prepare("SELECT Type FROM Questions
                                 WHERE QuestionId=$q");                                  WHERE QuestionId=$q");
                         $sth->execute;             $sth->execute;
                         $t = ($sth->fetchrow)[0];             $t = ($sth->fetchrow)[0];
                 } until !$chosen{$q} && $type =~ /[$t]/;         } until !$chosen{$q} && $t && $type =~ /[$t]/;
                 $chosen{$q} = 'y';         $chosen{$q} = 'y';
                 push @questions, $q;         push @questions, $q;
         }     }
         return @questions;     return @questions;
 }  }
   
 sub Include_virtual {  sub Include_virtual {
Line 589  MAIN: Line 590  MAIN:
                     print end_html;                      print end_html;
                         die "Can't connect to DB chgk\n";                          die "Can't connect to DB chgk\n";
                 };                  };
         if (!param('comp') and !$text) {          if (!param('comp') and !param('sqldump') and !$text) {
            print header;             print header;
            print start_html(-"title"=>'Database of the questions',             print start_html(-"title"=>'Database of the questions',
                    -author=>'dimrub@icomverse.com',                     -author=>'dimrub@icomverse.com',
Line 634  EOT Line 635  EOT
         } elsif (param('from_year') && param('to_year')) {          } elsif (param('from_year') && param('to_year')) {
                 print &PrintDates($dbh);                          print &PrintDates($dbh);        
         } elsif (param('comp')) {          } elsif (param('comp')) {
                 print header(              print header(
                         -'Content-Type' => 'application/x-zip-compressed; name="db.zip"',                           -'Content-Type' => 'application/x-zip-compressed; name="db.zip"',
                         -'Content-Disposition' => 'attachment; filename="db.zip"'                           -'Content-Disposition' => 'attachment; filename="db.zip"'
                 );                           );
                 $tour = (param('tour')) ? param('tour') : 0;              $tour = (param('tour')) ? param('tour') : 0;
                 my (@files) = &PrintArchive($dbh, $tour);              my (@files) = &PrintArchive($dbh, $tour);
                 open F, "$ZIP -j - $SRCPATH/COPYRIGHT @files |";              open F, "$ZIP -j - $SRCPATH/COPYRIGHT @files |";
                 print (<F>);              print (<F>);
                 close F;              close F;
                 $dbh->disconnect;              $dbh->disconnect;
                 exit;              exit;
           } elsif (param('sqldump')) {
               print header(
                            -'Content-Type' => 'application/x-zip-compressed; name="dump.zip"',
                            -'Content-Disposition' => 'attachment; filename="dump.zip"'
                            );
               open F, "$ZIP -j - $DUMPFILE |";
               print (<F>);
               close F;
               $dbh->disconnect;
               exit;
   
         } else {          } else {
                 $tour = (param('tour')) ? param('tour') : 0;                  $tour = (param('tour')) ? param('tour') : 0;
                 if ($tour !~ /^[0-9]*$/) {                  if ($tour !~ /^[0-9]*$/) {

Removed from v.1.8  
changed lines
  Added in v.1.11


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>