⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 download.cgi

📁 ◎「ダウンロードCGI」 Ver1.1 設定&使用説明 画像や着信メロディなどのデータをEZweb対応端末にダウンロード&#12539 保存するためのCGIです。 ※ サンプルプログラムに
💻 CGI
字号:
#!/usr/local/bin/perl&up_download;####################################################################### download.cgi Ver1.2 2007/7/9## This function builds a digest containing the splash screen image# and the application's home HDML deck.#######################################################################sub up_download{  %cgiVars = ParseCGIVars();  my($offsetx)=$cgiVars{"offset"};  my($countx)=$cgiVars{"count"};  my($namex)=$cgiVars{"name"};  #check file path  &checkpath($namex) or die("bad file name");  # This is Content-Length Value.  $conLeng = $countx - $offsetx;      #offset = 0  if ($offsetx >= 0 && $countx > 0){    # Read in the image. In production code, you should    # check for, and handle, errors in reading in images.    sysopen(FD, $namex, O_RDONLY) or die("file not found");    binmode FD;    seek(FD, $offsetx, 0);    read(FD, $buf, $countx);    close FD;    # HEADER     #      print "Content-type: application/x-up-download\n";#   print "Content-length: $countx\n";    print "\n";    binmode STDOUT;     print $buf;  }  elsif($offsetx == 0 && $countx == 0){  # If &receipt was appended to the download request,  # the device will request a buffer of size count=0  # to indicate completion; so, return an "empty"  # download header  #    print "Content-type: application/x-up-download\n";    print "Content-length: 0\n";    print "\n";  }  elsif($offsetx == -1 && $countx == -1){    print "Content-type: text/x-hdml;charset=Shift_JIS\n\n";    print "<hdml version=3.0 ttl=\"0\" public=true>\n";    print "<display>\n";    print "<action type=accept task=return>\n";    print "<wrap>僟僂儞儘乕僪惉岟偟傑偟偨丅\n";    print "</display>\n";    print "</hdml>\n";  }  elsif($offsetx == -1 && $countx == -2){    print "Content-type: text/x-hdml;charset=Shift_JIS\n\n";    print "<hdml version=3.0 ttl=\"0\" public=true>\n";    print "<display>\n";    print "<action type=accept task=cancel>\n";    print "<wrap>僟僂儞儘乕僪幐攕偟傑偟偨丅"."\n";    print "</display>\n";    print "</hdml>\n";  }  else {    open (OUT,">>test.txt");    print "Content-type: text/x-hdml;charset=Shift_JIS\n\n";    print "<hdml version=3.0 ttl=\"0\" public=true>\n";    print "<display>\n";    print "<action type=accept task=cancel>\n";    print "<wrap>僟僂儞儘乕僪幐攕偟傑偟偨丅"."\n";    print "</display>\n";    print "</hdml>\n";  }}sub ParseCGIVars{  my($name, $value, %envArray);  my($queryString, $i);  # Read in the cgi environment variables  $queryString = $ENV{'QUERY_STRING'};  # Append any POST data to the query string arguments  #  if ($ENV{'REQUEST_METHOD'} eq "POST") {    if ($queryString ne "") {      $queryString .= "&";    }    for ($i = 0; $i < $ENV{'CONTENT_LENGTH'}; $i++) {      $queryString .= getc;    }  }  return &ParseURLEncodedString($queryString);}sub ParseURLEncodedString{  my $queryString = shift;  my($name, $value, %envArray);  foreach (split(/&/, $queryString)) {    # Convert plus's to spaces.    s/\+/ /g;    # Convert %XX from hex numbers to alphanumeric.    s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("c",hex($1))/ge;    # Split into variable and value.    ($name, $value) = split(/=/, $_, 2);    $envArray{$name} = $value;    }  # Return the associative array    %envArray;}sub checkpath {    my $path = shift;    my $tResult = $path;   	if($tResult eq '.')	{		return(0);	}	if($tResult eq '..')	{		return(0);	}	$tResult=~ s/[0-9A-Za-z]//g;	$tResult=~ s/\.//g;	$tResult=~ s/\-//g;	$tResult=~ s/\_//g;	$tResult=~ s/\%//g;	$tResult=~ s/\~//g;	if($tResult eq '')	{		return(1);	}	else	{		return(0);	}}}

⌨️ 快捷键说明

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