figlet_insecure2.cgi

来自「嵌入式WEB」· CGI 代码 · 共 40 行

CGI
40
字号
#!/usr/bin/perl -w##WARNINGThis warning is here to prevent this script from compiling sinceyou really should NOT be using this on a production web server.If you want to experiment on a private web server, remove this warning##use strict;use CGI;use CGIBook::Error;my $FIGLET = '/usr/local/bin/figlet';my $q      = new CGI;my $string = $q->param( "string" );unless ( $string ) {    error( $q, "Please enter some text to display." );}unless ( $string =~ /^[\w .!?-]+$/ ) {    error( $q, "You entered an invalid character. " .               "You may only enter letters, numbers, " .               "underscores, spaces, periods, exclamation " .               "points, question marks, and hyphens." );}local *PIPE;## This code is more secure, but still dangerous...## Do NOT use this code on a live web server!!open PIPE, "$FIGLET '$string' |" or    die "Cannot open figlet: $!";print $q->header( "text/plain" );print while <PIPE>;close PIPE;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?