| Name | Size | Mode | Actions |
|---|---|---|---|
| WORLD_WRITABLE/ | - | 0755 | rm |
| caution.xbm | 741 | 0644 | editdlrm |
| clickable_image.cgi | 808 | 0644 | editdlrm |
| cookie.cgi | 2263 | 0644 | editdlrm |
| crash.cgi | 131 | 0644 | editdlrm |
| customize.cgi | 2454 | 0644 | editdlrm |
| diff_upload.cgi | 1595 | 0644 | editdlrm |
| file_upload.cgi | 1998 | 0644 | editdlrm |
| frameset.cgi | 2076 | 0644 | editdlrm |
| index.html | 3487 | 0644 | editdlrm |
| internal_links.cgi | 1019 | 0644 | editdlrm |
| javascript.cgi | 3049 | 0644 | editdlrm |
| make_links.pl | 196 | 0644 | editdlrm |
| monty.cgi | 2086 | 0644 | editdlrm |
| multiple_forms.cgi | 1599 | 0644 | editdlrm |
| nph-clock.cgi | 359 | 0644 | editdlrm |
| nph-multipart.cgi | 263 | 0644 | editdlrm |
| popup.cgi | 1024 | 0644 | editdlrm |
| save_state.cgi | 2311 | 0644 | editdlrm |
| tryit.cgi | 780 | 0644 | editdlrm |
/usr/share/perl5/CGI/examples/save_state.cgi (2311B)
"; $default_name = $query->remote_addr . '.sav'; print "Save/restore state from file: ",$query->textfield('savefile',$default_name),"\n"; print "
"; print $query->submit('action','SAVE'),$query->submit('action','RESTORE'); print "
",$query->defaults; print $query->endform; # Here we print out a bit at the end print $query->end_html; sub save_parameters { local($query) = @_; local($filename) = &clean_name($query->param('savefile')); if (open(FILE,">$filename")) { $query->save(FILE); close FILE; print "State has been saved to file $filename\n"; print "
If you remember this name you can restore the state later.\n"; } else { print "Error: couldn't write to file $filename: $!\n"; } } sub restore_parameters { local($query) = @_; local($filename) = &clean_name($query->param('savefile')); if (open(FILE,$filename)) { $query = new CGI(FILE); # Throw out the old query, replace it with a new one close FILE; print "State has been restored from file $filename\n"; } else { print "Error: couldn't restore file $filename: $!\n"; } return $query; } # Very important subroutine -- get rid of all the naughty # metacharacters from the file name. If there are, we # complain bitterly and die. sub clean_name { local($name) = @_; unless ($name=~/^[\w\._\-]+$/) { print "$name has naughty characters. Only "; print "alphanumerics are allowed. You can't use absolute names."; die "Attempt to use naughty characters"; } return "WORLD_WRITABLE/$name"; }