CGI Perl総合at HACK
CGI Perl総合 - 暇つぶし2ch3:none
01/03/16 00:44
あってますか?#!/usr/local/bin/perl

$cnt_file = 'cnt.dat';

open(fp,"$cnt_file");
$cnt = <fp>;
close(fp);
++$cnt;
$len = length $cnt;
if ($len < $n) {
$imgfile = "0";
} else {
$imgfile = substr($cnt, $len-$n, 1);
}
open(IN,"img/$imgfile.gif");
@lines = <IN>;
close(IN);
print "Content-type: image/gif\n\n";
print @lines;
if ($n == 1) {
open(fp,">$cnt_file.tmp");
print fp $cnt;
close(fp);
rename("$cnt_file.tmp", $cnt_file);
}
sub frmdec
{
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$buffer);
foreach $pair (@pairs)
{
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$form{$name} = $value;
}
}





次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch