#!/usr/local/bin/perl ##----製作者----## # # toto-checker Version 1.00 # # This is Freeware. # Script written by Masayoshi # Created on: 2002.04.13 # Update: 2002.09.03 # I can be reached at: masayosi@mahoroba.ne.jp # Scripts Found at: http://www3.mahoroba.ne.jp/~masayosi/jfl/top.shtml # ############################################################ require 'cgi-lib.pl'; &ReadParse(in); ##----設定----## # タイトル $title = "toto-checker : manage"; # 記録ファイル $dat = "toto.dat"; # 色設定 $bgcolor = "#FFCC00"; $text = "#000000"; $tabgc = "#FFA042"; $link = "#CC6600"; $vlink = "#990000"; $alink = "#FF3300"; $hlink = "#FF0000"; ## パスワード # 入力キー $addpas = "1234"; # 削除キー $delpas = "4321"; ##----設定終了----## $in{'number'} =~ s//>/g; $in{'pas'} =~ s//>/g; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "$title\n"; print "\n"; print "\n"; print "\n\n"; ##----分岐----## unless($in{'add'} eq ""){ &add; } unless($in{'del'} eq ""){ &del; } if($in{'number'} eq ""){ &display; } elsif($in{'number'} =~ /[^0-9]/){ print "

開催回を半角英数字で入力してください

\n"; print "\n"; print "\n"; exit; } elsif($in{'pas'} eq "$addpas"){ &addcheck; } elsif($in{'pas'} eq "$delpas"){ &delcheck; } else{ print "

パスワードが違うか未入力です

\n"; print "

戻る

\n"; print "\n"; print "\n"; exit; } ##----入力欄----## sub display{ print "
\n\n"; print "

\n"; print "
  [1] [0] [2] 中止
1
2
3
4
5
6
7
8
9
10
11
12
13
\n"; print "

Password :

\n"; print "

\n"; print "
\n\n"; print "

toto-checker Ver.1.00

\n"; print "\n"; print "\n"; exit; } ##----入力確認----## sub addcheck{ open (FILE, "$dat"); @allbody = ; close(FILE); foreach $line (@allbody){ if($line =~ /$in{'number'}/){ print "

第 $in{'number'} 回の結果は既に登録されています

\n"; print "

戻る

\n"; print "\n"; print "\n"; exit; } } @line = ("$in{'number'}", "$in{'r1'}", "$in{'r2'}", "$in{'r3'}", "$in{'r4'}", "$in{'r5'}", "$in{'r6'}", "$in{'r7'}", "$in{'r8'}", "$in{'r9'}", "$in{'r10'}", "$in{'r11'}", "$in{'r12'}", "$in{'r13'}"); $result = join(":", @line); print "
\n\n"; print "\n"; ($r0, $r1, $r2, $r3, $r4, $r5, $r6, $r7, $r8, $r9, $r10, $r11, $r12, $r13) = split(/:/,$result); print "

[最終確認]

\n"; print "
第 $r0 回
  結果
1 $r1
2 $r2
3 $r3
4 $r4
5 $r5
6 $r6
7 $r7
8 $r8
9 $r9
10 $r10
11 $r11
12 $r12
13 $r13
\n"; print "

\n"; print "
\n\n"; print "

戻る

\n"; print "\n"; print "\n"; exit; } ##----入力----## sub add{ open (FILE, ">>$dat"); print FILE "$in{'add'}\n"; close(FILE); print "

入力完了

\n"; print "

戻る

\n"; print "\n"; print "\n"; exit; } ##----削除確認----## sub delcheck{ print "
\n\n"; print "\n"; print "

第 $in{'number'} 回を削除しますか?

\n"; print "

\n"; print "
\n\n"; print "

戻る

\n"; print "\n"; print "\n"; exit; } ##----削除----## sub del{ open (FILE, "<$dat"); @allbody = ; close (FILE); foreach $line (@allbody){ if($line =~ /$in{'del'}/){ $line =~ s/.*\n//; } } open (FILE, ">$dat"); print FILE @allbody; close (FILE); print "

削除完了

\n"; print "

戻る

\n"; print "\n"; print "\n"; exit; } ##----Copyright (C) 2002 Masayoshi. All Rights Reserved.----##