This file contains two cgi files to run Rcgi. File goR3nopic.cgi ==================== #!/usr/bin/perl # # Rcgi main file... see documentation for licencing. my($temp); $temp = "/mnt/disknt1/statguest/statweb/public_html/tmp"; $allowedhost = ''; # $allowedhost = '\.edu'; #use strict; # the referer() seems to cause strict problems use CGI; my($results, $in); my($q)= new CGI; # Reconstruct any inputs #if ($results=$q->param('CALLER')) { # $results=''; # } #@input = $q->param('INPUT'); $in=join("\n",$q->param('INPUT')); # Print input form print $q->header, ' Rcgi

Rcgi

Release 3 - "Cardiff"

'; #Program Input
#
#
#'.$results.'
'; # Basic security checks if (($q->referer()) && ($q->referer() !~ /$allowedhost\//)) { print 'Sorry, the website which sent you here is not allowed to run scripts here. Email the author of the previous page and ask them to look into it.'; exit; } if ($in) { # Give our input (if any) to R chdir($temp); # open(R, "| tee $temp/R3.Rin | R --no-save >$temp/R3.Rout"); open(R, ">$temp/R3.Rin"); $in =~ s/\r//g; $in =~ s/(unlink|postscript|bitmap|unix|system|pdf|pictex|xfig)[^\n]*//g; $in =~ s/(file|dir.create|cat|open|close|pipe|fifo|socket)[^\n]*//g; # I think they're the only really nasty things to trap... print R $in."\n"; # End it politely (not an EOF at the end of a command) close R; my $x = system(`R --vanilla -q <$temp/R3.Rin >$temp/R3.Rout`); # Read the output open(IN, "$temp/R3.Rout"); # Tidy it up for HTML $results = join(" ",); $results =~ s/&/&/g; $results =~ s//>/g; close(IN); # Print it out print '
Program Output
*** Rcgi reference '.$$.':'
.`date +%Y%m%d%H%M%S`."\n".$results
.'

'; # Have we got a call-back name? # if ($in=$q->param('CALLER')) { # print '
Return to '.$in.''; # } } # print '
R language help'; print ''; File goR3.cgi ============= #!/usr/bin/perl # # Rcgi main file... see documentation for licencing. my($temp); $temp = "/mnt/disknt1/statguest/statweb/public_html/tmp"; use CGI; my($results, $in); my($q)= new CGI; my $x = system(`rm /mnt/disknt1/statguest/statweb/public_html/tmp/R3.bmp`); # Reconstruct any inputs if ($results=$q->param('CALLER')) { $results=''; } #@input = $q->param('INPUT'); $in=join("\n",$q->param('INPUT')); # Print input form print $q->header, ' Rcgi

Rcgi

Release 3 - "Cardiff"

Program Input

'.$results.'
'; if ($in) { # Give our input (if any) to R chdir($temp); # open(R, "| tee $temp/R3.Rin | R --no-save >$temp/R3.Rout"); open(R, ">$temp/R3pic.Rin"); print R "bitmap(\"/mnt/disknt1/statguest/statweb/public_html/tmp/R3.bmp\", type = \"bmp256\")\n"; $in =~ s/\r//g; $in =~ s/(unlink|unix|postscript|system)[^\n]*//g; # I think they're the only really nasty things to trap... print R $in."\n"; # End it politely (not an EOF at the end of a command) close R; my $x = system(`R --vanilla -q <$temp/R3pic.Rin >$temp/R3pic.Rout`); # Saving CPU at expense of disk space (note in .gif script) # `gzip $$.Rps`; my $x = system(`chmod 644 /mnt/disknt1/statguest/statweb/public_html/tmp/R3.bmp`); # Read the output open(IN, "$temp/R3pic.Rout"); # Tidy it up for HTML $results = join(" ",); $results =~ s/&/&/g; $results =~ s//>/g; close(IN); # Print it out print '
Program Output
*** Rcgi reference '.$$.':'
.`date +%Y%m%d%H%M%S`."\n".$results
.'

Graphical Output (if any) :
If the graph showing is an older plot, click the refresh button on your browser. We only provide one page, low quality bitmap graphics over web. There are many high quality graphics in R though.'; # Have we got a call-back name? if ($in=$q->param('CALLER')) { print '
Return to '.$in.''; } } # print '
R language help'; print '';